* Updated anvil-manage-power to not reboot if anvil-version-changes is running (which, if it's taking time, is generating new kmods).

Signed-off-by: digimer <mkelly@alteeve.ca>
This commit is contained in:
digimer 2023-07-24 20:44:40 -04:00
parent 8b3d472b9c
commit d68adb5b4e
3 changed files with 39 additions and 1 deletions

View File

@ -2441,7 +2441,7 @@ sub get_peers
=head2 get_primary_host_uuid =head2 get_primary_host_uuid
This takes an Anvil! UUID and returns with the node's host UUID that is currently the "primary" node. That is to say, which node has the most servers running on it, by allocated RAM. For example, if node 1 has two servers, each with 8 GiB of RAN and node 2 has one VM with 32 GiB of RAM, node 2 will be considered primary as it would take longest to migrate servers off. This takes an Anvil! UUID and returns with the node's host UUID that is currently the "primary" node. That is to say, which node has the most servers running on it, by allocated RAM. For example, if node 1 has two servers, each with 8 GiB of RAM and node 2 has one VM with 32 GiB of RAM, node 2 will be considered primary as it would take longest to migrate servers off.
If all is equal, node 1 is considered primary. If only one node is a cluster member, it is considered primary. If neither node is up, an empty string is returned. If all is equal, node 1 is considered primary. If only one node is a cluster member, it is considered primary. If neither node is up, an empty string is returned.

View File

@ -2925,6 +2925,7 @@ Proceed? [y/N]</key>
<key name="message_0324">Update almost complete. Picked this job up after a '--no-db' run, and now we have database access again.</key> <key name="message_0324">Update almost complete. Picked this job up after a '--no-db' run, and now we have database access again.</key>
<key name="message_0325">[ Note ] - It looks like 'dnf' (pid(s): [#!variable!pids!#]) is running, holding our start up until it's done (in case the system is being updated now).</key> <key name="message_0325">[ Note ] - It looks like 'dnf' (pid(s): [#!variable!pids!#]) is running, holding our start up until it's done (in case the system is being updated now).</key>
<key name="message_0326">This daemon just started. Holding off starting jobs for another: [#!variable!will_start_in!#] second(s).</key> <key name="message_0326">This daemon just started. Holding off starting jobs for another: [#!variable!will_start_in!#] second(s).</key>
<key name="message_0327">[ Note ] - It looks like 'anvil-version-changes' (pid(s): [#!variable!pids!#]) is running, holding off on power action until it's done (in case the system is being updated now or kernel modules are being built).</key>
<!-- Translate names (protocols, etc) --> <!-- Translate names (protocols, etc) -->
<key name="name_0001">Normal Password</key> <!-- none in mail-server --> <key name="name_0001">Normal Password</key> <!-- none in mail-server -->

View File

@ -244,6 +244,43 @@ sub do_poweroff
host_status => $task eq "poweroff" ? "rebooting" : "stopping", host_status => $task eq "poweroff" ? "rebooting" : "stopping",
}); });
# Wait if anvil-version-change is running.
my $next_log = time - 1;
my $waiting = 1;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
next_log => $next_log,
waiting => $waiting,
}});
while ($waiting)
{
my $pids = $anvil->System->pids({program_name => $anvil->data->{path}{exe}{'anvil-version-changes'}});
my $avc_instances = @{$pids};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { avc_instances => $avc_instances }});
if ($avc_instances)
{
if (time > $next_log)
{
my $say_pids = "";
foreach my $pid (@{$pids})
{
$say_pids .= $pid.", ";
}
$say_pids =~ s/, $//;
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 1, key => "message_0325", variables => { pids => $say_pids }});
$next_log = time + 60;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { next_log => $next_log }});
}
sleep 10;
}
else
{
$waiting = 0;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { waiting => $waiting }});
}
}
# If we have a job UUID, mark that we're done. # If we have a job UUID, mark that we're done.
if ($job_uuid) if ($job_uuid)
{ {