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

Thomas Lamprecht t.lamprecht at proxmox.com
Wed Dec 19 11:39:41 CET 2018


Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---
 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 fc560fa..040a76e 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} // 'default';
 
+    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 'default') {
 	$freeze_all = $reboot;
diff --git a/src/test/test-reboot1/log.expect b/src/test/test-reboot1/log.expect
index 0199941..ec26d39 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 'default'
 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..0a4b593 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 'default'
 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..bdf7a30 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 'default'
 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..9d5705b 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 'default'
 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..2dafe62 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 'default'
 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