Altered nmcli sleeps and bumped logging to debug DB connection issue.

Signed-off-by: Madison Kelly <mkelly@alteeve.com>
main
Madison Kelly 6 months ago
parent 6a0c9f27df
commit 420445d875
  1. 5
      Anvil/Tools/Database.pm
  2. 4
      share/words.xml
  3. 30
      tools/anvil-configure-host

@ -19561,7 +19561,10 @@ sub write
if ($problem) if ($problem)
{ {
# We can't use this DB. # We can't use this DB.
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, priority => "warn", key => "warning_0182", variables => { uuid => $uuid }}); $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, priority => "warn", key => "warning_0182", variables => {
uuid => $uuid,
query => (not $secure) ? $query : $anvil->Log->is_secure($query),
}});
next; next;
} }
} }

@ -1991,7 +1991,7 @@ The database connection error was:
<key name="log_0189">Database archiving is disabled, skipping archive checks.</key> <key name="log_0189">Database archiving is disabled, skipping archive checks.</key>
<key name="log_0190">Peer: [#!variable!peer!#], database: [#!variable!name!#], password: [#!variable!password!#], host UUID: [#!variable!uuid!#]</key> <key name="log_0190">Peer: [#!variable!peer!#], database: [#!variable!name!#], password: [#!variable!password!#], host UUID: [#!variable!uuid!#]</key>
<key name="log_0191">Connection only to: [#!variable!db_uuid!#], skipping: [#!variable!uuid!#].</key> <key name="log_0191">Connection only to: [#!variable!db_uuid!#], skipping: [#!variable!uuid!#].</key>
<key name="log_0192">The connection to the database: [#!variable!server!#] has failed. Will attempt to reconnect to databases-.</key> <key name="log_0192">The connection to the database: [#!variable!server!#] has failed. Will attempt to reconnect to the database(s).</key>
<key name="log_0193">Switching the default database handle to use the database: [#!variable!server!#] prior to reconnect attempt.</key> <key name="log_0193">Switching the default database handle to use the database: [#!variable!server!#] prior to reconnect attempt.</key>
<key name="log_0194">Switching the default database to read from to the database: [#!variable!server!#] prior to reconnect attempt.</key> <key name="log_0194">Switching the default database to read from to the database: [#!variable!server!#] prior to reconnect attempt.</key>
<key name="log_0195">Ready to try to reconnect to: [#!variable!server!#], but delaying for: [#!variable!delay!#] seconds to give the database a chance to come back online in case this is a transient issue.</key> <key name="log_0195">Ready to try to reconnect to: [#!variable!server!#], but delaying for: [#!variable!delay!#] seconds to give the database a chance to come back online in case this is a transient issue.</key>
@ -4209,7 +4209,7 @@ We will try to proceed anyway.</key>
<key name="warning_0179">[ Warning ] - The connection to the database: [#!variable!server!#] was not restored, unable to this database.</key> <key name="warning_0179">[ Warning ] - The connection to the database: [#!variable!server!#] was not restored, unable to this database.</key>
<key name="warning_0180">[ Warning ] - We were asked to read from the database: [#!variable!server!#], but it is not or is no longer available.</key> <key name="warning_0180">[ Warning ] - We were asked to read from the database: [#!variable!server!#], but it is not or is no longer available.</key>
<key name="warning_0181">[ Warning ] - We were asked to read from the database: [#!variable!server!#], but it is no longer available, and no alternative databases are available.</key> <key name="warning_0181">[ Warning ] - We were asked to read from the database: [#!variable!server!#], but it is no longer available, and no alternative databases are available.</key>
<key name="warning_0182">[ Warning ] - We appear to have lost access to the database: [#!variable!uuid!#], during a write. Skipping this database.</key> <key name="warning_0182">[ Warning ] - We appear to have lost access to the database: [#!variable!uuid!#], during the write: [#!variable!query!#]. Skipping this database.</key>
<key name="warning_0183">[ Warning ] - We were asked to thoroughly check if this host is configured or not, but there are no records in the 'variables' table for this host. Unable to check the network config! Relying on the 'system::configured' value.</key> <key name="warning_0183">[ Warning ] - We were asked to thoroughly check if this host is configured or not, but there are no records in the 'variables' table for this host. Unable to check the network config! Relying on the 'system::configured' value.</key>
<key name="warning_0184">[ Warning ] - We were asked to thoroughly check if this host is configured or not, and the interface: [#!variable!interface!#] doesn't exist! Marking this host as unconfigured!</key> <key name="warning_0184">[ Warning ] - We were asked to thoroughly check if this host is configured or not, and the interface: [#!variable!interface!#] doesn't exist! Marking this host as unconfigured!</key>

@ -561,7 +561,7 @@ ORDER BY
{ {
$anvil->System->stop_daemon({debug => 2, daemon => "NetworkManager.service"}); $anvil->System->stop_daemon({debug => 2, daemon => "NetworkManager.service"});
$anvil->System->start_daemon({debug => 2, daemon => "NetworkManager.service"}); $anvil->System->start_daemon({debug => 2, daemon => "NetworkManager.service"});
sleep 5; sleep 2;
} }
# Reconnect! # Reconnect!
@ -612,7 +612,7 @@ ORDER BY
} }
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, 'print' => 1, key => "log_0829", variables => { time_left => $time_left }}); $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, 'print' => 1, key => "log_0829", variables => { time_left => $time_left }});
sleep 5; sleep 2;
} }
else else
{ {
@ -1248,7 +1248,7 @@ sub reconfigure_bonds
# NM seems to have a race issue, so we sleep a second after nmcli calls. # NM seems to have a race issue, so we sleep a second after nmcli calls.
$anvil->data->{sys}{restart_nm} = 1; $anvil->data->{sys}{restart_nm} = 1;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { 'sys::restart_nm' => $anvil->data->{sys}{restart_nm} }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { 'sys::restart_nm' => $anvil->data->{sys}{restart_nm} }});
sleep 5; sleep 2;
if ($bond_uuid) if ($bond_uuid)
{ {
@ -1280,7 +1280,7 @@ sub reconfigure_bonds
# NM seems to have a race issue, so we sleep a second after nmcli calls. # NM seems to have a race issue, so we sleep a second after nmcli calls.
$anvil->data->{sys}{restart_nm} = 1; $anvil->data->{sys}{restart_nm} = 1;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { 'sys::restart_nm' => $anvil->data->{sys}{restart_nm} }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { 'sys::restart_nm' => $anvil->data->{sys}{restart_nm} }});
sleep 5; sleep 2;
} }
# Done! Rescanning the network config # Done! Rescanning the network config
@ -1418,7 +1418,7 @@ sub reconfigure_bonds
# NM seems to have a race issue, so we sleep a second after nmcli calls. # NM seems to have a race issue, so we sleep a second after nmcli calls.
$anvil->data->{sys}{restart_nm} = 1; $anvil->data->{sys}{restart_nm} = 1;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { 'sys::restart_nm' => $anvil->data->{sys}{restart_nm} }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { 'sys::restart_nm' => $anvil->data->{sys}{restart_nm} }});
sleep 5; sleep 2;
if ($return_code) if ($return_code)
{ {
@ -1505,7 +1505,7 @@ sub wait_for_nm
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { waiting => $waiting }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { waiting => $waiting }});
} }
# Not found yet. # Not found yet.
sleep 1; sleep 2;
} }
else else
{ {
@ -1851,7 +1851,7 @@ sub reconfigure_ip_addresses
# NM seems to have a race issue, so we sleep a second after nmcli calls. # NM seems to have a race issue, so we sleep a second after nmcli calls.
$anvil->data->{sys}{restart_nm} = 1; $anvil->data->{sys}{restart_nm} = 1;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { 'sys::restart_nm' => $anvil->data->{sys}{restart_nm} }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { 'sys::restart_nm' => $anvil->data->{sys}{restart_nm} }});
sleep 5; sleep 2;
} }
# Now assign the IP. # Now assign the IP.
@ -1878,7 +1878,7 @@ sub reconfigure_ip_addresses
# NM seems to have a race issue, so we sleep a second after nmcli calls. # NM seems to have a race issue, so we sleep a second after nmcli calls.
$anvil->data->{sys}{restart_nm} = 1; $anvil->data->{sys}{restart_nm} = 1;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { 'sys::restart_nm' => $anvil->data->{sys}{restart_nm} }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { 'sys::restart_nm' => $anvil->data->{sys}{restart_nm} }});
sleep 5; sleep 2;
# Restart the interface # Restart the interface
$anvil->Job->update_progress({ $anvil->Job->update_progress({
@ -1922,7 +1922,7 @@ sub reconfigure_interfaces
# network manager device to the ip addr name or the biosdevname. # network manager device to the ip addr name or the biosdevname.
foreach my $uuid (sort {$a cmp $b} keys %{$anvil->data->{nmcli}{uuid}}) foreach my $uuid (sort {$a cmp $b} keys %{$anvil->data->{nmcli}{uuid}})
{ {
### TODO: Left off here... any devices that are down, set: ### TODO: Any devices that are down, set:
### nmcli connection modify <uuid> ipv4.method manual ipv4.addresses 169.0.0.x/8' (x == Wired connection x) ### nmcli connection modify <uuid> ipv4.method manual ipv4.addresses 169.0.0.x/8' (x == Wired connection x)
my $connection_id = $anvil->data->{nmcli}{uuid}{$uuid}{'connection.id'} // ""; my $connection_id = $anvil->data->{nmcli}{uuid}{$uuid}{'connection.id'} // "";
my $general_ip_iface = $anvil->data->{nmcli}{uuid}{$uuid}{'GENERAL.IP-IFACE'} // ""; my $general_ip_iface = $anvil->data->{nmcli}{uuid}{$uuid}{'GENERAL.IP-IFACE'} // "";
@ -1960,7 +1960,7 @@ sub reconfigure_interfaces
return_code => $return_code, return_code => $return_code,
}}); }});
# NM seems to have a race issue, so we sleep a second after nmcli calls. # NM seems to have a race issue, so we sleep a second after nmcli calls.
sleep 1; sleep 2;
# Rescan. # Rescan.
$anvil->Job->update_progress({ $anvil->Job->update_progress({
@ -2119,7 +2119,7 @@ sub reconfigure_interfaces
if ($link2_nm_uuid) if ($link2_nm_uuid)
{ {
my $found = 0; my $found = 0;
my $match_interface_name = $anvil->data->{nmcli}{uuid}{$link2_nm_uuid}{'match.interface-name'} // ""; my $match_interface_name = $anvil->data->{nmcli}{uuid}{$link2_nm_uuid}{'match.interface-name'} ? $anvil->data->{nmcli}{uuid}{$link2_nm_uuid}{'match.interface-name'} : "";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { match_interface_name => $match_interface_name }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { match_interface_name => $match_interface_name }});
foreach my $interface (split/,/, $match_interface_name) foreach my $interface (split/,/, $match_interface_name)
{ {
@ -2351,7 +2351,7 @@ sub rename_interface
return_code => $return_code, return_code => $return_code,
}}); }});
# NM seems to have a race issue, so we sleep a second after nmcli calls. # NM seems to have a race issue, so we sleep a second after nmcli calls.
sleep 1; sleep 2;
$shell_call = $anvil->data->{path}{exe}{nmcli}." --get-values connection.interface-name connection show ".$nm_uuid; $shell_call = $anvil->data->{path}{exe}{nmcli}." --get-values connection.interface-name connection show ".$nm_uuid;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { shell_call => $shell_call }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { shell_call => $shell_call }});
@ -2424,7 +2424,7 @@ sub rename_interface
return_code => $return_code, return_code => $return_code,
}}); }});
# NM seems to have a race issue, so we sleep a second after nmcli calls. # NM seems to have a race issue, so we sleep a second after nmcli calls.
sleep 1; sleep 2;
# Read it back # Read it back
$shell_call = $anvil->data->{path}{exe}{nmcli}." --get-values match.interface-name connection show ".$nm_uuid; $shell_call = $anvil->data->{path}{exe}{nmcli}." --get-values match.interface-name connection show ".$nm_uuid;
@ -2475,7 +2475,7 @@ sub rename_interface
return_code => $return_code, return_code => $return_code,
}}); }});
# NM seems to have a race issue, so we sleep a second after nmcli calls. # NM seems to have a race issue, so we sleep a second after nmcli calls.
sleep 1; sleep 2;
# Read it back # Read it back
$shell_call = $anvil->data->{path}{exe}{nmcli}." --get-values connection.id connection show ".$nm_uuid; $shell_call = $anvil->data->{path}{exe}{nmcli}." --get-values connection.id connection show ".$nm_uuid;
@ -2674,7 +2674,7 @@ AND
my ($out_of_cluster) = $anvil->Cluster->parse_cib(); my ($out_of_cluster) = $anvil->Cluster->parse_cib();
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
out_of_cluster => $out_of_cluster, out_of_cluster => $out_of_cluster,
"cib::parsed::local::ready" => $anvil->data->{cib}{parsed}{'local'}{ready}, "cib::parsed::local::ready" => defined $anvil->data->{cib}{parsed}{'local'}{ready} ? $anvil->data->{cib}{parsed}{'local'}{ready} : "",
}}); }});
if ((not $out_of_cluster) && ($anvil->data->{cib}{parsed}{'local'}{ready})) if ((not $out_of_cluster) && ($anvil->data->{cib}{parsed}{'local'}{ready}))
{ {

Loading…
Cancel
Save