From 635f38b489bf57e5b2c09d6eec2a2e44c045810b Mon Sep 17 00:00:00 2001 From: "Fabio M. Di Nitto" Date: Fri, 29 Mar 2024 10:45:49 +0100 Subject: [PATCH] =?UTF-8?q?anvil-safe-stop:=20don=C2=B4t=20use=20locked=20?= =?UTF-8?q?version=20of=20pcs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add pcs_direct tool path and use it for anvil-safe-stop Closes: #623 Signed-off-by: Fabio M. Di Nitto --- Anvil/Tools.pm | 1 + tools/anvil-safe-stop | 2 +- tools/fence_pacemaker | 9 +++++---- tools/striker-collect-debug | 4 ++-- tools/unfence_pacemaker | 3 ++- 5 files changed, 11 insertions(+), 8 deletions(-) diff --git a/Anvil/Tools.pm b/Anvil/Tools.pm index 2afd49c1..d8031fa3 100644 --- a/Anvil/Tools.pm +++ b/Anvil/Tools.pm @@ -1270,6 +1270,7 @@ sub _set_paths parted => "/usr/sbin/parted", passwd => "/usr/bin/passwd", pcs => "/usr/sbin/anvil-pcs-wrapper", + pcs_direct => "/usr/sbin/pcs", perccli64 => "/opt/MegaRAID/perccli/perccli64", pidof => "/usr/sbin/pidof", ping => "/usr/bin/ping", diff --git a/tools/anvil-safe-stop b/tools/anvil-safe-stop index 6a783ea5..16192448 100755 --- a/tools/anvil-safe-stop +++ b/tools/anvil-safe-stop @@ -239,7 +239,7 @@ sub stop_cluster ### NOTE: '--force' is needed or else sole-running nodes can't exit ### (complains about the loss of quorum) - my $shell_call = $anvil->data->{path}{exe}{pcs}." cluster stop --force"; + my $shell_call = $anvil->data->{path}{exe}{pcs_direct}." cluster stop --force"; $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { shell_call => $shell_call }}); my ($output, $return_code) = $anvil->System->call({shell_call => $shell_call}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { diff --git a/tools/fence_pacemaker b/tools/fence_pacemaker index 9c35bae5..3d5dec60 100755 --- a/tools/fence_pacemaker +++ b/tools/fence_pacemaker @@ -82,7 +82,8 @@ my $conf = { getent => "/usr/bin/getent", hostnamectl => "/usr/bin/hostnamectl", logger => "/usr/bin/logger", - pcs => "/usr/sbin/pcs", + pcs => "/usr/sbin/anvil-pcs-wrapper", + pcs_direct => "/usr/sbin/pcs", }, }, # The script will set this. @@ -192,7 +193,7 @@ sub create_constraint # Make sure there's a rule to apply the node attribute against. my $rule_found = 0; my $rule_name = "drbd-fenced_".$target_server; - my $shell_call = $conf->{path}{exe}{pcs}." constraint location config show ".$target_server; + my $shell_call = $conf->{path}{exe}{pcs_direct}." constraint location config show ".$target_server; to_log($conf, {message => "Calling: [".$shell_call."]", 'line' => __LINE__, level => 1}); open (my $file_handle, $shell_call." 2>&1 |") or die "Failed to call: [".$shell_call."]. The error was: $!\n"; while(<$file_handle>) @@ -353,7 +354,7 @@ sub set_location_constraint } to_log($conf, {message => "Setting the pacemaker location constraint so that: [".$server."] prefers this host.", 'line' => __LINE__, level => 1}); - my $shell_call = $conf->{path}{exe}{pcs}." constraint location ".$server." prefers ".$local_host."=200 ".$peer_host."=100"; + my $shell_call = $conf->{path}{exe}{pcs_direct}." constraint location ".$server." prefers ".$local_host."=200 ".$peer_host."=100"; to_log($conf, {message => "Calling: [".$shell_call."]", 'line' => __LINE__, level => 2}); open (my $file_handle, $shell_call." 2>&1 |") or die "Failed to call: [".$shell_call."]. The error was: $!\n"; while(<$file_handle>) @@ -943,7 +944,7 @@ sub kill_target my ($conf) = @_; # Variables - my $shell_call = $conf->{path}{exe}{pcs}." stonith fence ".$conf->{cluster}{target_node}."; ".$conf->{path}{exe}{echo}." rc:\$?"; + my $shell_call = $conf->{path}{exe}{pcs_direct}." stonith fence ".$conf->{cluster}{target_node}."; ".$conf->{path}{exe}{echo}." rc:\$?"; to_log($conf, {message => "Calling: [".$shell_call."]", 'line' => __LINE__, level => 2}); open (my $file_handle, $shell_call." 2>&1 |") or die "Failed to call: [".$shell_call."]. The error was: $!\n"; while(<$file_handle>) diff --git a/tools/striker-collect-debug b/tools/striker-collect-debug index 1ed40271..d7c31097 100755 --- a/tools/striker-collect-debug +++ b/tools/striker-collect-debug @@ -553,7 +553,7 @@ sub collect_remote_data { ### NOTE: The pcs wrapper was timing out when dumping the CIB, hence statically calling pcs below. print "- Collecting the cluster information base (CIB)... "; - $shell_call = "/usr/sbin/pcs cluster cib > /tmp/cib.xml"; + $shell_call = $anvil->data->{path}{exe}{pcs_direct}." cluster cib > /tmp/cib.xml"; $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { shell_call => $shell_call }}); ($output, $error, $return_code) = $anvil->Remote->call({ @@ -745,7 +745,7 @@ sub collect_local_data if ($this_host_type eq "node") { print "- Collecting the cluster information base (CIB)... "; - $shell_call = $anvil->data->{path}{exe}{pcs}." cluster cib > ".$target_directory."/cib.xml"; + $shell_call = $anvil->data->{path}{exe}{pcs_direct}." cluster cib > ".$target_directory."/cib.xml"; $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { shell_call => $shell_call }}); ($output, $return_code) = $anvil->System->call({shell_call => $shell_call}); diff --git a/tools/unfence_pacemaker b/tools/unfence_pacemaker index 75cae101..036a218e 100755 --- a/tools/unfence_pacemaker +++ b/tools/unfence_pacemaker @@ -49,7 +49,8 @@ my $conf = { echo => "/usr/bin/echo", getent => "/usr/bin/getent", logger => "/usr/bin/logger", - pcs => "/usr/sbin/pcs", + pcs => "/usr/sbin/anvil-pcs-wrapper", + pcs_direct => "/usr/sbin/pcs", }, }, # The script will set this.