diff --git a/Anvil/Tools/DRBD.pm b/Anvil/Tools/DRBD.pm index 457abf43..76dc739f 100644 --- a/Anvil/Tools/DRBD.pm +++ b/Anvil/Tools/DRBD.pm @@ -1492,7 +1492,7 @@ LIMIT 1 my $value = $option_ref->{value}; $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { variable => $variable, - value => $variable, + value => $value, }}); if ($variable eq "auto-promote") { @@ -1581,10 +1581,14 @@ LIMIT 1 if (($anvil->data->{drbd}{config}{$host}{host}) && ($anvil->data->{drbd}{config}{$host}{host} eq $this_host)) { + $anvil->data->{drbd}{config}{$host}{by_res}{$by_res}{on} = $lv_path; + $anvil->data->{drbd}{config}{$host}{by_res}{$by_res}{resource} = $this_resource; $anvil->data->{drbd}{config}{$host}{drbd_path}{$drbd_path}{on} = $lv_path; $anvil->data->{drbd}{config}{$host}{drbd_path}{$drbd_path}{resource} = $this_resource; $anvil->data->{drbd}{config}{$host}{lv_path}{$lv_path}{under} = $drbd_path; $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { + "drbd::config::${host}::by_res::${by_res}::on" => $anvil->data->{drbd}{config}{$host}{by_res}{$by_res}{on}, + "drbd::config::${host}::by_res::${by_res}::resource" => $anvil->data->{drbd}{config}{$host}{by_res}{$by_res}{resource}, "drbd::config::${host}::drbd_path::${drbd_path}::on" => $anvil->data->{drbd}{config}{$host}{drbd_path}{$drbd_path}{on}, "drbd::config::${host}::drbd_path::${drbd_path}::resource" => $anvil->data->{drbd}{config}{$host}{drbd_path}{$drbd_path}{resource}, "drbd::config::${host}::lv_path::${lv_path}::under" => $anvil->data->{drbd}{config}{$host}{lv_path}{$lv_path}{under}, diff --git a/Anvil/Tools/Server.pm b/Anvil/Tools/Server.pm index 76bfec78..d3b169a7 100644 --- a/Anvil/Tools/Server.pm +++ b/Anvil/Tools/Server.pm @@ -1832,8 +1832,10 @@ sub parse_definition my $on_lv = defined $anvil->data->{drbd}{config}{$host}{drbd_path}{$device_path}{on} ? $anvil->data->{drbd}{config}{$host}{drbd_path}{$device_path}{on} : ""; my $resource = defined $anvil->data->{drbd}{config}{$host}{drbd_path}{$device_path}{resource} ? $anvil->data->{drbd}{config}{$host}{drbd_path}{$device_path}{resource} : ""; $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { - on_lv => $on_lv, - resource => $resource, + 's1:host' => $host, + 's2:device_path' => $device_path, + 's3:on_lv' => $on_lv, + 's4:resource' => $resource, }}); if ((not $resource) && ($anvil->data->{drbd}{config}{$host}{'by-res'}{$device_path}{resource})) { diff --git a/share/words.xml b/share/words.xml index 2341622f..baddc0d7 100644 --- a/share/words.xml +++ b/share/words.xml @@ -2859,6 +2859,7 @@ Proceed? [y/N] Proceed? [y/N] This is a test alert message sent at alert level: [#!variable!level!#]. Failed to send a test alert at level: [#!variable!level!#]. Is anyone listening at that level? Is the mail server configured? + The DRBD config file was not found. A protect job needs to be run from the Anvil! node hosting the server to be protected. Normal Password diff --git a/tools/anvil-manage-dr b/tools/anvil-manage-dr index 5fe20a2f..5ee9e41d 100755 --- a/tools/anvil-manage-dr +++ b/tools/anvil-manage-dr @@ -2174,7 +2174,7 @@ sub process_protect }); $anvil->DRBD->gather_data({debug => 2}); - + my $server_ram = $anvil->data->{server}{$short_host_name}{$server_name}{'from_db'}{memory}; $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { server_ram => $anvil->Convert->add_commas({number => $server_ram})." (".$anvil->Convert->bytes_to_human_readable({'bytes' => $server_ram}).")", @@ -2182,6 +2182,7 @@ sub process_protect foreach my $resource (sort {$a cmp $b} keys %{$anvil->data->{server}{$short_host_name}{$server_name}{drbd}{resource}}) { + next if $resource eq ""; $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { resource => $resource }}); foreach my $this_host_name (sort {$a cmp $b} keys %{$anvil->data->{new}{resource}{$resource}{host}}) @@ -2559,6 +2560,15 @@ sub process_protect my $record_job = 0; if (not $anvil->data->{switches}{Yes}) { + # If there's no config file, this might be being run from DR which doesn't have info about + # the resource yet. + if ((not $config_file) && (not $anvil->data->{switches}{'job-uuid'})) + { + # Bail out. + print $anvil->Words->string({key => "message_0308"})."\n"; + $anvil->nice_exit({exit_code => 1}); + } + # Ask the user to confirm. print "\n".$anvil->Words->string({key => "message_0021"})."\n"; my $answer = ;