[pve-devel] [RFC v3 pve-ha-manager 4/8] rename is_poweroff to is_node_shutdown

Dietmar Maurer dietmar at proxmox.com
Wed Dec 16 09:04:46 CET 2015


Signed-off-by: Dietmar Maurer <dietmar at proxmox.com>
---
 src/PVE/HA/Env.pm         | 7 ++++---
 src/PVE/HA/Env/PVE2.pm    | 9 ++++-----
 src/PVE/HA/LRM.pm         | 2 +-
 src/PVE/HA/Sim/Env.pm     | 2 +-
 src/PVE/HA/Sim/TestEnv.pm | 2 +-
 5 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/src/PVE/HA/Env.pm b/src/PVE/HA/Env.pm
index 1e29f05..fe31893 100644
--- a/src/PVE/HA/Env.pm
+++ b/src/PVE/HA/Env.pm
@@ -54,11 +54,12 @@ sub write_lrm_status {
     return $self->{plug}->write_lrm_status($status_obj);
 }
 
-# check if we do a poweroff, can be used to decide if services should be freeze
-sub is_poweroff {
+# check if we do node shutdown
+# we used this to decide if services should be stopped or freezed
+sub is_node_shutdown {
     my ($self) = @_;
 
-    return $self->{plug}->is_poweroff();
+    return $self->{plug}->is_node_shutdown();
 }
 
 # implement a way to send commands to the CRM master
diff --git a/src/PVE/HA/Env/PVE2.pm b/src/PVE/HA/Env/PVE2.pm
index 707615e..cbf15fc 100644
--- a/src/PVE/HA/Env/PVE2.pm
+++ b/src/PVE/HA/Env/PVE2.pm
@@ -67,22 +67,21 @@ sub write_lrm_status {
     PVE::HA::Config::write_lrm_status($node, $status_obj);
 }
 
-# check if we do a poweroff, can be used to decide if services should be freezed
-sub is_poweroff {
+sub is_node_shutdown {
     my ($self) = @_;
 
-    my $poweroff;
+    my $shutdown = 0;
 
     my $code = sub {
 	my $line = shift;
 
-	$poweroff = 1 if ($line =~ m/poweroff\.target/);
+	$shutdown = 1 if ($line =~ m/shutdown\.target/);
     };
 
     my $cmd = ['/bin/systemctl', 'list-jobs'];
     eval { PVE::Tools::run_command($cmd, outfunc => $code, noerr => 1); };
 
-    return $poweroff;
+    return $shutdown;
 }
 
 sub queue_crm_commands {
diff --git a/src/PVE/HA/LRM.pm b/src/PVE/HA/LRM.pm
index f428465..43b7b33 100644
--- a/src/PVE/HA/LRM.pm
+++ b/src/PVE/HA/LRM.pm
@@ -45,7 +45,7 @@ sub shutdown_request {
 
     my $haenv = $self->{haenv};
 
-    my $shutdown = $haenv->is_poweroff();
+    my $shutdown = $haenv->is_node_shutdown();
 
     if ($shutdown) {
 	$haenv->log('info', "shutdown LRM, stop all services");
diff --git a/src/PVE/HA/Sim/Env.pm b/src/PVE/HA/Sim/Env.pm
index 1656442..0d99ba0 100644
--- a/src/PVE/HA/Sim/Env.pm
+++ b/src/PVE/HA/Sim/Env.pm
@@ -139,7 +139,7 @@ sub write_lrm_status {
     return $self->{hardware}->write_lrm_status($node, $status_obj);
 }
 
-sub is_poweroff {
+sub is_node_shutdown {
     my ($self) = @_;
 
     return 0; # default to freezing services if not overwritten by subclass
diff --git a/src/PVE/HA/Sim/TestEnv.pm b/src/PVE/HA/Sim/TestEnv.pm
index fa0178c..8e47db0 100644
--- a/src/PVE/HA/Sim/TestEnv.pm
+++ b/src/PVE/HA/Sim/TestEnv.pm
@@ -115,7 +115,7 @@ sub can_fork {
     return 0;
 }
 
-sub is_poweroff {
+sub is_node_shutdown {
     my ($self) = @_;
 
     my $node = $self->{nodename};
-- 
2.1.4




More information about the pve-devel mailing list