Fixed a bug in parsing the fence agent for multi-device fence methods.

* Updated the fence_ipmilan timeouts to 30 seconds to help debug fence
  config failures.

Signed-off-by: digimer <mkelly@alteeve.ca>
main
digimer 7 months ago
parent 25a0454dce
commit f7082c930b
  1. 20
      Anvil/Tools/ScanCore.pm
  2. 18
      Anvil/Tools/System.pm

@ -2528,12 +2528,28 @@ LIMIT 1;";
foreach my $order (sort {$a cmp $b} keys %{$anvil->data->{cib}{parsed}{data}{node}{$node_name}{fencing}{order}}) foreach my $order (sort {$a cmp $b} keys %{$anvil->data->{cib}{parsed}{data}{node}{$node_name}{fencing}{order}})
{ {
my $method = $anvil->data->{cib}{parsed}{data}{node}{$node_name}{fencing}{order}{$order}{devices}; my $method = $anvil->data->{cib}{parsed}{data}{node}{$node_name}{fencing}{order}{$order}{devices};
my $agent = $anvil->data->{cib}{parsed}{data}{stonith}{primitive_id}{$method}{agent};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
's1:order' => $order, 's1:order' => $order,
's2:method' => $method, 's2:method' => $method,
's3:agent' => $agent
}}); }});
my $agent = $anvil->data->{cib}{parsed}{data}{stonith}{primitive_id}{$method}{agent};
if ((not defined $agent) && ($method =~ /,/))
{
# Break up the method name to find the agent.
$agent = "";
foreach my $sub_method (split/,/, $method)
{
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { sub_method => $sub_method }});
if ((exists $anvil->data->{cib}{parsed}{data}{stonith}{primitive_id}{$sub_method}) &&
(defined $anvil->data->{cib}{parsed}{data}{stonith}{primitive_id}{$sub_method}{agent}))
{
$agent = $anvil->data->{cib}{parsed}{data}{stonith}{primitive_id}{$sub_method}{agent};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { agent => $agent }});
last;
}
}
}
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { agent => $agent }});
# We can't trust a PDU's output, so skip them. We also can't use the fake 'fence_delay' agent. # We can't trust a PDU's output, so skip them. We also can't use the fake 'fence_delay' agent.
next if $agent =~ /pdu/; next if $agent =~ /pdu/;

@ -2302,7 +2302,9 @@ LIMIT 1
# use, but we'll scan 1..9 + 0. # use, but we'll scan 1..9 + 0.
foreach my $i (1..9, 0) foreach my $i (1..9, 0)
{ {
my ($output, $return_code) = $anvil->System->call({debug => $debug, shell_call => $anvil->data->{path}{exe}{ipmitool}." lan print ".$i}); my $shell_call = $anvil->data->{path}{exe}{ipmitool}." lan print ".$i;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { shell_call => $shell_call }});
my ($output, $return_code) = $anvil->System->call({debug => $debug, shell_call => $shell_call});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
output => $output, output => $output,
return_code => $return_code, return_code => $return_code,
@ -2483,7 +2485,10 @@ LIMIT 1
while ($waiting) while ($waiting)
{ {
my $debug = 2; my $debug = 2;
my ($output, $return_code) = $anvil->System->call({debug => $debug, shell_call => $anvil->data->{path}{exe}{ipmitool}." user list ".$lan_channel}); my $shell_call = $anvil->data->{path}{exe}{ipmitool}." user list ".$lan_channel;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { shell_call => $shell_call }});
my ($output, $return_code) = $anvil->System->call({debug => $debug, shell_call => $shell_call});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
output => $output, output => $output,
return_code => $return_code, return_code => $return_code,
@ -4990,17 +4995,18 @@ sub test_ipmi
# Build the shell call. # Build the shell call.
$shell_call = $anvil->data->{path}{directories}{fence_agents}."/fence_ipmilan ".$lanplus_switch." --ip ".$ipmi_target." --username ".$ipmi_user." --password \"".$test_password."\" --action status"; $shell_call = $anvil->data->{path}{directories}{fence_agents}."/fence_ipmilan ".$lanplus_switch." --ip ".$ipmi_target." --username ".$ipmi_user." --password \"".$test_password."\" --action status";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, secure => 1, list => { shell_call => $shell_call }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, secure => 1, list => { shell_call => $shell_call }});
# HPs can take over 10 seconds to respond.
my $timeout = 30;
my $output = ""; my $output = "";
my $return_code = ""; my $return_code = "";
if ($target) if ($target)
{ {
### Remote call ### Remote call
# HPs can take over 10 seconds to respond, so we set the timeout higher to account for this.
($output, my $error, $return_code) = $anvil->Remote->call({ ($output, my $error, $return_code) = $anvil->Remote->call({
debug => $debug, debug => $debug,
secure => 1, secure => 1,
timeout => 20, timeout => $timeout,
shell_call => $shell_call, shell_call => $shell_call,
target => $target, target => $target,
password => $password, password => $password,
@ -5017,7 +5023,7 @@ sub test_ipmi
($output, $return_code) = $anvil->System->call({ ($output, $return_code) = $anvil->System->call({
debug => $debug, debug => $debug,
secure => 1, secure => 1,
timeout => 2, timeout => $timeout,
shell_call => $shell_call, shell_call => $shell_call,
}); });
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {

Loading…
Cancel
Save