[pve-devel] [PATCH ha-manager v2 3/3] lrm: explicitly log shutdown_policy on node shutdown

Thomas Lamprecht t.lamprecht at proxmox.com
Thu Dec 20 08:44:43 CET 2018


Makes regression test a bit more telling and it helps to be verbose
for an user here too.

Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---

changes v1 -> v2:
* code wise none, but the test log output was adapted to new policy values:
  s/default/conditional/

 src/PVE/HA/LRM.pm                         | 4 ++++
 src/test/test-reboot1/log.expect          | 1 +
 src/test/test-shutdown-policy1/log.expect | 1 +
 src/test/test-shutdown-policy2/log.expect | 1 +
 src/test/test-shutdown1/log.expect        | 1 +
 src/test/test-shutdown2/log.expect        | 1 +
 src/test/test-shutdown3/log.expect        | 1 +
 src/test/test-shutdown4/log.expect        | 1 +
 8 files changed, 11 insertions(+)

diff --git a/src/PVE/HA/LRM.pm b/src/PVE/HA/LRM.pm
index 55e4b50..5ae96ce 100644
--- a/src/PVE/HA/LRM.pm
+++ b/src/PVE/HA/LRM.pm
@@ -56,6 +56,10 @@ sub shutdown_request {
     my $dc_ha_cfg = $haenv->get_ha_settings();
     my $shutdown_policy = $dc_ha_cfg->{shutdown_policy} // 'conditional';
 
+    if ($shutdown) { # don't log this on service restart, only on node shutdown
+	$haenv->log('info', "got shutdown request with shutdown policy '$shutdown_policy'");
+    }
+
     my $freeze_all = $reboot;
     if ($shutdown_policy eq 'conditional') {
 	$freeze_all = $reboot;
diff --git a/src/test/test-reboot1/log.expect b/src/test/test-reboot1/log.expect
index 0199941..d99a752 100644
--- a/src/test/test-reboot1/log.expect
+++ b/src/test/test-reboot1/log.expect
@@ -21,6 +21,7 @@ info     25    node3/lrm: status change wait_for_agent_lock => active
 info     25    node3/lrm: starting service vm:103
 info     25    node3/lrm: service status vm:103 started
 info    120      cmdlist: execute reboot node3
+info    120    node3/lrm: got shutdown request with shutdown policy 'conditional'
 info    120    node3/lrm: reboot LRM, stop and freeze all services
 info    120    node1/crm: service 'vm:103': state changed from 'started' to 'freeze'
 info    125    node3/lrm: stopping service vm:103
diff --git a/src/test/test-shutdown-policy1/log.expect b/src/test/test-shutdown-policy1/log.expect
index 385b07a..b80799d 100644
--- a/src/test/test-shutdown-policy1/log.expect
+++ b/src/test/test-shutdown-policy1/log.expect
@@ -21,6 +21,7 @@ info     25    node3/lrm: status change wait_for_agent_lock => active
 info     25    node3/lrm: starting service vm:103
 info     25    node3/lrm: service status vm:103 started
 info    120      cmdlist: execute reboot node3
+info    120    node3/lrm: got shutdown request with shutdown policy 'failover'
 info    120    node3/lrm: shutdown LRM, stop all services
 info    125    node3/lrm: stopping service vm:103
 info    125    node3/lrm: service status vm:103 stopped
diff --git a/src/test/test-shutdown-policy2/log.expect b/src/test/test-shutdown-policy2/log.expect
index a36c628..6e8c172 100644
--- a/src/test/test-shutdown-policy2/log.expect
+++ b/src/test/test-shutdown-policy2/log.expect
@@ -21,6 +21,7 @@ info     25    node3/lrm: status change wait_for_agent_lock => active
 info     25    node3/lrm: starting service vm:103
 info     25    node3/lrm: service status vm:103 started
 info    120      cmdlist: execute shutdown node3
+info    120    node3/lrm: got shutdown request with shutdown policy 'freeze'
 info    120    node3/lrm: shutdown LRM, stop and freeze all services
 info    120    node1/crm: service 'vm:103': state changed from 'started' to 'freeze'
 info    125    node3/lrm: stopping service vm:103
diff --git a/src/test/test-shutdown1/log.expect b/src/test/test-shutdown1/log.expect
index da7a24b..9d7203a 100644
--- a/src/test/test-shutdown1/log.expect
+++ b/src/test/test-shutdown1/log.expect
@@ -21,6 +21,7 @@ info     25    node3/lrm: status change wait_for_agent_lock => active
 info     25    node3/lrm: starting service vm:103
 info     25    node3/lrm: service status vm:103 started
 info    120      cmdlist: execute shutdown node3
+info    120    node3/lrm: got shutdown request with shutdown policy 'conditional'
 info    120    node3/lrm: shutdown LRM, stop all services
 info    125    node3/lrm: stopping service vm:103
 info    125    node3/lrm: service status vm:103 stopped
diff --git a/src/test/test-shutdown2/log.expect b/src/test/test-shutdown2/log.expect
index 4994aa9..423b36f 100644
--- a/src/test/test-shutdown2/log.expect
+++ b/src/test/test-shutdown2/log.expect
@@ -21,6 +21,7 @@ info     25    node3/lrm: status change wait_for_agent_lock => active
 info     25    node3/lrm: starting service vm:103
 info     25    node3/lrm: service status vm:103 started
 info    120      cmdlist: execute shutdown node3
+info    120    node3/lrm: got shutdown request with shutdown policy 'conditional'
 info    120    node3/lrm: shutdown LRM, stop all services
 info    125    node3/lrm: stopping service vm:103
 info    125    node3/lrm: service status vm:103 stopped
diff --git a/src/test/test-shutdown3/log.expect b/src/test/test-shutdown3/log.expect
index c85bcd6..94ecfe1 100644
--- a/src/test/test-shutdown3/log.expect
+++ b/src/test/test-shutdown3/log.expect
@@ -21,6 +21,7 @@ info     25    node3/lrm: status change wait_for_agent_lock => active
 info     25    node3/lrm: starting service ct:103
 info     25    node3/lrm: service status ct:103 started
 info    120      cmdlist: execute shutdown node3
+info    120    node3/lrm: got shutdown request with shutdown policy 'conditional'
 info    120    node3/lrm: shutdown LRM, stop all services
 info    125    node3/lrm: stopping service ct:103
 info    125    node3/lrm: service status ct:103 stopped
diff --git a/src/test/test-shutdown4/log.expect b/src/test/test-shutdown4/log.expect
index 6155401..7496def 100644
--- a/src/test/test-shutdown4/log.expect
+++ b/src/test/test-shutdown4/log.expect
@@ -21,6 +21,7 @@ info     21    node1/lrm: service status vm:100 started
 info     22    node2/crm: status change wait_for_quorum => slave
 info     24    node3/crm: status change wait_for_quorum => slave
 info    120      cmdlist: execute shutdown node1
+info    120    node1/lrm: got shutdown request with shutdown policy 'conditional'
 info    120    node1/lrm: shutdown LRM, stop all services
 info    121    node1/lrm: stopping service vm:100
 info    121    node1/lrm: service status vm:100 stopped
-- 
2.19.2





More information about the pve-devel mailing list