[pve-devel] [PATCH ha-manager v3 3/4] skip transition to 'started' state if we won't stay in it
Thomas Lamprecht
t.lamprecht at proxmox.com
Tue Nov 15 12:11:22 CET 2016
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 at proxmox.com>
---
src/PVE/HA/Manager.pm | 6 ++++--
src/test/test-basic1/log.expect | 1 -
src/test/test-relocate-policy-default-group/log.expect | 1 -
src/test/test-relocate-policy1/log.expect | 1 -
src/test/test-relocate-to-inactive-node/log.expect | 1 -
src/test/test-resource-failure1/log.expect | 1 -
src/test/test-resource-failure2/log.expect | 1 -
src/test/test-resource-failure5/log.expect | 1 -
src/test/test-resource-failure6/log.expect | 1 -
9 files changed, 4 insertions(+), 10 deletions(-)
diff --git a/src/PVE/HA/Manager.pm b/src/PVE/HA/Manager.pm
index c2fa2c3..9d333fb 100644
--- a/src/PVE/HA/Manager.pm
+++ b/src/PVE/HA/Manager.pm
@@ -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') };
}
diff --git a/src/test/test-basic1/log.expect b/src/test/test-basic1/log.expect
index c24b41e..0d92240 100644
--- a/src/test/test-basic1/log.expect
+++ b/src/test/test-basic1/log.expect
@@ -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
diff --git a/src/test/test-relocate-policy-default-group/log.expect b/src/test/test-relocate-policy-default-group/log.expect
index a7dd644..694bef6 100644
--- a/src/test/test-relocate-policy-default-group/log.expect
+++ b/src/test/test-relocate-policy-default-group/log.expect
@@ -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
diff --git a/src/test/test-relocate-policy1/log.expect b/src/test/test-relocate-policy1/log.expect
index 0383604..834284b 100644
--- a/src/test/test-relocate-policy1/log.expect
+++ b/src/test/test-relocate-policy1/log.expect
@@ -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
diff --git a/src/test/test-relocate-to-inactive-node/log.expect b/src/test/test-relocate-to-inactive-node/log.expect
index c5cfffb..62bc555 100644
--- a/src/test/test-relocate-to-inactive-node/log.expect
+++ b/src/test/test-relocate-to-inactive-node/log.expect
@@ -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'
diff --git a/src/test/test-resource-failure1/log.expect b/src/test/test-resource-failure1/log.expect
index c3170fc..8439778 100644
--- a/src/test/test-resource-failure1/log.expect
+++ b/src/test/test-resource-failure1/log.expect
@@ -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
diff --git a/src/test/test-resource-failure2/log.expect b/src/test/test-resource-failure2/log.expect
index 278e7aa..66ddc04 100644
--- a/src/test/test-resource-failure2/log.expect
+++ b/src/test/test-resource-failure2/log.expect
@@ -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
diff --git a/src/test/test-resource-failure5/log.expect b/src/test/test-resource-failure5/log.expect
index 807a237..4396691 100644
--- a/src/test/test-resource-failure5/log.expect
+++ b/src/test/test-resource-failure5/log.expect
@@ -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
diff --git a/src/test/test-resource-failure6/log.expect b/src/test/test-resource-failure6/log.expect
index 05a8bbd..5738b82 100644
--- a/src/test/test-resource-failure6/log.expect
+++ b/src/test/test-resource-failure6/log.expect
@@ -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
--
2.1.4
More information about the pve-devel
mailing list