[pve-devel] [PATCH ha-manager] is_node_shutdown: check for correct systemd targets

Thomas Lamprecht t.lamprecht at proxmox.com
Fri Dec 16 17:19:02 CET 2016


shutdown.target runs everytime when the node shutsdown, on reboot,
poweroff, halt, kexec.
As we want to return only false if we reboot but otherwise true this
was wrong.

Match only poweroff.target and halt.target, those two systemd targets
which cause a node shutdown without a reboot.

Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---
 src/PVE/HA/Env/PVE2.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/PVE/HA/Env/PVE2.pm b/src/PVE/HA/Env/PVE2.pm
index 4fdab2f..236745d 100644
--- a/src/PVE/HA/Env/PVE2.pm
+++ b/src/PVE/HA/Env/PVE2.pm
@@ -89,7 +89,7 @@ sub is_node_shutdown {
     my $code = sub {
 	my $line = shift;
 
-	$shutdown = 1 if ($line =~ m/shutdown\.target/);
+	$shutdown = 1 if ($line =~ m/(poweroff|halt)\.target/);
     };
 
     my $cmd = ['/bin/systemctl', 'list-jobs'];
-- 
2.1.4





More information about the pve-devel mailing list