From 02de75a6ab762449c180cb519bafe926a990363e Mon Sep 17 00:00:00 2001 From: digimer Date: Mon, 14 Aug 2023 12:58:00 -0400 Subject: [PATCH 1/3] * Improved log messaging to not log of a potential boot failure when the local DRBD volume(s) are all UpToDate and the peer is offline. Signed-off-by: digimer --- ocf/alteeve/server | 25 ++++++++++++++++++++++++- share/words.xml | 1 + 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/ocf/alteeve/server b/ocf/alteeve/server index 3a816df8..c8ef3978 100755 --- a/ocf/alteeve/server +++ b/ocf/alteeve/server @@ -933,7 +933,30 @@ sub start_drbd_resource else { # No access - $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 0, priority => "alert", key => "warning_0136", variables => { host => $host }}); + 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 }}); + } } } } diff --git a/share/words.xml b/share/words.xml index 7502f2d8..13db2924 100644 --- a/share/words.xml +++ b/share/words.xml @@ -2413,6 +2413,7 @@ The file: [#!variable!file!#] needs to be updated. The difference is: A cached request to reboot this host was found (likely from a --no-db update). Registering a job to reboot now! Adjusting the resource: [#!variable!resource!#] to ensure it's compatible with the peer's config prior to connection. The local resource: [#!variable!resource!#] is StandAlone, attempting to connect. + 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. The host name: [#!variable!target!#] does not resolve to an IP address. From f23768ac32f84c5e3a96a3be376a730d6ba7bf76 Mon Sep 17 00:00:00 2001 From: digimer Date: Thu, 17 Aug 2023 18:54:22 -0400 Subject: [PATCH 2/3] * Updated Striker->generate_manifest() to remove integral DR support and add migration-network support. This helps address issue #440. Signed-off-by: digimer --- Anvil/Tools/Striker.pm | 52 ++++++++++++++++++++++++++++-------------- 1 file changed, 35 insertions(+), 17 deletions(-) diff --git a/Anvil/Tools/Striker.pm b/Anvil/Tools/Striker.pm index a6cef8c1..a61a0216 100644 --- a/Anvil/Tools/Striker.pm +++ b/Anvil/Tools/Striker.pm @@ -309,38 +309,55 @@ sub generate_manifest my $parameter = shift; my $anvil = $self->parent; my $debug = $parameter->{debug} // 3; + $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => $debug, key => "log_0125", variables => { method => "Striker->generate_manifest()" }}); - my $domain = $parameter->{domain} // $anvil->data->{cgi}{domain}{value}; + my $network_dns = $parameter->{dns} // $anvil->data->{cgi}{dns}{value}; + my $domain = $parameter->{domain} // $anvil->data->{cgi}{domain}{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_ntp = $parameter->{ntp} // $anvil->data->{cgi}{ntp}{value}; - my $padded_sequence = $parameter->{sequence} // $anvil->data->{cgi}{sequence}{value}; - - $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => $debug, key => "log_0125", variables => { method => "Striker->generate_manifest()" }}); + my $network_mtu = $parameter->{mtu} // $anvil->data->{cgi}{mtu}{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}; + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { + 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_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) { $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 $node1_name = $name_prefix."-a".$padded_sequence."n01"; my $node2_name = $name_prefix."-a".$padded_sequence."n02"; - my $dr1_name = $name_prefix."-a".$padded_sequence."dr01"; 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 = ' '; - foreach my $network ("bcn", "sn", "ifn") + foreach my $network ("bcn", "ifn", "sn", "mn") { my $count_key = $network."_count"; my $count_value = $parameter->{$count_key} // $anvil->data->{cgi}{$count_key}{value}; @@ -358,7 +375,7 @@ sub generate_manifest $manifest_xml .= ' '."\n"; # 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 my $ip_key = $machine."_".$network_name."_ip"; @@ -422,9 +439,10 @@ sub generate_manifest # Now record the info about the machines. foreach my $machine (sort {$a cmp $b} keys %{$machines}) { - my $host_name = $node1_name; - if ($machine eq "node2") { $host_name = $node2_name; } - elsif ($machine eq "dr1") { $host_name = $dr1_name; } + my $host_name = ""; + if ($machine eq "node1") { $host_name = $node1_name; } + if ($machine eq "node2") { $host_name = $node2_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}.'"> '; From d255adc7b447d44e4f5058973e6bf4208e780e45 Mon Sep 17 00:00:00 2001 From: digimer Date: Thu, 17 Aug 2023 22:14:40 -0400 Subject: [PATCH 3/3] * Updated anvil-daemon to set the mode of /mnt/shared/* to 0777 during creation and to check that that mode is set for existing sub-directories. This resolves issue #443. * Cleaned up anvil-manage-dr.8 hyphen escapes. Signed-off-by: digimer --- Anvil/Tools/Storage.pm | 2 +- man/anvil-manage-dr.8 | 6 +++--- tools/anvil-daemon | 23 ++++++++++++++++++++--- 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/Anvil/Tools/Storage.pm b/Anvil/Tools/Storage.pm index 1815f95e..69ee4fa0 100644 --- a/Anvil/Tools/Storage.pm +++ b/Anvil/Tools/Storage.pm @@ -416,7 +416,7 @@ sub change_mode 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 }}); if ($anvil->Network->is_local({host => $target})) { diff --git a/man/anvil-manage-dr.8 b/man/anvil-manage-dr.8 index 089da1d0..e45a4b9b 100644 --- a/man/anvil-manage-dr.8 +++ b/man/anvil-manage-dr.8 @@ -14,7 +14,7 @@ This tool is used to manage the protection of servers on DR hosts. \-?, \-h, \fB\-\-help\fR Show this man page. .TP -\fB\-\-log-secure\fR +\fB\-\-log\-secure\fR When logging, record sensitive data, like passwords. .TP \-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 Disconnect a server from the DR image. This will end streaming replication. .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. .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. .TP \fB\-\-link\fR diff --git a/tools/anvil-daemon b/tools/anvil-daemon index 4ea2df9c..f8527cf8 100755 --- a/tools/anvil-daemon +++ b/tools/anvil-daemon @@ -1896,17 +1896,34 @@ sub check_files foreach my $target (sort {$a cmp $b} keys %{$anvil->data->{path}{directories}{shared}}) { 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, 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({ directory => $directory, group => "apache", user => "apache", - mode => "0775", + mode => "0777", }); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { failed => $failed }}); if ($failed)