]> git.proxmox.com Git - pve-ha-manager.git/commitdiff
skip transition to 'started' state if we won't stay in it
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Tue, 15 Nov 2016 11:11:22 +0000 (12:11 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Tue, 15 Nov 2016 15:36:07 +0000 (16:36 +0100)
If we add a resource wth disabled or stopped state we went through
the started state before changing directly to the request_stop state.

Skip the started state entirely and go direct to the request_stop
state.

This is a small behavioral change, as we never wrote in the
manager_status that we were in the started state but changed directly
to request_stop, so the LRM cannot be affected by this change.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
src/PVE/HA/Manager.pm
src/test/test-basic1/log.expect
src/test/test-relocate-policy-default-group/log.expect
src/test/test-relocate-policy1/log.expect
src/test/test-relocate-to-inactive-node/log.expect
src/test/test-resource-failure1/log.expect
src/test/test-resource-failure2/log.expect
src/test/test-resource-failure5/log.expect
src/test/test-resource-failure6/log.expect

index c2fa2c310b018e17fbd95e92212370a13f867aa2..9d333fbfa4513018c541cc6f6f8aac8205b01f76 100644 (file)
@@ -380,9 +380,11 @@ sub manage {
     # add new service
     foreach my $sid (sort keys %$sc) {
        next if $ss->{$sid}; # already there
-       $haenv->log('info', "adding new service '$sid' on node '$sc->{$sid}->{node}'");
+       my $cd = $sc->{$sid};
+       $haenv->log('info', "adding new service '$sid' on node '$cd->{node}'");
        # assume we are running to avoid relocate running service at add
-       $ss->{$sid} = { state => 'started', node => $sc->{$sid}->{node},
+       my $state = ($cd->{state} eq 'enabled') ? 'started' : 'request_stop';
+       $ss->{$sid} = { state => $state, node => $cd->{node},
                        uid => compute_new_uuid('started') };
     }
 
index c24b41ef4f992063968ee36089ead9a4e4b7c3d0..0d922407ceacb91069c1125021fc5b299dd9948d 100644 (file)
@@ -16,7 +16,6 @@ info     20    node1/crm: node 'node3': state changed from 'unknown' => 'online'
 info     20    node1/crm: adding new service 'vm:101' on node 'node1'
 info     20    node1/crm: adding new service 'vm:102' on node 'node2'
 info     20    node1/crm: adding new service 'vm:103' on node 'node3'
-info     20    node1/crm: service 'vm:102': state changed from 'started' to 'request_stop'
 info     21    node1/lrm: got lock 'ha_agent_node1_lock'
 info     21    node1/lrm: status change wait_for_agent_lock => active
 info     21    node1/lrm: starting service vm:101
index a7dd644ba0a9de2d327db568f7e4eee5f75514ff..694bef62ef666583407412180a4679de8d59d69d 100644 (file)
@@ -14,7 +14,6 @@ info     20    node1/crm: node 'node1': state changed from 'unknown' => 'online'
 info     20    node1/crm: node 'node2': state changed from 'unknown' => 'online'
 info     20    node1/crm: node 'node3': state changed from 'unknown' => 'online'
 info     20    node1/crm: adding new service 'fa:130' on node 'node2'
-info     20    node1/crm: service 'fa:130': state changed from 'started' to 'request_stop'
 info     22    node2/crm: status change wait_for_quorum => slave
 info     23    node2/lrm: got lock 'ha_agent_node2_lock'
 info     23    node2/lrm: status change wait_for_agent_lock => active
index 038360438fa47051dd06cb1ce80343377aca648f..834284b2f85005d0bfee6f1752d983f0e4b8a0cc 100644 (file)
@@ -11,7 +11,6 @@ info     20    node3/lrm: status change startup => wait_for_agent_lock
 info     20    node1/crm: got lock 'ha_manager_lock'
 info     20    node1/crm: status change wait_for_quorum => master
 info     20    node1/crm: adding new service 'fa:130' on node 'node3'
-info     20    node1/crm: service 'fa:130': state changed from 'started' to 'request_stop'
 info     21    node1/lrm: got lock 'ha_agent_node1_lock'
 info     21    node1/lrm: status change wait_for_agent_lock => active
 info     21    node1/lrm: starting service vm:100
index c5cfffb30b39221ff15bc229f50a968d5629d7d2..62bc5557f328221e208588f098615693a856d7a1 100644 (file)
@@ -14,7 +14,6 @@ info     20    node1/crm: node 'node1': state changed from 'unknown' => 'online'
 info     20    node1/crm: node 'node2': state changed from 'unknown' => 'online'
 info     20    node1/crm: node 'node3': state changed from 'unknown' => 'online'
 info     20    node1/crm: adding new service 'vm:103' on node 'node3'
-info     20    node1/crm: service 'vm:103': state changed from 'started' to 'request_stop'
 info     22    node2/crm: status change wait_for_quorum => slave
 info     24    node3/crm: status change wait_for_quorum => slave
 info     25    node3/lrm: got lock 'ha_agent_node3_lock'
index c3170fc7834abf23179e9ec4e83438f33afee16d..84397786d525ad6578a0b92c20660f8d489f09aa 100644 (file)
@@ -14,7 +14,6 @@ info     20    node1/crm: node 'node1': state changed from 'unknown' => 'online'
 info     20    node1/crm: node 'node2': state changed from 'unknown' => 'online'
 info     20    node1/crm: node 'node3': state changed from 'unknown' => 'online'
 info     20    node1/crm: adding new service 'fa:110' on node 'node2'
-info     20    node1/crm: service 'fa:110': state changed from 'started' to 'request_stop'
 info     22    node2/crm: status change wait_for_quorum => slave
 info     23    node2/lrm: got lock 'ha_agent_node2_lock'
 info     23    node2/lrm: status change wait_for_agent_lock => active
index 278e7aa73ae15616ddb28f89296d8323993a26ec..66ddc04a924768e8ed4e8ee0ce0b156dd23bccc2 100644 (file)
@@ -14,7 +14,6 @@ info     20    node1/crm: node 'node1': state changed from 'unknown' => 'online'
 info     20    node1/crm: node 'node2': state changed from 'unknown' => 'online'
 info     20    node1/crm: node 'node3': state changed from 'unknown' => 'online'
 info     20    node1/crm: adding new service 'fa:130' on node 'node2'
-info     20    node1/crm: service 'fa:130': state changed from 'started' to 'request_stop'
 info     22    node2/crm: status change wait_for_quorum => slave
 info     23    node2/lrm: got lock 'ha_agent_node2_lock'
 info     23    node2/lrm: status change wait_for_agent_lock => active
index 807a2377c141e0929089de97674d79a5ed65052a..43966916295c12492883131ff2f89ff1e26a641d 100644 (file)
@@ -14,7 +14,6 @@ info     20    node1/crm: node 'node1': state changed from 'unknown' => 'online'
 info     20    node1/crm: node 'node2': state changed from 'unknown' => 'online'
 info     20    node1/crm: node 'node3': state changed from 'unknown' => 'online'
 info     20    node1/crm: adding new service 'fa:130' on node 'node2'
-info     20    node1/crm: service 'fa:130': state changed from 'started' to 'request_stop'
 info     22    node2/crm: status change wait_for_quorum => slave
 info     23    node2/lrm: got lock 'ha_agent_node2_lock'
 info     23    node2/lrm: status change wait_for_agent_lock => active
index 05a8bbd737705d7dbdefcf0158b78eee4ff1fcf3..5738b8217a9a745831fb7dadff7fa3bdb52547a4 100644 (file)
@@ -14,7 +14,6 @@ info     20    node1/crm: node 'node1': state changed from 'unknown' => 'online'
 info     20    node1/crm: node 'node2': state changed from 'unknown' => 'online'
 info     20    node1/crm: node 'node3': state changed from 'unknown' => 'online'
 info     20    node1/crm: adding new service 'fa:130' on node 'node2'
-info     20    node1/crm: service 'fa:130': state changed from 'started' to 'request_stop'
 info     22    node2/crm: status change wait_for_quorum => slave
 info     23    node2/lrm: got lock 'ha_agent_node2_lock'
 info     23    node2/lrm: status change wait_for_agent_lock => active