From e1aa4442ad15e20f90c75f8d188d74af02b26afd Mon Sep 17 00:00:00 2001 From: Digimer Date: Tue, 3 Aug 2021 13:36:32 -0400 Subject: [PATCH] Updated scan-server to not check libvirtd status as it now auto stop/starts as needed. Also fixed a pair of bugs that was preventing VNC checks from happening, or for stopped server definition checks from happening. Signed-off-by: Digimer --- scancore-agents/scan-server/scan-server | 21 +++++++-------------- scancore-agents/scan-server/scan-server.xml | 1 - 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/scancore-agents/scan-server/scan-server b/scancore-agents/scan-server/scan-server index c05c52b7..4e0a3c12 100755 --- a/scancore-agents/scan-server/scan-server +++ b/scancore-agents/scan-server/scan-server @@ -120,10 +120,11 @@ sub check_vnc if ($count) { # For each server running here, get the VNC port and record it. - foreach my $server_name (sort {$a cmp $b} keys %{$anvil->data->{'scan-server'}{server_name}}) + my $anvil_uuid = $anvil->Cluster->get_anvil_uuid; + foreach my $server_name (sort {$a cmp $b} keys %{$anvil->data->{servers}{anvil_uuid}{$anvil_uuid}{server_name}}) { - my $server_uuid = $anvil->data->{'scan-server'}{server_name}{$server_name}{server_uuid}; - my $server_state = $anvil->data->{'scan-server'}{server_name}{$server_name}{server_state}; + my $server_uuid = $anvil->data->{servers}{anvil_uuid}{$anvil_uuid}{server_name}{$server_name}{server_uuid}; + my $server_state = $anvil->data->{servers}{server_uuid}{$server_uuid}{server_state}; $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { server_name => $server_name, server_uuid => $server_uuid, @@ -236,15 +237,7 @@ sub collect_data { my ($anvil) = @_; - # Is 'libvirtd' running? - my $running = $anvil->System->check_daemon({daemon => "libvirtd"}); - $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { running => $running }}); - if (not $running) - { - $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 3, key => "scan_server_log_0003"}); - $anvil->nice_exit({exit_code => 2}); - } - + # NOTE: We don't check if libvirtd is running anymore as it auto-starts / stops on EL8+. # Load data we know about $anvil->Database->get_anvils(); $anvil->Database->get_servers(); @@ -827,8 +820,8 @@ DELETED - Marks a server as no longer existing $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { server_name => $server_name }}); next if not $server_name; - my $server_uuid = $anvil->data->{'scan-server'}{server_name}{$server_name}{server_uuid}; - $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { server_name => $server_name }}); + my $server_uuid = $anvil->data->{servers}{anvil_uuid}{$anvil_uuid}{server_name}{$server_name}{server_uuid}; + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { server_uuid => $server_uuid }}); next if not $server_uuid; # If the server is running, we would have processed it above. diff --git a/scancore-agents/scan-server/scan-server.xml b/scancore-agents/scan-server/scan-server.xml index 8a1a66e2..009fa620 100644 --- a/scancore-agents/scan-server/scan-server.xml +++ b/scancore-agents/scan-server/scan-server.xml @@ -114,7 +114,6 @@ The definition for the server: [#!variable!server!#] was changed in the database Starting: [#!variable!program!#]. This host is a: [#!variable!host_type!#], this agent is only useful on nodes and DR hosts. Exiting. - The libvirtd daemon is not running. Exiting. The server: [#!variable!server!#] is migrating, skipping scanning it.