Merge pull request #430 from ClusterLabs/beta-fixes

* Improved log messaging to not log of a potential boot failure when …
main
Digimer 1 year ago committed by GitHub
commit 5e95b2e8b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      Anvil/Tools/Storage.pm
  2. 40
      Anvil/Tools/Striker.pm
  3. 6
      man/anvil-manage-dr.8
  4. 23
      ocf/alteeve/server
  5. 1
      share/words.xml
  6. 23
      tools/anvil-daemon

@ -416,7 +416,7 @@ sub change_mode
return('!!error!!'); return('!!error!!');
} }
my $shell_call = $anvil->data->{path}{exe}{'chmod'}." $mode $path"; my $shell_call = $anvil->data->{path}{exe}{'chmod'}." ".$mode." ".$path;
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => $debug, key => "log_0011", variables => { shell_call => $shell_call }}); $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => $debug, key => "log_0011", variables => { shell_call => $shell_call }});
if ($anvil->Network->is_local({host => $target})) if ($anvil->Network->is_local({host => $target}))
{ {

@ -309,38 +309,55 @@ sub generate_manifest
my $parameter = shift; my $parameter = shift;
my $anvil = $self->parent; my $anvil = $self->parent;
my $debug = $parameter->{debug} // 3; my $debug = $parameter->{debug} // 3;
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => $debug, key => "log_0125", variables => { method => "Striker->generate_manifest()" }});
my $network_dns = $parameter->{dns} // $anvil->data->{cgi}{dns}{value};
my $domain = $parameter->{domain} // $anvil->data->{cgi}{domain}{value}; my $domain = $parameter->{domain} // $anvil->data->{cgi}{domain}{value};
my $manifest_uuid = $parameter->{manifest_uuid} // $anvil->data->{cgi}{manifest_uuid}{value}; my $manifest_uuid = $parameter->{manifest_uuid} // $anvil->data->{cgi}{manifest_uuid}{value};
my $name_prefix = $parameter->{prefix} // $anvil->data->{cgi}{prefix}{value};
my $network_dns = $parameter->{dns} // $anvil->data->{cgi}{dns}{value};
my $network_mtu = $parameter->{mtu} // $anvil->data->{cgi}{mtu}{value}; my $network_mtu = $parameter->{mtu} // $anvil->data->{cgi}{mtu}{value};
my $network_ntp = $parameter->{ntp} // $anvil->data->{cgi}{ntp}{value}; my $network_ntp = $parameter->{ntp} // $anvil->data->{cgi}{ntp}{value};
my $name_prefix = $parameter->{prefix} // $anvil->data->{cgi}{prefix}{value};
my $padded_sequence = $parameter->{sequence} // $anvil->data->{cgi}{sequence}{value}; my $padded_sequence = $parameter->{sequence} // $anvil->data->{cgi}{sequence}{value};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => $debug, key => "log_0125", variables => { method => "Striker->generate_manifest()" }}); network_dns => $network_dns,
domain => $domain,
manifest_uuid => $manifest_uuid,
network_mtu => $network_mtu,
network_ntp => $network_ntp,
name_prefix => $name_prefix,
padded_sequence => $padded_sequence,
}});
$anvil->Database->get_upses({debug => $debug}); $anvil->Database->get_upses({debug => $debug});
$anvil->Database->get_fences({debug => $debug}); $anvil->Database->get_fences({debug => $debug});
$manifest_uuid = $manifest_uuid eq "new" ? "" : $manifest_uuid; if ($manifest_uuid eq "new")
{
$manifest_uuid = "";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { manifest_uuid => $manifest_uuid }});
}
if (length($padded_sequence) == 1) if (length($padded_sequence) == 1)
{ {
$padded_sequence = sprintf("%02d", $padded_sequence); $padded_sequence = sprintf("%02d", $padded_sequence);
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { padded_sequence => $padded_sequence }});
} }
my $anvil_name = $name_prefix."-anvil-".$padded_sequence; my $anvil_name = $name_prefix."-anvil-".$padded_sequence;
my $node1_name = $name_prefix."-a".$padded_sequence."n01"; my $node1_name = $name_prefix."-a".$padded_sequence."n01";
my $node2_name = $name_prefix."-a".$padded_sequence."n02"; my $node2_name = $name_prefix."-a".$padded_sequence."n02";
my $dr1_name = $name_prefix."-a".$padded_sequence."dr01";
my $machines = {}; my $machines = {};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { anvil_name => $anvil_name }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
anvil_name => $anvil_name,
node1_name => $node1_name,
node2_name => $node2_name,
}});
my $manifest_xml = '<?xml version="1.0" encoding="UTF-8"?> my $manifest_xml = '<?xml version="1.0" encoding="UTF-8"?>
<install_manifest name="'.$anvil_name.'" domain="'.$domain.'"> <install_manifest name="'.$anvil_name.'" domain="'.$domain.'">
<networks mtu="'.$network_mtu.'" dns="'.$network_dns.'" ntp="'.$network_ntp.'"> <networks mtu="'.$network_mtu.'" dns="'.$network_dns.'" ntp="'.$network_ntp.'">
'; ';
foreach my $network ("bcn", "sn", "ifn") foreach my $network ("bcn", "ifn", "sn", "mn")
{ {
my $count_key = $network."_count"; my $count_key = $network."_count";
my $count_value = $parameter->{$count_key} // $anvil->data->{cgi}{$count_key}{value}; my $count_value = $parameter->{$count_key} // $anvil->data->{cgi}{$count_key}{value};
@ -358,7 +375,7 @@ sub generate_manifest
$manifest_xml .= ' <network name="'.$network_name.'" network="'.$network_value.'" subnet="'.$subnet_value.'" gateway="'.$gateway_value.'" />'."\n"; $manifest_xml .= ' <network name="'.$network_name.'" network="'.$network_value.'" subnet="'.$subnet_value.'" gateway="'.$gateway_value.'" />'."\n";
# While we're here, gather the network data for the machines. # While we're here, gather the network data for the machines.
foreach my $machine ("node1", "node2", "dr1") foreach my $machine ("node1", "node2")
{ {
# Record the network # Record the network
my $ip_key = $machine."_".$network_name."_ip"; my $ip_key = $machine."_".$network_name."_ip";
@ -422,9 +439,10 @@ sub generate_manifest
# Now record the info about the machines. # Now record the info about the machines.
foreach my $machine (sort {$a cmp $b} keys %{$machines}) foreach my $machine (sort {$a cmp $b} keys %{$machines})
{ {
my $host_name = $node1_name; my $host_name = "";
if ($machine eq "node1") { $host_name = $node1_name; }
if ($machine eq "node2") { $host_name = $node2_name; } if ($machine eq "node2") { $host_name = $node2_name; }
elsif ($machine eq "dr1") { $host_name = $dr1_name; } $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { host_name => $host_name }});
$manifest_xml .= ' <'.$machine.' name="'.$host_name.'" ipmi_ip="'.$machines->{$machine}{ipmi_ip}.'"> $manifest_xml .= ' <'.$machine.' name="'.$host_name.'" ipmi_ip="'.$machines->{$machine}{ipmi_ip}.'">
<networks> <networks>
'; ';

@ -14,7 +14,7 @@ This tool is used to manage the protection of servers on DR hosts.
\-?, \-h, \fB\-\-help\fR \-?, \-h, \fB\-\-help\fR
Show this man page. Show this man page.
.TP .TP
\fB\-\-log-secure\fR \fB\-\-log\-secure\fR
When logging, record sensitive data, like passwords. When logging, record sensitive data, like passwords.
.TP .TP
\-v, \-vv, \-vvv \-v, \-vv, \-vvv
@ -27,10 +27,10 @@ Connect a server already on DR to it's DR copy, update the data there if needed
\fB\-\-disconnect\fR \fB\-\-disconnect\fR
Disconnect a server from the DR image. This will end streaming replication. Disconnect a server from the DR image. This will end streaming replication.
.TP .TP
\fB\-\-dr-host\fR \fB\-\-dr\-host\fR
This is the host name or host UUID for the DR to use. It is optional if only one DR host is connected to this Anvil! node, but required if two or more are defined. This is the host name or host UUID for the DR to use. It is optional if only one DR host is connected to this Anvil! node, but required if two or more are defined.
.TP .TP
\fB\-\-license-file\fR \fB\-\-license\-file\fR
This is the path to the license file, needed when setting up "long-throw" DR for the first time. This is the path to the license file, needed when setting up "long-throw" DR for the first time.
.TP .TP
\fB\-\-link\fR \fB\-\-link\fR

@ -933,11 +933,34 @@ sub start_drbd_resource
else else
{ {
# No access # No access
my $all_uptodate = 1;
foreach my $volume (sort {$a <=> $b} %{$anvil->data->{drbd}{status}{$local_host}{resource}{$resource}{connection}{$host}{volume}})
{
my $peer_disk_state = $anvil->data->{drbd}{status}{$local_host}{resource}{$resource}{connection}{$host}{volume}{$volume}{'peer-disk-state'};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
volume => $volume,
peer_disk_state => $peer_disk_state,
}});
if (lc($peer_disk_state) ne "uptodate")
{
$all_uptodate = 0;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { all_uptodate => $all_uptodate }});
}
}
if ($all_uptodate)
{
# Booting should be fine
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "log_0747", variables => { host => $host }});
}
else
{
# Booting might fail...
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 0, priority => "alert", key => "warning_0136", variables => { host => $host }}); $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 0, priority => "alert", key => "warning_0136", variables => { host => $host }});
} }
} }
} }
} }
}
# Loop until all our resources are Connected or UpToDate # Loop until all our resources are Connected or UpToDate
my $waiting = 1; my $waiting = 1;

@ -2413,6 +2413,7 @@ The file: [#!variable!file!#] needs to be updated. The difference is:
<key name="log_0744">A cached request to reboot this host was found (likely from a --no-db update). Registering a job to reboot now!</key> <key name="log_0744">A cached request to reboot this host was found (likely from a --no-db update). Registering a job to reboot now!</key>
<key name="log_0745">Adjusting the resource: [#!variable!resource!#] to ensure it's compatible with the peer's config prior to connection.</key> <key name="log_0745">Adjusting the resource: [#!variable!resource!#] to ensure it's compatible with the peer's config prior to connection.</key>
<key name="log_0746">The local resource: [#!variable!resource!#] is StandAlone, attempting to connect.</key> <key name="log_0746">The local resource: [#!variable!resource!#] is StandAlone, attempting to connect.</key>
<key name="log_0747">Failed to connect to the host: [#!variable!host!#]! Unable to up the resource on it. The volume(s) backing this server are UpToDate locally, so booting should be fine.</key>
<!-- Messages for users (less technical than log entries), though sometimes used for logs, too. --> <!-- Messages for users (less technical than log entries), though sometimes used for logs, too. -->
<key name="message_0001">The host name: [#!variable!target!#] does not resolve to an IP address.</key> <key name="message_0001">The host name: [#!variable!target!#] does not resolve to an IP address.</key>

@ -1896,17 +1896,34 @@ sub check_files
foreach my $target (sort {$a cmp $b} keys %{$anvil->data->{path}{directories}{shared}}) foreach my $target (sort {$a cmp $b} keys %{$anvil->data->{path}{directories}{shared}})
{ {
my $directory = $anvil->data->{path}{directories}{shared}{$target}; my $directory = $anvil->data->{path}{directories}{shared}{$target};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
target => $target, target => $target,
directory => $directory, directory => $directory,
}}); }});
if (not -e $anvil->data->{path}{directories}{shared}{$target}) if (-e $directory)
{
# Make sure the permissions are correct.
$anvil->Storage->get_file_stats({file_path => $directory});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
"file_stat::${directory}::unix_mode" => $anvil->data->{file_stat}{$directory}{unix_mode},
}});
if ($anvil->data->{file_stat}{$directory}{unix_mode} !~ /0777$/)
{
$anvil->Storage->change_mode({
debug => 2,
path => $directory,
mode => "0777"
});
}
}
elsif (not -e $anvil->data->{path}{directories}{shared}{$target})
{ {
my $failed = $anvil->Storage->make_directory({ my $failed = $anvil->Storage->make_directory({
directory => $directory, directory => $directory,
group => "apache", group => "apache",
user => "apache", user => "apache",
mode => "0775", mode => "0777",
}); });
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { failed => $failed }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { failed => $failed }});
if ($failed) if ($failed)

Loading…
Cancel
Save