Merge pull request #330 from ClusterLabs/anvil-tools-dev

* Fixes issue #329; When multiple attributes exist when checking if w…
main
Digimer 2 years ago committed by GitHub
commit 91de6bb30e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      ocf/alteeve/server
  2. 6
      tools/anvil-version-changes
  3. 41
      tools/fence_pacemaker

@ -908,10 +908,16 @@ sub start_drbd_resource
{
# This is set to '1' if either the volumes are UpToDate or Sync'ing.
$anvil->data->{drbd}{status}{$local_host}{resource}{$resource}{ok} = 0;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
"drbd::status::${local_host}::resource::${resource}::ok" => $anvil->data->{drbd}{status}{$local_host}{resource}{$resource}{ok},
}});
foreach my $volume (sort {$a cmp $b} keys %{$anvil->data->{drbd}{status}{$local_host}{resource}{$resource}{devices}{volume}})
{
# This will be used to mark if a volume is being sync'ed later, if needed.
$anvil->data->{drbd}{status}{$local_host}{resource}{$resource}{devices}{volume}{$volume}{ok} = 0;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
"drbd::status::${local_host}::resource::${resource}::devices::volume::${volume}::ok" => $anvil->data->{drbd}{status}{$local_host}{resource}{$resource}{devices}{volume}{$volume}{ok},
}});
my $disk_state = lc($anvil->data->{drbd}{status}{$local_host}{resource}{$resource}{devices}{volume}{$volume}{'disk-state'});
$disk_state = "" if not defined $disk_state;

@ -62,6 +62,9 @@ $anvil->nice_exit({exit_code => 0});
sub striker_checks
{
my ($anvil) = @_;
# This checks to make sure that the new 'file_locations' -> 'file_location_ready' column exists.
update_file_location_ready($anvil);
# This replaces anvil_uuid with host_uuid to support more granular location info to support the new
# multi-target DR system
@ -81,9 +84,6 @@ sub striker_checks
# entries are copied.
update_dr_links($anvil);
# This checks to make sure that the new 'file_locations' -> 'file_location_ready' column exists.
update_file_location_ready($anvil);
### TODO: Remove these later. This is here to clean up how we used to handle db_in_use and lock_request flags.
if (1)
{

@ -481,15 +481,36 @@ sub identify_peer
# This is me. Am I in maintenance mode?
if (exists $hash_ref->{instance_attributes})
{
# We've got some data...
my $name = defined $hash_ref->{instance_attributes}{nvpair}{name} ? $hash_ref->{instance_attributes}{nvpair}{name} : "";
my $value = defined $hash_ref->{instance_attributes}{nvpair}{value} ? $hash_ref->{instance_attributes}{nvpair}{value} : "";
to_log($conf, {message => "node: [".$node."] instance attribyte name: [".$name."], value: [".$value."]", 'line' => __LINE__, level => 1});
if (($name eq "maintenance") and ($value eq "on"))
next if not exists $hash_ref->{instance_attributes}{nvpair};
my $reference = ref($hash_ref->{instance_attributes}{nvpair});
to_log($conf, {message => "Instance attribute reference type: [".$reference."]", 'line' => __LINE__, level => 3});
if ($reference eq "ARRAY")
{
# We're in maintenance mode, abort.
to_log($conf, {message => "This node is in maintenance mode. Not able to fence!", 'line' => __LINE__, level => 0, priority => "err"});
exit(1);
foreach my $array_ref (@{$hash_ref->{instance_attributes}{nvpair}})
{
my $id = $array_ref->{id};
my $name = $array_ref->{name};
my $value = $array_ref->{value};
to_log($conf, {message => "Instance attribute ID: [".$id."], name: [".$name."], value: [".$value."]", 'line' => __LINE__, level => 3});
if (($name eq "maintenance") and ($value eq "on"))
{
# We're in maintenance mode, abort.
to_log($conf, {message => "This node is in maintenance mode. Not able to fence!", 'line' => __LINE__, level => 0, priority => "err"});
exit(1);
}
}
}
elsif ($reference eq "HASH")
{
my $name = defined $hash_ref->{instance_attributes}{nvpair}{name} ? $hash_ref->{instance_attributes}{nvpair}{name} : "";
my $value = defined $hash_ref->{instance_attributes}{nvpair}{value} ? $hash_ref->{instance_attributes}{nvpair}{value} : "";
to_log($conf, {message => "node: [".$node."] instance attribyte name: [".$name."], value: [".$value."]", 'line' => __LINE__, level => 1});
if (($name eq "maintenance") and ($value eq "on"))
{
# We're in maintenance mode, abort.
to_log($conf, {message => "This node is in maintenance mode. Not able to fence!", 'line' => __LINE__, level => 0, priority => "err"});
exit(1);
}
}
}
}
@ -627,7 +648,7 @@ sub find_executables
my @dirs = split/:/, $ENV{PATH};
foreach my $exe (sort {$b cmp $a} keys %{$conf->{path}{exe}})
{
if ( not -e $conf->{path}{exe}{$exe} )
if (not -e $conf->{path}{exe}{$exe})
{
to_log($conf, {message => "The program: [".$exe."] is not at: [".$conf->{path}{exe}{$exe}."]. Looking for it now...", 'line' => __LINE__, level => 1});
foreach my $path (@dirs)
@ -655,7 +676,7 @@ sub find_executables
}
else
{
to_log($conf, {message => "Found!", 'line' => __LINE__, level => 3});
to_log($conf, {message => "Found: [".$exe."] at: [".$conf->{path}{exe}{$exe}."]!", 'line' => __LINE__, level => 3});
next;
}

Loading…
Cancel
Save