anvil-safe-stop: don´t use locked version of pcs

Add pcs_direct tool path and use it for anvil-safe-stop

Closes: #623

Signed-off-by: Fabio M. Di Nitto <fabbione@fabbione.net>
main
Fabio M. Di Nitto 9 months ago
parent 73a687acb5
commit 635f38b489
  1. 1
      Anvil/Tools.pm
  2. 2
      tools/anvil-safe-stop
  3. 9
      tools/fence_pacemaker
  4. 4
      tools/striker-collect-debug
  5. 3
      tools/unfence_pacemaker

@ -1270,6 +1270,7 @@ sub _set_paths
parted => "/usr/sbin/parted", parted => "/usr/sbin/parted",
passwd => "/usr/bin/passwd", passwd => "/usr/bin/passwd",
pcs => "/usr/sbin/anvil-pcs-wrapper", pcs => "/usr/sbin/anvil-pcs-wrapper",
pcs_direct => "/usr/sbin/pcs",
perccli64 => "/opt/MegaRAID/perccli/perccli64", perccli64 => "/opt/MegaRAID/perccli/perccli64",
pidof => "/usr/sbin/pidof", pidof => "/usr/sbin/pidof",
ping => "/usr/bin/ping", ping => "/usr/bin/ping",

@ -239,7 +239,7 @@ sub stop_cluster
### NOTE: '--force' is needed or else sole-running nodes can't exit ### NOTE: '--force' is needed or else sole-running nodes can't exit
### (complains about the loss of quorum) ### (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 }}); $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}); my ($output, $return_code) = $anvil->System->call({shell_call => $shell_call});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {

@ -82,7 +82,8 @@ my $conf = {
getent => "/usr/bin/getent", getent => "/usr/bin/getent",
hostnamectl => "/usr/bin/hostnamectl", hostnamectl => "/usr/bin/hostnamectl",
logger => "/usr/bin/logger", logger => "/usr/bin/logger",
pcs => "/usr/sbin/pcs", pcs => "/usr/sbin/anvil-pcs-wrapper",
pcs_direct => "/usr/sbin/pcs",
}, },
}, },
# The script will set this. # The script will set this.
@ -192,7 +193,7 @@ sub create_constraint
# Make sure there's a rule to apply the node attribute against. # Make sure there's a rule to apply the node attribute against.
my $rule_found = 0; my $rule_found = 0;
my $rule_name = "drbd-fenced_".$target_server; 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}); 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"; open (my $file_handle, $shell_call." 2>&1 |") or die "Failed to call: [".$shell_call."]. The error was: $!\n";
while(<$file_handle>) 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}); 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}); 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"; open (my $file_handle, $shell_call." 2>&1 |") or die "Failed to call: [".$shell_call."]. The error was: $!\n";
while(<$file_handle>) while(<$file_handle>)
@ -943,7 +944,7 @@ sub kill_target
my ($conf) = @_; my ($conf) = @_;
# Variables # 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}); 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"; open (my $file_handle, $shell_call." 2>&1 |") or die "Failed to call: [".$shell_call."]. The error was: $!\n";
while(<$file_handle>) while(<$file_handle>)

@ -553,7 +553,7 @@ sub collect_remote_data
{ {
### NOTE: The pcs wrapper was timing out when dumping the CIB, hence statically calling pcs below. ### NOTE: The pcs wrapper was timing out when dumping the CIB, hence statically calling pcs below.
print "- Collecting the cluster information base (CIB)... "; 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 }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { shell_call => $shell_call }});
($output, $error, $return_code) = $anvil->Remote->call({ ($output, $error, $return_code) = $anvil->Remote->call({
@ -745,7 +745,7 @@ sub collect_local_data
if ($this_host_type eq "node") if ($this_host_type eq "node")
{ {
print "- Collecting the cluster information base (CIB)... "; 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 }}); $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}); ($output, $return_code) = $anvil->System->call({shell_call => $shell_call});

@ -49,7 +49,8 @@ my $conf = {
echo => "/usr/bin/echo", echo => "/usr/bin/echo",
getent => "/usr/bin/getent", getent => "/usr/bin/getent",
logger => "/usr/bin/logger", logger => "/usr/bin/logger",
pcs => "/usr/sbin/pcs", pcs => "/usr/sbin/anvil-pcs-wrapper",
pcs_direct => "/usr/sbin/pcs",
}, },
}, },
# The script will set this. # The script will set this.

Loading…
Cancel
Save