]> git.proxmox.com Git - pve-ha-manager.git/commitdiff
use systemd condition to avoid daemon startup when ha is disabled
authorDietmar Maurer <dietmar@proxmox.com>
Fri, 13 Mar 2015 15:14:26 +0000 (16:14 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Fri, 13 Mar 2015 15:16:06 +0000 (16:16 +0100)
debian/pve-ha-crm.service
debian/pve-ha-lrm.service
src/PVE/HA/LRM.pm

index 2eccdafe529ab02b52ee2a1e35d2ab756c6fe6ac..34fb91ec274bbd97d75a3c923c3902e7a7900b13 100644 (file)
@@ -1,6 +1,7 @@
 [Unit]
 Description=PVE Cluster Ressource Manager Daemon
 ConditionPathExists=/usr/sbin/pve-ha-crm
+ConditionPathExists=/etc/pve/ha/resources.cfg
 Requires=pve-cluster.service
 Wants=pvedaemon.service
 After=pve-cluster.service
index 24bc90c23e059b5029920fb44d5365f352db8176..f946b192e803039278b2570f567fb7389d15cd7b 100644 (file)
@@ -1,6 +1,7 @@
 [Unit]
 Description=PVE Local HA Ressource Manager Daemon
 ConditionPathExists=/usr/sbin/pve-ha-lrm
+ConditionPathExists=/etc/pve/ha/resources.cfg
 Requires=pve-cluster.service
 Wants=pvedaemon.service
 After=pve-cluster.service
index b2a79c6881e6e65b1bfbc2002c8fe9500a8048b5..d07f2673d91649a4a31ecd696448baff83caa759 100644 (file)
@@ -14,7 +14,6 @@ use PVE::HA::Tools;
 # Server can have several states:
 
 my $valid_states = {
-    disabled => "HA is disabled (no resource configuration)",
     wait_for_agent_lock => "waiting for agent lock",
     active => "got agent_lock",
     lost_agent_lock => "lost agent_lock",
@@ -32,10 +31,7 @@ sub new {
        results => {},
     }, $class;
 
-    my $next_state = $haenv->service_config_exists() ?
-       'wait_for_agent_lock' : 'disabled';
-    
-    $self->set_local_status({ state => $next_state });   
+    $self->set_local_status({ state =>         'wait_for_agent_lock' });   
     
     return $self;
 }
@@ -114,13 +110,7 @@ sub do_one_iteration {
 
     my $ctime = $haenv->get_time();
 
-    if ($state eq 'disabled') {
-
-       if ($haenv->service_config_exists()) {
-           $self->set_local_status({ state => 'wait_for_agent_lock' });
-       }
-       
-    } if ($state eq 'wait_for_agent_lock') {
+    if ($state eq 'wait_for_agent_lock') {
 
        my $service_count = 1; # todo: correctly compute
 
@@ -227,10 +217,9 @@ sub do_one_iteration {
 
            return 0;
        }
-    } elsif ($state eq 'disabled') {
 
-       # do nothing
-       
+       $haenv->sleep(5);
+
     } else {
 
        die "got unexpected status '$state'\n";