Increased logging for debugging issue #339

Signed-off-by: digimer <mkelly@alteeve.ca>
main
digimer 1 year ago
parent 52e7875252
commit fb363b5b6c
  1. 2
      tools/anvil-watch-servers
  2. 16
      tools/fence_pacemaker
  3. 16
      tools/unfence_pacemaker

@ -132,7 +132,7 @@ sub show_status
if ($anvil->data->{switches}{watch}) if ($anvil->data->{switches}{watch})
{ {
my $date = $anvil->Get->date_and_time(); my $date = $anvil->Get->date_and_time();
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 0, key => "message_0382", variables => { date => $date }}); print $anvil->Words->string({key => "message_0382", variables => { date => $date }})."\n";
} }
print $anvil->data->{display}{status}; print $anvil->data->{display}{status};

@ -192,19 +192,19 @@ sub create_constraint
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}." constraint location config show ".$target_server;
to_log($conf, {message => "Calling: [".$shell_call."]", 'line' => __LINE__, level => 2}); 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>)
{ {
# This should not generate output. # This should not generate output.
chomp; chomp;
my $line = $_; my $line = $_;
to_log($conf, {message => "Output: [".$line."]", 'line' => __LINE__, level => 2}); to_log($conf, {message => "Output: [".$line."]", 'line' => __LINE__, level => 1});
if ($line =~ /Expression: $rule_name /) if ($line =~ /Expression: $rule_name /)
{ {
$rule_found = 1; $rule_found = 1;
to_log($conf, {message => "rule_found: [".$rule_found."]", 'line' => __LINE__, level => 2}); to_log($conf, {message => "rule_found: [".$rule_found."]", 'line' => __LINE__, level => 1});
last; last;
} }
} }
@ -220,14 +220,14 @@ sub create_constraint
# Set the node attribute # Set the node attribute
my $rule_set = 0; my $rule_set = 0;
$shell_call = $conf->{path}{exe}{crm_attribute}." --type nodes --node ".$target_node." --name ".$rule_name." --update 1"; $shell_call = $conf->{path}{exe}{crm_attribute}." --type nodes --node ".$target_node." --name ".$rule_name." --update 1";
to_log($conf, {message => "Calling: [".$shell_call."]", 'line' => __LINE__, level => 2}); to_log($conf, {message => "Calling: [".$shell_call."]", 'line' => __LINE__, level => 1});
open ($file_handle, $shell_call." 2>&1 |") or die "Failed to call: [".$shell_call."]. The error was: $!\n"; open ($file_handle, $shell_call." 2>&1 |") or die "Failed to call: [".$shell_call."]. The error was: $!\n";
while(<$file_handle>) while(<$file_handle>)
{ {
# This should not generate output. # This should not generate output.
chomp; chomp;
my $line = $_; my $line = $_;
to_log($conf, {message => "Output: [".$line."]", 'line' => __LINE__, level => 2}); to_log($conf, {message => "Output: [".$line."]", 'line' => __LINE__, level => 1});
} }
close $file_handle; close $file_handle;
@ -235,19 +235,19 @@ sub create_constraint
$rule_set = 0; $rule_set = 0;
my $rule_output = ""; my $rule_output = "";
$shell_call = $conf->{path}{exe}{crm_attribute}." --type nodes --node ".$target_node." --name ".$rule_name." --query"; $shell_call = $conf->{path}{exe}{crm_attribute}." --type nodes --node ".$target_node." --name ".$rule_name." --query";
to_log($conf, {message => "Calling: [".$shell_call."]", 'line' => __LINE__, level => 2}); to_log($conf, {message => "Calling: [".$shell_call."]", 'line' => __LINE__, level => 1});
open ($file_handle, $shell_call." 2>&1 |") or die "Failed to call: [".$shell_call."]. The error was: $!\n"; open ($file_handle, $shell_call." 2>&1 |") or die "Failed to call: [".$shell_call."]. The error was: $!\n";
while(<$file_handle>) while(<$file_handle>)
{ {
# This should not generate output. # This should not generate output.
chomp; chomp;
my $line = $_; my $line = $_;
to_log($conf, {message => "Output: [".$line."]", 'line' => __LINE__, level => 2}); to_log($conf, {message => "Output: [".$line."]", 'line' => __LINE__, level => 1});
if (($line =~ /name=$rule_name/) && ($line =~ /value=1/)) if (($line =~ /name=$rule_name/) && ($line =~ /value=1/))
{ {
$rule_set = 1; $rule_set = 1;
to_log($conf, {message => "rule_set: [".$rule_set."]", 'line' => __LINE__, level => 2}); to_log($conf, {message => "rule_set: [".$rule_set."]", 'line' => __LINE__, level => 1});
last; last;
} }
else else

@ -158,19 +158,19 @@ sub remove_constraint
my $rule_found = 0; my $rule_found = 0;
my $rule_output = ""; my $rule_output = "";
my $shell_call = $conf->{path}{exe}{crm_attribute}." --type nodes --node ".$target_node." --name ".$rule_name." --query"; my $shell_call = $conf->{path}{exe}{crm_attribute}." --type nodes --node ".$target_node." --name ".$rule_name." --query";
to_log($conf, {message => "Calling: [".$shell_call."]", 'line' => __LINE__, level => 2}); 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>)
{ {
# This should not generate output. # This should not generate output.
chomp; chomp;
my $line = $_; my $line = $_;
to_log($conf, {message => "Output: [".$line."]", 'line' => __LINE__, level => 2}); to_log($conf, {message => "Output: [".$line."]", 'line' => __LINE__, level => 1});
if (($line =~ /name=$rule_name/) && ($line =~ /value=0/)) if (($line =~ /name=$rule_name/) && ($line =~ /value=0/))
{ {
$rule_set = 0; $rule_set = 0;
to_log($conf, {message => "rule_set: [".$rule_set."]", 'line' => __LINE__, level => 2}); to_log($conf, {message => "rule_set: [".$rule_set."]", 'line' => __LINE__, level => 1});
last; last;
} }
else else
@ -189,33 +189,33 @@ sub remove_constraint
# Clear the node attribute # Clear the node attribute
$shell_call = $conf->{path}{exe}{crm_attribute}." --type nodes --node ".$target_node." --name ".$rule_name." --update 0"; $shell_call = $conf->{path}{exe}{crm_attribute}." --type nodes --node ".$target_node." --name ".$rule_name." --update 0";
to_log($conf, {message => "Calling: [".$shell_call."]", 'line' => __LINE__, level => 2}); to_log($conf, {message => "Calling: [".$shell_call."]", 'line' => __LINE__, level => 1});
open ($file_handle, $shell_call." 2>&1 |") or die "Failed to call: [".$shell_call."]. The error was: $!\n"; open ($file_handle, $shell_call." 2>&1 |") or die "Failed to call: [".$shell_call."]. The error was: $!\n";
while(<$file_handle>) while(<$file_handle>)
{ {
# This should not generate output. # This should not generate output.
chomp; chomp;
my $line = $_; my $line = $_;
to_log($conf, {message => "Output: [".$line."]", 'line' => __LINE__, level => 3}); to_log($conf, {message => "Output: [".$line."]", 'line' => __LINE__, level => 1});
} }
close $file_handle; close $file_handle;
# Check that the rule was set. # Check that the rule was set.
$rule_output = ""; $rule_output = "";
$shell_call = $conf->{path}{exe}{crm_attribute}." --type nodes --node ".$target_node." --name ".$rule_name." --query"; $shell_call = $conf->{path}{exe}{crm_attribute}." --type nodes --node ".$target_node." --name ".$rule_name." --query";
to_log($conf, {message => "Calling: [".$shell_call."]", 'line' => __LINE__, level => 2}); to_log($conf, {message => "Calling: [".$shell_call."]", 'line' => __LINE__, level => 1});
open ($file_handle, $shell_call." 2>&1 |") or die "Failed to call: [".$shell_call."]. The error was: $!\n"; open ($file_handle, $shell_call." 2>&1 |") or die "Failed to call: [".$shell_call."]. The error was: $!\n";
while(<$file_handle>) while(<$file_handle>)
{ {
# This should not generate output. # This should not generate output.
chomp; chomp;
my $line = $_; my $line = $_;
to_log($conf, {message => "Output: [".$line."]", 'line' => __LINE__, level => 2}); to_log($conf, {message => "Output: [".$line."]", 'line' => __LINE__, level => 1});
if (($line =~ /name=$rule_name/) && ($line =~ /value=0/)) if (($line =~ /name=$rule_name/) && ($line =~ /value=0/))
{ {
$rule_set = 0; $rule_set = 0;
to_log($conf, {message => "rule_set: [".$rule_set."]", 'line' => __LINE__, level => 2}); to_log($conf, {message => "rule_set: [".$rule_set."]", 'line' => __LINE__, level => 1});
last; last;
} }
else else

Loading…
Cancel
Save