This commit covers the convertion of 'virsh' shell calls to using 'Sys::Virt' module, and fixes several small bugs related to scan-server;

* Switched all calls to virsh to use Sys::Virt to deal with contention of simultaneous virsh calls.
* Removed collecting screenshots from scan-server.
* Fixed a bad variable substitution in an alert.
* Fixed a bug where a server's boot time wasn't being recorded properly.
* Reworked how we determine which server definition was most recently updated and propogated.

Signed-off-by: digimer <mkelly@alteeve.ca>
main
digimer 1 year ago
parent 74d8e6d76a
commit 580980717d
  1. 6
      Anvil/Tools/Database.pm
  2. 2
      Anvil/Tools/Network.pm
  3. 4
      Anvil/Tools/Server.pm
  4. 792
      scancore-agents/scan-server/scan-server
  5. 13
      scancore-agents/scan-server/scan-server.xml
  6. 2
      share/words.xml

@ -13087,9 +13087,9 @@ WHERE
{ {
my $difference = diff \$old_server_definition_xml, \$server_definition_xml, { STYLE => 'Unified' }; my $difference = diff \$old_server_definition_xml, \$server_definition_xml, { STYLE => 'Unified' };
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "log_0556", variables => { $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "log_0556", variables => {
server_name => $server_name, server_name => $server_name,
server_definition_server_uuid => $server_definition_server_uuid, server_uuid => $server_definition_server_uuid,
difference => $difference, difference => $difference,
}}); }});
} }

@ -2377,7 +2377,7 @@ sub is_local
$anvil->data->{cache}{is_local}{$host} = 0; $anvil->data->{cache}{is_local}{$host} = 0;
if (($host eq $anvil->Get->host_name) or if (($host eq $anvil->Get->host_name) or
($host eq $anvil->Get->short_host_name) or ($host eq $anvil->Get->short_host_name) or
($host eq "localhost") or ($host eq "localhost") or
($host eq "127.0.0.1")) ($host eq "127.0.0.1"))
{ {
# It's local # It's local

@ -672,7 +672,7 @@ sub get_runtime
my $server_pid = 0; my $server_pid = 0;
my $shell_call = $anvil->data->{path}{exe}{ps}." aux"; my $shell_call = $anvil->data->{path}{exe}{ps}." aux";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { shell_call => $shell_call }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { shell_call => $shell_call }});
my ($output, $return_code) = $anvil->System->call({debug => 3, shell_call => $shell_call}); my ($output, $return_code) = $anvil->System->call({debug => 2, shell_call => $shell_call});
foreach my $line (split/\n/, $output) foreach my $line (split/\n/, $output)
{ {
$line = $anvil->Words->clean_spaces({ string => $line }); $line = $anvil->Words->clean_spaces({ string => $line });
@ -690,7 +690,7 @@ sub get_runtime
{ {
my $shell_call = $anvil->data->{path}{exe}{ps}." -p ".$server_pid." -o etimes="; my $shell_call = $anvil->data->{path}{exe}{ps}." -p ".$server_pid." -o etimes=";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { shell_call => $shell_call }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { shell_call => $shell_call }});
my ($output, $return_code) = $anvil->System->call({debug => 3, shell_call => $shell_call}); my ($output, $return_code) = $anvil->System->call({debug => 2, shell_call => $shell_call});
foreach my $line (split/\n/, $output) foreach my $line (split/\n/, $output)
{ {
$runtime = $anvil->Words->clean_spaces({ string => $line }); $runtime = $anvil->Words->clean_spaces({ string => $line });

File diff suppressed because it is too large Load Diff

@ -114,6 +114,18 @@ The definition for the server: [#!variable!server!#] was changed in the database
There was no DRBD fence rule for the: [#!variable!server!#] in the pacemaker configuration. Adding it now. There was no DRBD fence rule for the: [#!variable!server!#] in the pacemaker configuration. Adding it now.
</key> </key>
<key name="scan_server_alert_0020">I was asked to write an empty definition for the server: [#!variable!server!#], this must be a program error. Exiting.</key> <key name="scan_server_alert_0020">I was asked to write an empty definition for the server: [#!variable!server!#], this must be a program error. Exiting.</key>
<key name="scan_server_alert_0021">Failed to connect to the local hypervisor, unable to proceed. The error, if any, was:
====
#!variable!error!#
====
Exiting.</key>
<key name="scan_server_alert_0022">Regained access to the local hypervisor.</key>
<key name="scan_server_alert_0023">Failed to connect to the peer: [#!variable!target!#] hypervisor. The error, if any, was:
====
#!variable!error!#
====
</key>
<key name="scan_server_alert_0024">Regained access to the peer: [#!variable!target!#] hypervisor.</key>
<!-- Log entries --> <!-- Log entries -->
<key name="scan_server_log_0001">Starting: [#!variable!program!#].</key> <key name="scan_server_log_0001">Starting: [#!variable!program!#].</key>
@ -127,6 +139,7 @@ The following definition file failed to parse and is likely corrupt.
<!-- Message entries (usually meant to be alerts) --> <!-- Message entries (usually meant to be alerts) -->
<key name="scan_server_message_0001">The server: [#!variable!server!#] is migrating, skipping scanning it.</key> <key name="scan_server_message_0001">The server: [#!variable!server!#] is migrating, skipping scanning it.</key>
<key name="scan_server_message_0002">Undefining the server: [#!variable!server!#].</key>
<!-- Units --> <!-- Units -->
<key name="scan_server_unit_0001"></key> <key name="scan_server_unit_0001"></key>

@ -2329,7 +2329,7 @@ The file: [#!variable!file!#] needs to be updated. The difference is:
<key name="log_0553">The server: [#!variable!server!#] has booted on: [#!variable!host_name!#]!</key> <key name="log_0553">The server: [#!variable!server!#] has booted on: [#!variable!host_name!#]!</key>
<key name="log_0554">Waiting for the server: [#!variable!server!#] to shut down...</key> <key name="log_0554">Waiting for the server: [#!variable!server!#] to shut down...</key>
<key name="log_0555">The server: [#!variable!server!#] is now off.</key> <key name="log_0555">The server: [#!variable!server!#] is now off.</key>
<key name="log_0556">The server: [#!variable!server!#] (#!variable!server_uuid!#) has a definition change: <key name="log_0556">The server: [#!variable!server_name!#] (#!variable!server_uuid!#) has a definition change:
==== ====
#!variable!difference!# #!variable!difference!#
==== ====

Loading…
Cancel
Save