Updated anvil-join-anvil to hold if either node is still running anvil-configure-host

* Fixed a minor bug and added logging of maintenance_mode calls in anvil-configure-host.

Signed-off-by: digimer <mkelly@alteeve.ca>
main
digimer 1 year ago
parent e480337239
commit fcbace6713
  1. 2
      share/words.xml
  2. 6
      tools/anvil-configure-host
  3. 2
      tools/anvil-daemon
  4. 33
      tools/anvil-join-anvil

@ -1686,7 +1686,7 @@ Note: This is a permanent action! If you protect this server again later, a full
<key name="job_0472">Server Storage Management</key>
<key name="job_0473">This job manages the storage on a given hosted server. It can grow an existing disk, add a new disk, insert an ISO into an optical disc, or eject a disc.</key>
<key name="job_0474">The server: [#!variable!server!#] will now be forced off!</key>
<key name="job_0475">The subnode: [#!variable!subnode!#] is not ready. Configured: [#!variable!configured!#], maintenance mode: [#!variable!maintenance_mode!#].</key>
<key name="job_0475">The subnode: [#!variable!subnode!#] is not ready. Configured: [#!variable!configured!#], maintenance mode: [#!variable!maintenance_mode!#], job_running: [#!variable!job_running!#].</key>
<key name="job_0476">Waiting for a bit, then will check again.</key>
<key name="job_0477">Waiting for both subnodes to be configured and out of maintenance mode.</key>

@ -64,7 +64,7 @@ pickup_job_details($anvil);
overwrite_variables_with_switches($anvil);
# Set maintenance mode
$anvil->System->maintenance_mode({set => 1});
$anvil->System->maintenance_mode({set => 1, debug => 2});
reconfigure_network($anvil);
@ -88,7 +88,7 @@ $anvil->Job->update_progress({
});
# Clear maintenance mode.
$anvil->System->maintenance_mode({set => 0});
$anvil->System->maintenance_mode({set => 0, debug => 2});
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 2, 'print' => 1, key => "log_0467"});
### TODO: As of now, the network doesn't come up reliably, so reboot. We add a 60 second delay to make it
@ -435,7 +435,7 @@ ORDER BY
}});
# An undefined interface will have the MAC address value set to '1', ignore those.
next if $variable_value == 1;
next if $variable_value eq "1";
if ($variable_name =~ /form::config_step2::(.*?)_mac_to_set::value/)
{

@ -577,7 +577,7 @@ sub handle_periodic_tasks
check_db_in_use_states($anvil);
# Do Striker-specific minute tasks
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 1, list => { host_type => $host_type }});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { host_type => $host_type }});
if ($host_type eq "striker")
{
# This can take a while, but it's been optimized to minimize how long it takes to

@ -2409,7 +2409,7 @@ sub wait_for_subnodes
my $ready = 1;
foreach my $host_uuid ($node1_host_uuid, $node2_host_uuid)
{
my $host_name = $anvil->data->{hosts}{host_uuid}{$node2_host_uuid}{host_name};
my $host_name = $anvil->data->{hosts}{host_uuid}{$host_uuid}{host_name};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
host_uuid => $host_uuid,
host_name => $host_name,
@ -2420,6 +2420,7 @@ sub wait_for_subnodes
variable_source_table => "hosts",
variable_source_uuid => $host_uuid,
});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { maintenance_mode => $maintenance_mode }});
(my $configured, $variable_uuid, $modified_date) = $anvil->Database->read_variable({
variable_name => "system::configured",
variable_source_uuid => $host_uuid,
@ -2427,12 +2428,31 @@ sub wait_for_subnodes
});
$maintenance_mode = 1 if not defined $maintenance_mode;
$configured = 0 if not defined $configured;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
maintenance_mode => $maintenance_mode,
configured => $configured,
}});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { configured => $configured }});
# Is anvil-configure-host running?
my $job_running = 0;
$anvil->Database->get_jobs({job_host_uuid => $host_uuid});
foreach my $job_uuid (sort {$a cmp $b} keys %{$anvil->data->{jobs}{running}})
{
my $job_command = $anvil->data->{jobs}{running}{$job_uuid}{job_command};
my $job_data = $anvil->data->{jobs}{running}{$job_uuid}{job_data};
my $job_progress = $anvil->data->{jobs}{running}{$job_uuid}{job_progress};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
's1:job_uuid' => $job_uuid,
's2:job_command' => $job_command,
's3:job_data' => $job_data,
's4:job_progress' => $job_progress,
}});
next if $job_progress == 100;
if ($job_command =~ /anvil-configure-host/)
{
$job_running = 1;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { job_running => $job_running }});
}
}
if (($maintenance_mode) or (not $configured))
if (($maintenance_mode) or ($job_running) or (not $configured))
{
$ready = 0;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { ready => $ready }});
@ -2441,6 +2461,7 @@ sub wait_for_subnodes
subnode => $host_name,
configured => $configured,
maintenance_mode => $maintenance_mode,
job_running => $job_running,
}});
}
}

Loading…
Cancel
Save