* Updated logging in DRBD->get_devices().

* Added a check and exit if anvil-manage-dr is asked to protect a server on a machine that doesn't know about that server.

Signed-off-by: digimer <mkelly@alteeve.ca>
main
digimer 2 years ago
parent dce4aa58c1
commit 7773e5f9b8
  1. 6
      Anvil/Tools/DRBD.pm
  2. 6
      Anvil/Tools/Server.pm
  3. 1
      share/words.xml
  4. 12
      tools/anvil-manage-dr

@ -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},

@ -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}))
{

@ -2859,6 +2859,7 @@ Proceed? [y/N]</key>
Proceed? [y/N]</key>
<key name="message_0306">This is a test alert message sent at alert level: [#!variable!level!#].</key>
<key name="message_0307">Failed to send a test alert at level: [#!variable!level!#]. Is anyone listening at that level? Is the mail server configured?</key>
<key name="message_0308">The DRBD config file was not found. A protect job needs to be run from the Anvil! node hosting the server to be protected.</key>
<!-- Translate names (protocols, etc) -->
<key name="name_0001">Normal Password</key> <!-- none in mail-server -->

@ -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 = <STDIN>;

Loading…
Cancel
Save