Merge pull request #229 from ClusterLabs/anvil-tools-dev

Updated resync to no longer be tied to a host_uuid.
main
Digimer 3 years ago committed by GitHub
commit 240c9b5061
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 80
      Anvil/Tools/DRBD.pm
  2. 36
      Anvil/Tools/Database.pm
  3. 45
      Anvil/Tools/Network.pm
  4. 11
      Anvil/Tools/Server.pm
  5. 24
      Anvil/Tools/System.pm
  6. 20
      ocf/alteeve/server
  7. 146
      scancore-agents/scan-network/scan-network
  8. 1
      scancore-agents/scan-network/scan-network.xml
  9. 103
      share/words.xml
  10. 92
      tools/anvil-daemon
  11. 1005
      tools/anvil-report-usage
  12. 28
      tools/anvil-update-states
  13. 22
      tools/striker-parse-os-list
  14. 12
      tools/striker-scan-network

@ -1045,6 +1045,10 @@ This finds all of the configured '/dev/drbdX' devices and maps them to their res
Parameters;
=head3 anvil_uuid (optional)
If set, the C<< drbdadm dump-xml >> is not called, instead the most recent version as recorded in C<< scan_drbd -> scan_drbd_common_xml >> is loaded from one of the hosts.
=head3 password (optional)
This is the password to use when connecting to a remote machine. If not set, but C<< target >> is, an attempt to connect without a password will be made.
@ -1070,21 +1074,74 @@ sub get_devices
my $debug = defined $parameter->{debug} ? $parameter->{debug} : 3;
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => $debug, key => "log_0125", variables => { method => "DRBD->get_devices()" }});
my $anvil_uuid = defined $parameter->{anvil_uuid} ? $parameter->{anvil_uuid} : "";
my $password = defined $parameter->{password} ? $parameter->{password} : "";
my $port = defined $parameter->{port} ? $parameter->{port} : "";
my $remote_user = defined $parameter->{remote_user} ? $parameter->{remote_user} : "root";
my $target = defined $parameter->{target} ? $parameter->{target} : "";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
anvil_uuid => $anvil_uuid,
password => $anvil->Log->is_secure($password),
port => $port,
remote_user => $remote_user,
target => $target,
}});
# Is this a local call or a remote call?
# If we've got an anvil_uuid, search for the drbd common XML from the database.
my $host = $anvil->Get->short_host_name;
my $shell_call = $anvil->data->{path}{exe}{drbdadm}." dump-xml";
my $output = "";
if ($anvil_uuid)
{
if (not exists $anvil->data->{anvils}{anvil_uuid}{$anvil_uuid})
{
$anvil->Database->get_anvils({debug => $debug});
if (not exists $anvil->data->{anvils}{anvil_uuid}{$anvil_uuid})
{
# Failed to find the Anvil! data.
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 0, priority => "err", key => "error_0360", variables => { anvil_uuid => $anvil_uuid }});
return("!!error!!");
}
}
my $node1_host_uuid = $anvil->data->{anvils}{anvil_uuid}{$anvil_uuid}{anvil_node1_host_uuid};
my $node2_host_uuid = $anvil->data->{anvils}{anvil_uuid}{$anvil_uuid}{anvil_node2_host_uuid};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
node1_host_uuid => $node1_host_uuid,
node2_host_uuid => $node2_host_uuid,
}});
my $query = "
SELECT
scan_drbd_common_xml
FROM
scan_drbd
WHERE
scan_drbd_host_uuid = '618e8007-3a0b-4bbf-a616-a64fd7d2dc30'
OR
scan_drbd_host_uuid = '75070e21-a0e3-4ba5-b4f7-476bf5d08107'
ORDER BY modified_date DESC
LIMIT 1
;";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }});
my $results = $anvil->Database->query({query => $query, source => $THIS_FILE, line => __LINE__});
my $count = @{$results};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
results => $results,
count => $count,
}});
if (not $count)
{
# Nothing found
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 0, priority => "err", key => "error_0361", variables => { anvil_uuid => $anvil_uuid }});
return("!!error!!");
}
$output = $results->[0]->[0];
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { output => $output }});
}
else
{
# Is this a local call or a remote call?
my $shell_call = $anvil->data->{path}{exe}{drbdadm}." dump-xml";
if ($anvil->Network->is_local({host => $target}))
{
# Local.
@ -1113,6 +1170,7 @@ sub get_devices
"drbd::drbdadm-xml::return_code" => $anvil->data->{drbd}{'drbdadm-xml'}{return_code},
}});
}
}
# Clear the hash where we'll store the data.
if (exists $anvil->data->{drbd}{config}{$host})
@ -1225,6 +1283,9 @@ sub get_devices
my $by_res = "/dev/drbd/by-res/".$this_resource."/".$volume;
my $minor = $volume_href->{device}->[0]->{minor};
$anvil->data->{drbd}{config}{$host}{resource}{$this_resource}{volume}{$volume}{drbd_path} = "/dev/drbd".$minor;
### TODO: Anything using these are broken as the values get rewritten and
### only store the last DRBD node's data. Switch to using the
### 'this_host' stored values below
$anvil->data->{drbd}{config}{$host}{resource}{$this_resource}{volume}{$volume}{drbd_path_by_res} = $by_res;
$anvil->data->{drbd}{config}{$host}{resource}{$this_resource}{volume}{$volume}{drbd_minor} = $minor;
$anvil->data->{drbd}{config}{$host}{resource}{$this_resource}{volume}{$volume}{'meta-disk'} = $volume_href->{'meta-disk'}->[0];
@ -1236,6 +1297,7 @@ sub get_devices
"drbd::config::${host}::resource::${this_resource}::volume::${volume}::meta-disk" => $anvil->data->{drbd}{config}{$host}{resource}{$this_resource}{volume}{$volume}{'meta-disk'},
"drbd::config::${host}::resource::${this_resource}::volume::${volume}::backing_lv" => $anvil->data->{drbd}{config}{$host}{resource}{$this_resource}{volume}{$volume}{backing_lv},
}});
if (($anvil->data->{drbd}{config}{$host}{host}) && ($anvil->data->{drbd}{config}{$host}{host} eq $this_host))
{
$anvil->data->{drbd}{config}{$host}{drbd_path}{$drbd_path}{on} = $lv_path;
@ -1259,6 +1321,20 @@ sub get_devices
"drbd::config::${host}::by-res::${by_res}::backing_lv" => $anvil->data->{drbd}{config}{$host}{'by-res'}{$by_res}{backing_lv},
}});
}
# This records the backing LV data for all hosts in this resource.
$anvil->data->{drbd}{drbd_node}{$this_host}{config}{resource}{$this_resource}{volume}{$volume}{drbd_path} = "/dev/drbd".$minor;
$anvil->data->{drbd}{drbd_node}{$this_host}{config}{resource}{$this_resource}{volume}{$volume}{drbd_path_by_res} = $by_res;
$anvil->data->{drbd}{drbd_node}{$this_host}{config}{resource}{$this_resource}{volume}{$volume}{drbd_minor} = $minor;
$anvil->data->{drbd}{drbd_node}{$this_host}{config}{resource}{$this_resource}{volume}{$volume}{'meta-disk'} = $volume_href->{'meta-disk'}->[0];
$anvil->data->{drbd}{drbd_node}{$this_host}{config}{resource}{$this_resource}{volume}{$volume}{backing_lv} = $lv_path;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
"drbd::drbd_node::${this_host}::config::resource::${this_resource}::volume::${volume}::drbd_path" => $anvil->data->{drbd}{drbd_node}{$this_host}{config}{resource}{$this_resource}{volume}{$volume}{drbd_path},
"drbd::drbd_node::${this_host}::config::resource::${this_resource}::volume::${volume}::drbd_path_by_res" => $anvil->data->{drbd}{drbd_node}{$this_host}{config}{resource}{$this_resource}{volume}{$volume}{drbd_path_by_res},
"drbd::drbd_node::${this_host}::config::resource::${this_resource}::volume::${volume}::drbd_minor" => $anvil->data->{drbd}{drbd_node}{$this_host}{config}{resource}{$this_resource}{volume}{$volume}{drbd_minor},
"drbd::drbd_node::${this_host}::config::resource::${this_resource}::volume::${volume}::meta-disk" => $anvil->data->{drbd}{drbd_node}{$this_host}{config}{resource}{$this_resource}{volume}{$volume}{'meta-disk'},
"drbd::drbd_node::${this_host}::config::resource::${this_resource}::volume::${volume}::backing_lv" => $anvil->data->{drbd}{drbd_node}{$this_host}{config}{resource}{$this_resource}{volume}{$volume}{backing_lv},
}});
}
}

@ -1696,7 +1696,7 @@ sub connect
uuid => $uuid,
variable_name => "database::".$uuid."::active",
});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { active_value => $active_value }});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { active_value => $active_value }});
if (not $active_value)
{
# If we're "retry", we just started up.
@ -16053,11 +16053,12 @@ sub resync_databases
$query =~ s/, $/ /;
$query .= "FROM ".$schema.".".$table;
# Restrict to this host if a host column was found.
if ($host_column)
{
$query .= " WHERE ".$host_column." = ".$anvil->Database->quote($anvil->data->{sys}{host_uuid});
}
### NOTE: No longer restricting to the host, given only the strikers can do resyncs now.
# # Restrict to this host if a host column was found.
# if ($host_column)
# {
# $query .= " WHERE ".$host_column." = ".$anvil->Database->quote($anvil->data->{sys}{host_uuid});
# }
$query .= " ORDER BY utc_modified_date DESC;";
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => $debug, key => "log_0074", variables => { uuid => $uuid, query => $query }});
@ -17633,7 +17634,7 @@ sub _find_column
This returns the most up to date database ID, the time it was last updated and an array or DB IDs that are behind.
If there is a problem, C<< !!error!! >> is returned.
If there is a problem, C<< !!error!! >> is returned. If this is called by a host that isn't a Striker, C<< 0 >> is returned and no actions are take.
Parameters;
@ -17661,6 +17662,14 @@ sub _find_behind_databases
tables => $tables,
}});
# If we're not a striker, return.
my $host_type = $anvil->Get->host_type();
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { host_type => $host_type }});
if ($host_type ne "striker")
{
return(0);
}
# This should always be set, but just in case...
if (not $source)
{
@ -17774,18 +17783,19 @@ sub _find_behind_databases
"database::${uuid}::password" => $anvil->Log->is_secure($anvil->data->{database}{$uuid}{password}),
}});
### Only Strikers resync, so limiting to the host_uuid doesn't make sense anymore.
my $schema = $has_history ? "history" : "public";
$query = "
SELECT DISTINCT
round(extract(epoch from modified_date)) AS unix_modified_date
FROM
".$schema.".".$table." ";
if ($host_column)
{
$query .= "
WHERE
".$host_column." = ".$anvil->Database->quote($anvil->data->{sys}{host_uuid}) ;
}
# if ($host_column)
# {
# $query .= "
# WHERE
# ".$host_column." = ".$anvil->Database->quote($anvil->data->{sys}{host_uuid}) ;
# }
$query .= "
ORDER BY
unix_modified_date DESC

@ -21,6 +21,7 @@ my $THIS_FILE = "Network.pm";
# find_target_ip
# get_company_from_mac
# get_ips
# get_ip_from_mac
# get_network
# is_local
# is_our_interface
@ -1943,6 +1944,50 @@ sub get_company_from_mac
return($company);
}
=head2 get_ip_from_mac
This takes a MAC address and tries to convert it to an IP address. If no IP is found, an empty string is returned.
Parameters;
=head3 mac (required)
This is the MAC address we're looking for an IP to match to. The format must be C<< aa:bb:cc:dd:ee:ff >>.
=cut
sub get_ip_from_mac
{
my $self = shift;
my $parameter = shift;
my $anvil = $self->parent;
my $debug = defined $parameter->{debug} ? $parameter->{debug} : 3;
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => $debug, key => "log_0125", variables => { method => "Network->get_ip_from_mac()" }});
my $ip = "";
my $mac = defined $parameter->{mac} ? $parameter->{mac} : "";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
mac => $mac,
}});
my $query = "SELECT mac_to_ip_ip_address FROM mac_to_ip WHERE mac_to_ip_mac_address = ".$anvil->Database->quote(lc($mac)).";";
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => $debug, key => "log_0124", variables => { query => $query }});
my $results = $anvil->Database->query({query => $query, source => $THIS_FILE, line => __LINE__});
my $count = @{$results};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
results => $results,
count => $count,
}});
if ($count)
{
$ip = $results->[0]->[0];
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { ip => $ip }});
}
return($ip);
}
=head2 get_ips
This method checks the local system for interfaces and stores them in:

@ -1259,6 +1259,10 @@ B<< Note >>: This method currently parses out data needed for specific tasks, an
Parameters;
=head3 anvil_uuid (optional)
If passed, the C<< anvil_uuid >> will be passed on to C<< DRBD->get_devices >>.
=head3 server (required)
This is the name of the server whose XML is being parsed.
@ -1297,12 +1301,14 @@ sub parse_definition
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => $debug, key => "log_0125", variables => { method => "Server->parse_definition()" }});
# Source is required.
my $anvil_uuid = defined $parameter->{anvil_uuid} ? $parameter->{anvil_uuid} : "";
my $server = defined $parameter->{server} ? $parameter->{server} : "";
my $source = defined $parameter->{source} ? $parameter->{source} : "";
my $definition = defined $parameter->{definition} ? $parameter->{definition} : "";
my $host = defined $parameter->{host} ? $parameter->{host} : $anvil->Get->short_host_name;
my $target = $anvil->Get->short_host_name();
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
anvil_uuid => $anvil_uuid,
server => $server,
source => $source,
definition => $definition,
@ -1344,7 +1350,10 @@ sub parse_definition
$anvil->data->{server}{$target}{$server}{$source}{parsed} = $server_xml;
# Get the DRBD data that this server will almost certainly be using.
$anvil->DRBD->get_devices({debug => $debug});
$anvil->DRBD->get_devices({
debug => $debug,
anvil_uuid => $anvil_uuid,
});
# Pull out some basic server info.
$anvil->data->{server}{$target}{$server}{$source}{info}{uuid} = $server_xml->{uuid}->[0];

@ -5407,16 +5407,18 @@ sub _check_anvil_conf
admin_uid => $admin_uid,
admin_gid => $admin_gid,
}});
if (not $admin_gid)
if ((not $admin_uid) && (not $admin_gid))
{
# Create the admin group
my ($output, $return_code) = $anvil->System->call({debug => $debug, shell_call => $anvil->data->{path}{exe}{groupadd}." --system admin"});
# Create the admin user and group
my ($output, $return_code) = $anvil->System->call({debug => $debug, shell_call => $anvil->data->{path}{exe}{useradd}." --create-home --comment \"Anvil! user account\" admin"});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
output => $output,
return_code => $return_code,
}});
$admin_uid = getpwnam('admin');
$admin_gid = getgrnam('admin');
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 0, priority => "alert", key => "warning_0119", variables => { uid => $admin_uid }});
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 0, priority => "alert", key => "warning_0118", variables => { gid => $admin_gid }});
}
if (not $admin_uid)
@ -5428,8 +5430,20 @@ sub _check_anvil_conf
return_code => $return_code,
}});
my $admin_uid = getpwnam('admin');
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 0, priority => "alert", key => "warning_0119", variables => { uid => $admin_gid }});
$admin_uid = getpwnam('admin');
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 0, priority => "alert", key => "warning_0119", variables => { uid => $admin_uid }});
}
if (not $admin_gid)
{
# Create the admin group
my ($output, $return_code) = $anvil->System->call({debug => $debug, shell_call => $anvil->data->{path}{exe}{groupadd}." admin"});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
output => $output,
return_code => $return_code,
}});
$admin_gid = getgrnam('admin');
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 0, priority => "alert", key => "warning_0118", variables => { gid => $admin_gid }});
}
# Does the file exist?

@ -937,13 +937,14 @@ sub start_drbd_resource
}
}
### NOTE: We always check the peer now, in case it's resource is down and ours happens to be up.
# Do we need to start the resource on our peers?
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { peer_startup_needed => $peer_startup_needed }});
if (not $peer_startup_needed)
{
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "log_0431"});
return(0);
}
#$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { peer_startup_needed => $peer_startup_needed }});
#if (not $peer_startup_needed)
#{
# $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "log_0431"});
# return(0);
#}
# Start DRBD on the peer(s).
foreach my $resource (sort {$a cmp $b} keys %{$anvil->data->{server}{$local_host}{$server}{resource}})
@ -1244,17 +1245,18 @@ sub server_status
}
else
{
# On EL8 and above, libvirtd starts on demand, so this error isn't
if (not $warning_shown)
{
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "log_0522", variables => { wait_time => ($wait_until - time) }});
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 2, key => "log_0522", variables => { wait_time => ($wait_until - time) }});
$warning_shown = 1;
}
sleep 1;
if (time > $wait_until)
{
# Libvirtd isn't running, try to find the PID of the server (in case it's
# running a libvirtd isn't)
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, priority => "alert", key => "warning_0057"});
# running and libvirtd isn't)
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 2, priority => "alert", key => "warning_0057"});
$look_for_pid = 1;
$libvirtd_wait = 0;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {

@ -85,6 +85,9 @@ process_health($anvil);
# This clears the TX and RX variable data for interfaces older than 'scancore::database::age_out'.
clear_old_variables($anvil);
# This removes network interfaces that have been marked as DELETED for a while now.
clear_old_interfaces($anvil);
# Shut down.
$anvil->ScanCore->agent_shutdown({agent => $THIS_FILE});
@ -93,6 +96,81 @@ $anvil->ScanCore->agent_shutdown({agent => $THIS_FILE});
# Functions #
#############################################################################################################
# This removes network interfaces that have been marked as DELETED for a while now.
sub clear_old_interfaces
{
my ($anvil) = @_;
# Read in all interfaces and for each, delete historical records over the age-out time.
my $age = $anvil->data->{scancore}{database}{age_out};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { age => $age }});
if ($age =~ /\D/)
{
# Age is not valid, set it to defaults.
$age = 24;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { age => $age }});
}
my $query = "SELECT now() - '".$age."h'::interval;";
my $old_timestamp = $anvil->Database->query({query => $query, source => $THIS_FILE, line => __LINE__})->[0]->[0];
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => {
query => $query,
old_timestamp => $old_timestamp,
}});
$query = "
SELECT
network_interface_uuid,
network_interface_mac_address,
network_interface_name
FROM
network_interfaces
WHERE
network_interface_host_uuid = ".$anvil->Database->quote($anvil->Get->host_uuid)."
AND
network_interface_operational = 'DELETED'
AND
modified_date < '".$old_timestamp."'
ORDER BY
network_interface_name ASC;
;";
my $results = $anvil->Database->query({query => $query, source => $THIS_FILE, line => __LINE__});
my $count = @{$results};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
results => $results,
count => $count,
}});
foreach my $row (@{$results})
{
my $network_interface_uuid = $row->[0];
my $network_interface_mac_address = $row->[1];
my $network_interface_name = $row->[2];
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
's1:network_interface_uuid' => $network_interface_uuid,
's2:network_interface_mac_address' => $network_interface_mac_address,
's3:network_interface_name' => $network_interface_name,
}});
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 2, key => "scan_network_log_0002", variables => {
age => $age,
mac => $network_interface_mac_address,
name => $network_interface_name,
}});
my $queries = [];
push @{$queries}, "DELETE FROM history.network_interfaces WHERE network_interface_uuid = '".$network_interface_uuid."';";
push @{$queries}, "DELETE FROM network_interfaces WHERE network_interface_uuid = '".$network_interface_uuid."';";
foreach my $query (@{$queries})
{
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { query => $query }});
}
$anvil->Database->write({query => $queries, source => $THIS_FILE, line => __LINE__});
}
return(0);
}
# This clears the TX and RX variable data for interfaces older than 'scancore::database::age_out'.
sub clear_old_variables
{
@ -314,9 +392,11 @@ sub collect_data
my $mtu = -e $full_path."/mtu" ? $anvil->Storage->read_file({file => $full_path."/mtu"}) : 0;
my $duplex = -e $full_path."/duplex" ? $anvil->Storage->read_file({file => $full_path."/duplex"}) : "unknown"; # full or half?
my $operational = -e $full_path."/operstate" ? $anvil->Storage->read_file({file => $full_path."/operstate"}) : "unknown"; # up or down
my $modalias = -e $full_path."/device/modalias" ? $anvil->Storage->read_file({file => $full_path."/device/modalias"}) : "unknown";
my $speed = $link_state ? $anvil->Storage->read_file({file => $full_path."/speed"}) : 0; # Mbps (ie: 1000 = Gbps), gives a very high number for unplugged link
my $media = "unknown";
my $type = "interface";
my $driver = "";
my $tx_bytes = 0; # How many bytes transmitted
my $rx_bytes = 0; # How many bytes received
@ -326,6 +406,7 @@ sub collect_data
$duplex =~ s/\n$//;
$operational =~ s/\n$//;
$speed =~ s/\n$//;
$modalias =~ s/\n$//;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
interface => $interface,
link_state => $link_state,
@ -333,8 +414,17 @@ sub collect_data
duplex => $duplex,
operational => $operational,
speed => $speed,
modalias => $modalias,
}});
### NOTE: This only parses virtio so far.
# Pick out our driver.
if ($modalias =~ /^virtio:/)
{
$driver = "virtio";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { driver => $driver }});
}
# The MAC address can faked by a number of ways, so we make an explicit call to 'ethtool' to get the permanent mac address.
my $mac_address = "";
my $shell_call = $anvil->data->{path}{exe}{ethtool}." -P ".$interface;
@ -412,12 +502,18 @@ sub collect_data
# If this is a virtual interface, set some fake values that don't actually exist on
# the system for the sake of a cleaner display.
if ($mac_address =~ /^52:54:00/)
if (($mac_address =~ /^52:54:00/) or ($driver eq "virtio"))
{
### Set some fake values.
# Speed is "as fast as possible", so we'll record 100 Gbps, but that is really kind of arbitrary.
$speed = 1000 if ((not $speed) or ($speed eq "-1"));
$duplex = "full" if not $duplex;
if ((not $speed) or ($speed eq "-1"))
{
$speed = 10000;
}
if ((not $duplex) or ($duplex eq "unknown"))
{
$duplex = "full";
}
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
speed => $speed,
duplex => $duplex,
@ -885,9 +981,31 @@ ORDER BY
uuid => $bridge_uuid,
}});
# If there's a bond connected to this bridge, get it's bond_uuid so
# we can remove any interfaces linked to it.
my $bond_uuid = "";
my $query = "SELECT bond_uuid FROM bonds WHERE bond_bridge_uuid = ".$anvil->Database->quote($bridge_uuid).";";
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 2, key => "log_0124", variables => { query => $query }});
my $results = $anvil->Database->query({query => $query, source => $THIS_FILE, line => __LINE__});
my $count = @{$results};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
results => $results,
count => $count,
}});
if ($count)
{
$bond_uuid = $results->[0]->[0];
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { bond_uuid => $bond_uuid }});
}
my $queries = [];
push @{$queries}, "DELETE FROM history.network_interfaces WHERE network_interface_bridge_uuid = ".$anvil->Database->quote($bridge_uuid).";";
push @{$queries}, "DELETE FROM network_interfaces WHERE network_interface_bridge_uuid = ".$anvil->Database->quote($bridge_uuid).";";
if ($bond_uuid)
{
push @{$queries}, "DELETE FROM history.network_interfaces WHERE network_interface_bond_uuid = ".$anvil->Database->quote($bond_uuid).";";
push @{$queries}, "DELETE FROM network_interfaces WHERE network_interface_bond_uuid = ".$anvil->Database->quote($bond_uuid).";";
}
push @{$queries}, "DELETE FROM history.bonds WHERE bond_bridge_uuid = ".$anvil->Database->quote($bridge_uuid).";";
push @{$queries}, "DELETE FROM bonds WHERE bond_bridge_uuid = ".$anvil->Database->quote($bridge_uuid).";";
push @{$queries}, "DELETE FROM history.bridges WHERE bridge_uuid = ".$anvil->Database->quote($bridge_uuid).";";
@ -917,9 +1035,31 @@ ORDER BY
uuid => $bridge_uuid,
}});
# If there's a bond connected to this bridge, get it's bond_uuid so
# we can remove any interfaces linked to it.
my $bond_uuid = "";
my $query = "SELECT bond_uuid FROM bonds WHERE bond_bridge_uuid = ".$anvil->Database->quote($bridge_uuid).";";
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 2, key => "log_0124", variables => { query => $query }});
my $results = $anvil->Database->query({query => $query, source => $THIS_FILE, line => __LINE__});
my $count = @{$results};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
results => $results,
count => $count,
}});
if ($count)
{
$bond_uuid = $results->[0]->[0];
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { bond_uuid => $bond_uuid }});
}
my $queries = [];
push @{$queries}, "DELETE FROM history.network_interfaces WHERE network_interface_bridge_uuid = ".$anvil->Database->quote($bridge_uuid).";";
push @{$queries}, "DELETE FROM network_interfaces WHERE network_interface_bridge_uuid = ".$anvil->Database->quote($bridge_uuid).";";
if ($bond_uuid)
{
push @{$queries}, "DELETE FROM history.network_interfaces WHERE network_interface_bond_uuid = ".$anvil->Database->quote($bond_uuid).";";
push @{$queries}, "DELETE FROM network_interfaces WHERE network_interface_bond_uuid = ".$anvil->Database->quote($bond_uuid).";";
}
push @{$queries}, "DELETE FROM history.bonds WHERE bond_bridge_uuid = ".$anvil->Database->quote($bridge_uuid).";";
push @{$queries}, "DELETE FROM bonds WHERE bond_bridge_uuid = ".$anvil->Database->quote($bridge_uuid).";";
push @{$queries}, "DELETE FROM history.bridges WHERE bridge_uuid = ".$anvil->Database->quote($bridge_uuid).";";

@ -215,5 +215,6 @@ This mode is NOT supported by the Anvil! Intelligent Availability™ platform!
</key>
<key name="scan_network_log_0001">Aging out RX and TX data under: [#!variable!records!#] interfaces. These have 1 or more historical records older than: [#!variable!age!#] hours old from the database host: [#!variable!host!#].</key>
<key name="scan_network_log_0002">The old network interface: [#!variable!name!#] with the MAC address: [#!variable!mac!#] was marked as deleted more than: [#!variable!age!#] hours ago. Purging it from the database.</key>
</language>
</words>

@ -504,6 +504,9 @@ The output, if any, was;
<key name="error_0356">Failed to read the kernel release on the host: [#!variable!target!#]. The return code was: [#!variable!return_code!#] (expected '0') and the release output, if any, was: [#!variable!output!#].</key>
<key name="error_0357">The program: [#!variable!program!#] is using: [#!variable!ram_used!#] (#!variable!ram_used_bytes!# Bytes). This is probably caused by a memory leak, so we will now exit so that systemctl can restart us. If this is happening repeatedly, please contact support.</key>
<key name="error_0358">This is not a Striker host.</key>
<key name="error_0359">There are no databases available, exiting.</key>
<key name="error_0360">Unable to find the Anvil! information for the Anvil! UUID: [#!variable!anvil_uuid!#].</key>
<key name="error_0361">Unable to find the DRBD config from either node in the Anvil! with the Anvil! UUID: [#!variable!anvil_uuid!#]. Has scan_drbd (as part of scancore) run on either nodes?</key>
<!-- Files templates -->
<!-- NOTE: Translating these files requires an understanding of which lines are translatable -->
@ -845,6 +848,23 @@ resource #!variable!server!# {
<key name="header_0062">Table</key>
<key name="header_0063">public</key> <!-- SQL schema -->
<key name="header_0064">history</key> <!-- SQL schema -->
<key name="header_0065">Server</key>
<key name="header_0066">CPU</key>
<key name="header_0067">RAM</key>
<key name="header_0068">Disk</key>
<key name="header_0069">Size</key>
<key name="header_0070">Storage Group</key>
<key name="header_0071">Bridge</key>
<key name="header_0072">Model</key>
<key name="header_0073">Last Known IP</key>
<key name="header_0074">Description</key>
<key name="header_0075">RAM Used</key>
<key name="header_0076">RAM Free</key>
<key name="header_0077">Bridges</key>
<key name="header_0078">Storage Group</key>
<key name="header_0079">Used</key>
<key name="header_0080">Free</key>
<key name="header_0081">Anvil! Node Pair</key>
<!-- Strings used by jobs -->
<key name="job_0001">Configure Network</key>
@ -2509,6 +2529,10 @@ Available options;
<key name="message_0284">I was asked to resync. Calling the resync now.</key>
<key name="message_0285">Aging out data to thin down the database(s).</key>
<key name="message_0286">Prior to resync, we will check to see if any scan agent schemas need to be loaded.</key>
<key name="message_0287">#!variable!total_cores!#c (#!variable!sockets!#s)</key>
<key name="message_0288">#!variable!total_cores!#c (#!variable!sockets!#s, #!variable!cores!#c, #!variable!threads!#t), #!variable!model!#, #!variable!mode!#</key>
<key name="message_0289">#!variable!cores!#c (#!variable!threads!#t)</key>
<key name="message_0290">-=] Server Usage and Anvil! Node Resource Availability</key>
<!-- Success messages shown to the user -->
<key name="ok_0001">Saved the mail server information successfully!</key>
@ -3188,15 +3212,19 @@ We will sleep a bit and try again.
<!-- The entries below here are not sequential, but use a key to find the entry. -->
<!-- Run 'striker-parse-os-list to find new entries. -->
<key name="os_list_almalinux8"><![CDATA[AlmaLinux 8]]></key>
<key name="os_list_alpinelinux3.10"><![CDATA[Alpine Linux 3.10]]></key>
<key name="os_list_alpinelinux3.11"><![CDATA[Alpine Linux 3.11]]></key>
<key name="os_list_alpinelinux3.12"><![CDATA[Alpine Linux 3.12]]></key>
<key name="os_list_alpinelinux3.13"><![CDATA[Alpine Linux 3.13]]></key>
<key name="os_list_alpinelinux3.14"><![CDATA[Alpine Linux 3.14]]></key>
<key name="os_list_alpinelinux3.15"><![CDATA[Alpine Linux 3.15]]></key>
<key name="os_list_alpinelinux3.5"><![CDATA[Alpine Linux 3.5]]></key>
<key name="os_list_alpinelinux3.6"><![CDATA[Alpine Linux 3.6]]></key>
<key name="os_list_alpinelinux3.7"><![CDATA[Alpine Linux 3.7]]></key>
<key name="os_list_alpinelinux3.8"><![CDATA[Alpine Linux 3.8]]></key>
<key name="os_list_alpinelinux3.9"><![CDATA[Alpine Linux 3.9]]></key>
<key name="os_list_alpinelinux3.10"><![CDATA[Alpine Linux 3.10]]></key>
<key name="os_list_alpinelinux3.11"><![CDATA[Alpine Linux 3.11]]></key>
<key name="os_list_alpinelinux3.12"><![CDATA[Alpine Linux 3.12]]></key>
<key name="os_list_alpinelinux3.13"><![CDATA[Alpine Linux 3.13]]></key>
<key name="os_list_alt.p10"><![CDATA[ALT p10 StarterKits]]></key>
<key name="os_list_alt.p8"><![CDATA[ALT p8 StarterKits]]></key>
<key name="os_list_alt.p9"><![CDATA[ALT p9 StarterKits]]></key>
<key name="os_list_alt.sisyphus"><![CDATA[ALT regular]]></key>
@ -3204,6 +3232,8 @@ We will sleep a bit and try again.
<key name="os_list_alt8.1"><![CDATA[ALT 8.1]]></key>
<key name="os_list_alt8.2"><![CDATA[ALT 8.2]]></key>
<key name="os_list_alt9.0"><![CDATA[ALT 9.0]]></key>
<key name="os_list_alt9.1"><![CDATA[ALT 9.1]]></key>
<key name="os_list_alt9.2"><![CDATA[ALT 9.2]]></key>
<key name="os_list_altlinux1.0"><![CDATA[Mandrake RE Spring 2001]]></key>
<key name="os_list_altlinux2.0"><![CDATA[ALT Linux 2.0]]></key>
<key name="os_list_altlinux2.2"><![CDATA[ALT Linux 2.2]]></key>
@ -3230,6 +3260,7 @@ We will sleep a bit and try again.
<key name="os_list_caasp2.0"><![CDATA[SUSE CaaS Platform 2.0]]></key>
<key name="os_list_caasp3.0"><![CDATA[SUSE CaaS Platform 3.0]]></key>
<key name="os_list_centos-stream8"><![CDATA[CentOS Stream 8]]></key>
<key name="os_list_centos-stream9"><![CDATA[CentOS Stream 9]]></key>
<key name="os_list_centos5.0"><![CDATA[CentOS 5.0]]></key>
<key name="os_list_centos5.1"><![CDATA[CentOS 5.1]]></key>
<key name="os_list_centos5.10"><![CDATA[CentOS 5.10]]></key>
@ -3255,6 +3286,12 @@ We will sleep a bit and try again.
<key name="os_list_centos6.9"><![CDATA[CentOS 6.9]]></key>
<key name="os_list_centos7.0"><![CDATA[CentOS 7]]></key>
<key name="os_list_centos8"><![CDATA[CentOS 8]]></key>
<key name="os_list_circle-unknown"><![CDATA[Circle Linux Unknown]]></key>
<key name="os_list_circle8-unknown"><![CDATA[Circle Linux 8 Unknown]]></key>
<key name="os_list_circle8.4"><![CDATA[Circle Linux 8.4]]></key>
<key name="os_list_circle8.5"><![CDATA[Circle Linux 8.5]]></key>
<key name="os_list_circle9-unknown"><![CDATA[Circle Linux 9 Unknown]]></key>
<key name="os_list_circle9.0"><![CDATA[Circle Linux 9.0]]></key>
<key name="os_list_cirros0.3.0"><![CDATA[CirrOS 0.3.0]]></key>
<key name="os_list_cirros0.3.1"><![CDATA[CirrOS 0.3.1]]></key>
<key name="os_list_cirros0.3.2"><![CDATA[CirrOS 0.3.2]]></key>
@ -3262,11 +3299,15 @@ We will sleep a bit and try again.
<key name="os_list_cirros0.3.4"><![CDATA[CirrOS 0.3.4]]></key>
<key name="os_list_cirros0.3.5"><![CDATA[CirrOS 0.3.5]]></key>
<key name="os_list_cirros0.4.0"><![CDATA[CirrOS 0.4.0]]></key>
<key name="os_list_cirros0.5.0"><![CDATA[CirrOS 0.5.0]]></key>
<key name="os_list_cirros0.5.1"><![CDATA[CirrOS 0.5.1]]></key>
<key name="os_list_cirros0.5.2"><![CDATA[CirrOS 0.5.2]]></key>
<key name="os_list_clearlinux"><![CDATA[Clear Linux OS]]></key>
<key name="os_list_debian1.1"><![CDATA[Debian GNU/Linux 1.1]]></key>
<key name="os_list_debian1.2"><![CDATA[Debian GNU/Linux 1.2]]></key>
<key name="os_list_debian1.3"><![CDATA[Debian GNU/Linux 1.3]]></key>
<key name="os_list_debian10"><![CDATA[Debian 10]]></key>
<key name="os_list_debian11"><![CDATA[Debian 11]]></key>
<key name="os_list_debian2.0"><![CDATA[Debian GNU/Linux 2.0]]></key>
<key name="os_list_debian2.1"><![CDATA[Debian GNU/Linux 2.1]]></key>
<key name="os_list_debian2.2"><![CDATA[Debian GNU/Linux 2.2]]></key>
@ -3347,6 +3388,7 @@ We will sleep a bit and try again.
<key name="os_list_dragonflybsd5.6"><![CDATA[DragonFlyBSD 5.6]]></key>
<key name="os_list_elementary5.0"><![CDATA[Elementary OS 5.0 Juno]]></key>
<key name="os_list_eos3.1"><![CDATA[Endless OS 3.1]]></key>
<key name="os_list_eos3.10"><![CDATA[Endless OS 3.10]]></key>
<key name="os_list_eos3.2"><![CDATA[Endless OS 3.2]]></key>
<key name="os_list_eos3.3"><![CDATA[Endless OS 3.3]]></key>
<key name="os_list_eos3.4"><![CDATA[Endless OS 3.4]]></key>
@ -3355,7 +3397,10 @@ We will sleep a bit and try again.
<key name="os_list_eos3.7"><![CDATA[Endless OS 3.7]]></key>
<key name="os_list_eos3.8"><![CDATA[Endless OS 3.8]]></key>
<key name="os_list_eos3.9"><![CDATA[Endless OS 3.9]]></key>
<key name="os_list_eos3.10"><![CDATA[Endless OS 3.10]]></key>
<key name="os_list_eos4.0"><![CDATA[Endless OS 4.0]]></key>
<key name="os_list_fedora-coreos-next"><![CDATA[Fedora CoreOS]]></key>
<key name="os_list_fedora-coreos-stable"><![CDATA[Fedora CoreOS]]></key>
<key name="os_list_fedora-coreos-testing"><![CDATA[Fedora CoreOS]]></key>
<key name="os_list_fedora-rawhide"><![CDATA[Fedora Rawhide]]></key>
<key name="os_list_fedora-unknown"><![CDATA[Fedora]]></key>
<key name="os_list_fedora1"><![CDATA[Fedora Core 1]]></key>
@ -3385,15 +3430,14 @@ We will sleep a bit and try again.
<key name="os_list_fedora31"><![CDATA[Fedora 31]]></key>
<key name="os_list_fedora32"><![CDATA[Fedora 32]]></key>
<key name="os_list_fedora33"><![CDATA[Fedora 33]]></key>
<key name="os_list_fedora34"><![CDATA[Fedora 34]]></key>
<key name="os_list_fedora35"><![CDATA[Fedora 35]]></key>
<key name="os_list_fedora4"><![CDATA[Fedora Core 4]]></key>
<key name="os_list_fedora5"><![CDATA[Fedora Core 5]]></key>
<key name="os_list_fedora6"><![CDATA[Fedora Core 6]]></key>
<key name="os_list_fedora7"><![CDATA[Fedora 7]]></key>
<key name="os_list_fedora8"><![CDATA[Fedora 8]]></key>
<key name="os_list_fedora9"><![CDATA[Fedora 9]]></key>
<key name="os_list_fedora-coreos-next"><![CDATA[Fedora CoreOS]]></key>
<key name="os_list_fedora-coreos-stable"><![CDATA[Fedora CoreOS]]></key>
<key name="os_list_fedora-coreos-testing"><![CDATA[Fedora CoreOS]]></key>
<key name="os_list_freebsd1.0"><![CDATA[FreeBSD 1.0]]></key>
<key name="os_list_freebsd10.0"><![CDATA[FreeBSD 10.0]]></key>
<key name="os_list_freebsd10.1"><![CDATA[FreeBSD 10.1]]></key>
@ -3408,6 +3452,8 @@ We will sleep a bit and try again.
<key name="os_list_freebsd12.0"><![CDATA[FreeBSD 12.0]]></key>
<key name="os_list_freebsd12.1"><![CDATA[FreeBSD 12.1]]></key>
<key name="os_list_freebsd12.2"><![CDATA[FreeBSD 12.2]]></key>
<key name="os_list_freebsd12.3"><![CDATA[FreeBSD 12.3]]></key>
<key name="os_list_freebsd13.0"><![CDATA[FreeBSD 13.0]]></key>
<key name="os_list_freebsd2.0"><![CDATA[FreeBSD 2.0]]></key>
<key name="os_list_freebsd2.0.5"><![CDATA[FreeBSD 2.0.5]]></key>
<key name="os_list_freebsd2.2.8"><![CDATA[FreeBSD 2.2.8]]></key>
@ -3453,6 +3499,7 @@ We will sleep a bit and try again.
<key name="os_list_freebsd9.2"><![CDATA[FreeBSD 9.2]]></key>
<key name="os_list_freebsd9.3"><![CDATA[FreeBSD 9.3]]></key>
<key name="os_list_freedos1.2"><![CDATA[FreeDOS 1.2]]></key>
<key name="os_list_freenix14.2"><![CDATA[Freenix 14.2]]></key>
<key name="os_list_gentoo"><![CDATA[Gentoo Linux]]></key>
<key name="os_list_gnome-continuous-3.10"><![CDATA[GNOME 3.10]]></key>
<key name="os_list_gnome-continuous-3.12"><![CDATA[GNOME 3.12]]></key>
@ -3460,12 +3507,18 @@ We will sleep a bit and try again.
<key name="os_list_gnome3.6"><![CDATA[GNOME 3.6]]></key>
<key name="os_list_gnome3.8"><![CDATA[GNOME 3.8]]></key>
<key name="os_list_guix-1.1"><![CDATA[Guix 1.1]]></key>
<key name="os_list_guix-1.3"><![CDATA[Guix 1.3]]></key>
<key name="os_list_guix-hurd-latest"><![CDATA[Guix Hurd Latest]]></key>
<key name="os_list_guix-latest"><![CDATA[Guix latest]]></key>
<key name="os_list_haikunightly"><![CDATA[Haiku Nightly]]></key>
<key name="os_list_haikur1alpha1"><![CDATA[Haiku R1/Alpha1]]></key>
<key name="os_list_haikur1alpha2"><![CDATA[Haiku R1/Alpha2]]></key>
<key name="os_list_haikur1alpha3"><![CDATA[Haiku R1/Alpha3]]></key>
<key name="os_list_haikur1alpha4.1"><![CDATA[Haiku R1/Alpha4.1]]></key>
<key name="os_list_haikur1beta1"><![CDATA[Haiku R1/Beta1]]></key>
<key name="os_list_haikur1beta2"><![CDATA[Haiku R1/Beta2]]></key>
<key name="os_list_haikur1beta3"><![CDATA[Haiku R1/Beta3]]></key>
<key name="os_list_hyperbola03"><![CDATA[Hyperbola]]></key>
<key name="os_list_linux2016"><![CDATA[Generic Linux 2016]]></key>
<key name="os_list_linux2018"><![CDATA[Generic Linux 2018]]></key>
<key name="os_list_linux2020"><![CDATA[Generic Linux 2020]]></key>
@ -3484,6 +3537,7 @@ We will sleep a bit and try again.
<key name="os_list_mageia5"><![CDATA[Mageia 5]]></key>
<key name="os_list_mageia6"><![CDATA[Mageia 6]]></key>
<key name="os_list_mageia7"><![CDATA[Mageia 7]]></key>
<key name="os_list_mageia8"><![CDATA[Mageia 8]]></key>
<key name="os_list_mandrake10.0"><![CDATA[Mandrake Linux 10.0]]></key>
<key name="os_list_mandrake10.1"><![CDATA[Mandrake Linux 10.1]]></key>
<key name="os_list_mandrake10.2"><![CDATA[Mandrake Linux 10.2]]></key>
@ -3516,6 +3570,7 @@ We will sleep a bit and try again.
<key name="os_list_mbs1.0"><![CDATA[Mandriva Business Server 1.0]]></key>
<key name="os_list_mes5"><![CDATA[Mandriva Enterprise Server 5.0]]></key>
<key name="os_list_mes5.1"><![CDATA[Mandriva Enterprise Server 5.1]]></key>
<key name="os_list_miraclelinux8.4"><![CDATA[MIRACLE LINUX 8.4]]></key>
<key name="os_list_msdos6.22"><![CDATA[Microsoft MS-DOS 6.22]]></key>
<key name="os_list_netbsd0.8"><![CDATA[NetBSD 0.8]]></key>
<key name="os_list_netbsd0.9"><![CDATA[NetBSD 0.9]]></key>
@ -3547,6 +3602,7 @@ We will sleep a bit and try again.
<key name="os_list_netware6"><![CDATA[Novell Netware 6]]></key>
<key name="os_list_nixos-20.03"><![CDATA[NixOS 20.03]]></key>
<key name="os_list_nixos-20.09"><![CDATA[NixOS 20.09]]></key>
<key name="os_list_nixos-21.05"><![CDATA[NixOS 21.05]]></key>
<key name="os_list_nixos-unknown"><![CDATA[NixOS]]></key>
<key name="os_list_nixos-unstable"><![CDATA[NixOS Unstable]]></key>
<key name="os_list_oel4.4"><![CDATA[Oracle Enterprise Linux 4.4]]></key>
@ -3587,9 +3643,13 @@ We will sleep a bit and try again.
<key name="os_list_ol7.6"><![CDATA[Oracle Linux 7.6]]></key>
<key name="os_list_ol7.7"><![CDATA[Oracle Linux 7.7]]></key>
<key name="os_list_ol7.8"><![CDATA[Oracle Linux 7.8]]></key>
<key name="os_list_ol7.9"><![CDATA[Oracle Linux 7.9]]></key>
<key name="os_list_ol8.0"><![CDATA[Oracle Linux 8.0]]></key>
<key name="os_list_ol8.1"><![CDATA[Oracle Linux 8.1]]></key>
<key name="os_list_ol8.2"><![CDATA[Oracle Linux 8.2]]></key>
<key name="os_list_ol8.3"><![CDATA[Oracle Linux 8.3]]></key>
<key name="os_list_ol8.4"><![CDATA[Oracle Linux 8.4]]></key>
<key name="os_list_ol8.5"><![CDATA[Oracle Linux 8.5]]></key>
<key name="os_list_openbsd4.2"><![CDATA[OpenBSD 4.2]]></key>
<key name="os_list_openbsd4.3"><![CDATA[OpenBSD 4.3]]></key>
<key name="os_list_openbsd4.4"><![CDATA[OpenBSD 4.4]]></key>
@ -3614,6 +3674,8 @@ We will sleep a bit and try again.
<key name="os_list_openbsd6.5"><![CDATA[OpenBSD 6.5]]></key>
<key name="os_list_openbsd6.6"><![CDATA[OpenBSD 6.6]]></key>
<key name="os_list_openbsd6.7"><![CDATA[OpenBSD 6.7]]></key>
<key name="os_list_openbsd6.8"><![CDATA[OpenBSD 6.8]]></key>
<key name="os_list_openbsd6.9"><![CDATA[OpenBSD 6.9]]></key>
<key name="os_list_opensolaris2009.06"><![CDATA[OpenSolaris 2009.06]]></key>
<key name="os_list_opensuse-factory"><![CDATA[openSUSE]]></key>
<key name="os_list_opensuse-unknown"><![CDATA[openSUSE]]></key>
@ -3632,6 +3694,7 @@ We will sleep a bit and try again.
<key name="os_list_opensuse15.0"><![CDATA[openSUSE Leap 15.0]]></key>
<key name="os_list_opensuse15.1"><![CDATA[openSUSE Leap 15.1]]></key>
<key name="os_list_opensuse15.2"><![CDATA[openSUSE Leap 15.2]]></key>
<key name="os_list_opensuse15.3"><![CDATA[openSUSE Leap 15.3]]></key>
<key name="os_list_opensuse42.1"><![CDATA[openSUSE Leap 42.1]]></key>
<key name="os_list_opensuse42.2"><![CDATA[openSUSE Leap 42.2]]></key>
<key name="os_list_opensuse42.3"><![CDATA[openSUSE Leap 42.3]]></key>
@ -3719,6 +3782,7 @@ We will sleep a bit and try again.
<key name="os_list_rhel8.2"><![CDATA[Red Hat Enterprise Linux 8.2]]></key>
<key name="os_list_rhel8.3"><![CDATA[Red Hat Enterprise Linux 8.3]]></key>
<key name="os_list_rhel8.4"><![CDATA[Red Hat Enterprise Linux 8.4]]></key>
<key name="os_list_rhel8.5"><![CDATA[Red Hat Enterprise Linux 8.5]]></key>
<key name="os_list_rhel9-unknown"><![CDATA[Red Hat Enterprise Linux 9 Unknown]]></key>
<key name="os_list_rhel9.0"><![CDATA[Red Hat Enterprise Linux 9.0]]></key>
<key name="os_list_rhl1.0"><![CDATA[Red Hat Linux 1.0]]></key>
@ -3741,6 +3805,13 @@ We will sleep a bit and try again.
<key name="os_list_rhl7.3"><![CDATA[Red Hat Linux 7.3]]></key>
<key name="os_list_rhl8.0"><![CDATA[Red Hat Linux 8.0]]></key>
<key name="os_list_rhl9"><![CDATA[Red Hat Linux 9]]></key>
<key name="os_list_rocky-unknown"><![CDATA[Rocky Linux Unknown]]></key>
<key name="os_list_rocky8-unknown"><![CDATA[Rocky Linux 8 Unknown]]></key>
<key name="os_list_rocky8.4"><![CDATA[Rocky Linux 8.4]]></key>
<key name="os_list_rocky8.5"><![CDATA[Rocky Linux 8.5]]></key>
<key name="os_list_rocky8.6"><![CDATA[Rocky Linux 8.6]]></key>
<key name="os_list_rocky9-unknown"><![CDATA[Rocky Linux 9 Unknown]]></key>
<key name="os_list_rocky9.0"><![CDATA[Rocky Linux 9.0]]></key>
<key name="os_list_scientificlinux5.0"><![CDATA[Scientific Linux 5.0]]></key>
<key name="os_list_scientificlinux5.1"><![CDATA[Scientific Linux 5.1]]></key>
<key name="os_list_scientificlinux5.10"><![CDATA[Scientific Linux 5.10]]></key>
@ -3772,14 +3843,16 @@ We will sleep a bit and try again.
<key name="os_list_scientificlinux7.4"><![CDATA[Scientific Linux 7.4]]></key>
<key name="os_list_scientificlinux7.5"><![CDATA[Scientific Linux 7.5]]></key>
<key name="os_list_scientificlinux7.6"><![CDATA[Scientific Linux 7.6]]></key>
<key name="os_list_silverblue-rawhide"><![CDATA[Fedora Silverblue Rawhide]]></key>
<key name="os_list_silverblue-unknown"><![CDATA[Fedora Silverblue]]></key>
<key name="os_list_silverblue28"><![CDATA[Fedora Silverblue 28]]></key>
<key name="os_list_silverblue29"><![CDATA[Fedora Silverblue 29]]></key>
<key name="os_list_silverblue30"><![CDATA[Fedora Silverblue 30]]></key>
<key name="os_list_silverblue31"><![CDATA[Fedora Silverblue 31]]></key>
<key name="os_list_silverblue32"><![CDATA[Fedora Silverblue 32]]></key>
<key name="os_list_silverblue-rawhide"><![CDATA[Fedora Silverblue Rawhide]]></key>
<key name="os_list_silverblue-unknown"><![CDATA[Fedora Silverblue]]></key>
<key name="os_list_silverblue33"><![CDATA[Fedora Silverblue 33]]></key>
<key name="os_list_silverblue34"><![CDATA[Fedora Silverblue 34]]></key>
<key name="os_list_silverblue35"><![CDATA[Fedora Silverblue 35]]></key>
<key name="os_list_slackware-current"><![CDATA[Slackware -current]]></key>
<key name="os_list_slackware14.2"><![CDATA[Slackware 14.2]]></key>
<key name="os_list_sle-unknown"><![CDATA[SUSE Linux Enterprise Unknown]]></key>
@ -3787,6 +3860,7 @@ We will sleep a bit and try again.
<key name="os_list_sle15-unknown"><![CDATA[SUSE Linux Enterprise 15 Unknown]]></key>
<key name="os_list_sle15sp1"><![CDATA[SUSE Linux Enterprise 15 SP1]]></key>
<key name="os_list_sle15sp2"><![CDATA[SUSE Linux Enterprise 15 SP2]]></key>
<key name="os_list_sle15sp3"><![CDATA[SUSE Linux Enterprise 15 SP3]]></key>
<key name="os_list_sled10"><![CDATA[SUSE Linux Enterprise Desktop 10]]></key>
<key name="os_list_sled10sp1"><![CDATA[SUSE Linux Enterprise Desktop 10 SP1]]></key>
<key name="os_list_sled10sp2"><![CDATA[SUSE Linux Enterprise Desktop 10 SP2]]></key>
@ -3805,6 +3879,7 @@ We will sleep a bit and try again.
<key name="os_list_sled12sp4"><![CDATA[SUSE Linux Enterprise Desktop 12 SP4]]></key>
<key name="os_list_sled12sp5"><![CDATA[SUSE Linux Enterprise Desktop 12 SP5]]></key>
<key name="os_list_sled9"><![CDATA[SUSE Linux Enterprise Desktop 9]]></key>
<key name="os_list_slem5.0"><![CDATA[SUSE Linux Enterprise Micro]]></key>
<key name="os_list_sles10"><![CDATA[SUSE Linux Enterprise Server 10]]></key>
<key name="os_list_sles10sp1"><![CDATA[SUSE Linux Enterprise Server 10 SP1]]></key>
<key name="os_list_sles10sp2"><![CDATA[SUSE Linux Enterprise Server 10 SP2]]></key>
@ -3826,6 +3901,7 @@ We will sleep a bit and try again.
<key name="os_list_solaris10"><![CDATA[Solaris 10]]></key>
<key name="os_list_solaris11"><![CDATA[Oracle Solaris 11]]></key>
<key name="os_list_solaris9"><![CDATA[Solaris 9]]></key>
<key name="os_list_trisquel9"><![CDATA[Trisquel]]></key>
<key name="os_list_ubuntu10.04"><![CDATA[Ubuntu 10.04 LTS]]></key>
<key name="os_list_ubuntu10.10"><![CDATA[Ubuntu 10.10]]></key>
<key name="os_list_ubuntu11.04"><![CDATA[Ubuntu 11.04]]></key>
@ -3846,8 +3922,10 @@ We will sleep a bit and try again.
<key name="os_list_ubuntu18.10"><![CDATA[Ubuntu 18.10]]></key>
<key name="os_list_ubuntu19.04"><![CDATA[Ubuntu 19.04]]></key>
<key name="os_list_ubuntu19.10"><![CDATA[Ubuntu 19.10]]></key>
<key name="os_list_ubuntu20.04"><![CDATA[Ubuntu 20.04]]></key>
<key name="os_list_ubuntu20.04"><![CDATA[Ubuntu 20.04 LTS]]></key>
<key name="os_list_ubuntu20.10"><![CDATA[Ubuntu 20.10]]></key>
<key name="os_list_ubuntu21.04"><![CDATA[Ubuntu 21.04]]></key>
<key name="os_list_ubuntu21.10"><![CDATA[Ubuntu 21.10]]></key>
<key name="os_list_ubuntu4.10"><![CDATA[Ubuntu 4.10]]></key>
<key name="os_list_ubuntu5.04"><![CDATA[Ubuntu 5.04]]></key>
<key name="os_list_ubuntu5.10"><![CDATA[Ubuntu 5.10]]></key>
@ -3859,6 +3937,7 @@ We will sleep a bit and try again.
<key name="os_list_ubuntu8.10"><![CDATA[Ubuntu 8.10]]></key>
<key name="os_list_ubuntu9.04"><![CDATA[Ubuntu 9.04]]></key>
<key name="os_list_ubuntu9.10"><![CDATA[Ubuntu 9.10]]></key>
<key name="os_list_unknown"><![CDATA[Unknown]]></key>
<key name="os_list_voidlinux"><![CDATA[Void Linux]]></key>
<key name="os_list_win1.0"><![CDATA[Microsoft Windows 1.0]]></key>
<key name="os_list_win10"><![CDATA[Microsoft Windows 10]]></key>
@ -3869,6 +3948,7 @@ We will sleep a bit and try again.
<key name="os_list_win2k12r2"><![CDATA[Microsoft Windows Server 2012 R2]]></key>
<key name="os_list_win2k16"><![CDATA[Microsoft Windows Server 2016]]></key>
<key name="os_list_win2k19"><![CDATA[Microsoft Windows Server 2019]]></key>
<key name="os_list_win2k22"><![CDATA[Microsoft Windows Server 2022]]></key>
<key name="os_list_win2k3"><![CDATA[Microsoft Windows Server 2003]]></key>
<key name="os_list_win2k3r2"><![CDATA[Microsoft Windows Server 2003 R2]]></key>
<key name="os_list_win2k8"><![CDATA[Microsoft Windows Server 2008]]></key>
@ -3886,7 +3966,6 @@ We will sleep a bit and try again.
<key name="os_list_winnt4.0"><![CDATA[Microsoft Windows NT Server 4.0]]></key>
<key name="os_list_winvista"><![CDATA[Microsoft Windows Vista]]></key>
<key name="os_list_winxp"><![CDATA[Microsoft Windows XP]]></key>
<key name="os_list_unknown"><![CDATA[Unknown]]></key>
</language>
<!-- 日本語 -->

@ -405,20 +405,20 @@ sub set_delay
my ($anvil) = @_;
my $delay = 7200;
my $type = $anvil->Get->host_type();
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { type => $type }});
if ($type eq "striker")
my $host_type = $anvil->Get->host_type();
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { host_type => $host_type }});
if ($host_type eq "striker")
{
foreach my $uuid (keys %{$anvil->data->{database}})
foreach my $uuid (sort {$a cmp $b} keys %{$anvil->data->{database}})
{
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => {
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
"sys::host_uuid" => $anvil->data->{sys}{host_uuid},
uuid => $uuid,
}});
if ($uuid eq $anvil->data->{sys}{host_uuid})
{
$delay = 0;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { delay => $delay }});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { delay => $delay }});
}
last;
}
@ -517,13 +517,13 @@ sub handle_periodic_tasks
my ($anvil) = @_;
my $now_time = time;
my $type = $anvil->Get->host_type();
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => {
my $host_type = $anvil->Get->host_type();
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
"s1:now_time" => $now_time,
"s2:timing::next_minute_check" => $anvil->data->{timing}{next_minute_check},
"s3:timing::next_ten_minute_check" => $anvil->data->{timing}{next_ten_minute_check},
"s4:timing::next_daily_check" => $anvil->data->{timing}{next_daily_check},
"s5:type" => $type,
"s5:host_type" => $host_type,
}});
# Time to run once per minute tasks.
@ -625,74 +625,6 @@ sub handle_periodic_tasks
# down our database.
if ($host_type eq "striker")
{
### NOTE: Database shutdown logic is disabled. Too flaky.
=cut
if ($anvil->data->{sys}{database}{connections} > 1)
{
# Make sure that all active databases are in the host's table. If they're
# not, we're still early in setup. To do this, we create an array of hosts
# and then query both/all DBs to ensure they all have all hosts.
my $all_in_hosts = 1;
my $db_hosts = [];
foreach my $uuid (sort {$a cmp $b} keys %{$anvil->data->{cache}{database_handle}})
{
push @{$db_hosts}, $uuid;
}
foreach my $db_uuid (@{$db_hosts})
{
my $query = "SELECT COUNT(*) FROM hosts WHERE host_uuid = ".$anvil->Database->quote($db_uuid).";";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
's1:db_uuid' => $db_uuid,
's2:query' => $query,
}});
foreach my $host_uuid (@{$db_hosts})
{
my $count = $anvil->Database->query({debug => 2, uuid => $db_uuid, query => $query, source => $THIS_FILE, line => __LINE__})->[0]->[0];
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
's1:host_uuid' => $host_uuid,
's2:db_uuid' => $db_uuid,
's2:count' => $count,
}});
if (not $count)
{
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "warning_0143", variables => {
db_uuid => $db_uuid,
host_uuid => $host_uuid,
}});
$all_in_hosts = 0;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { all_in_hosts => $all_in_hosts }});
}
}
}
# Sort by UUID, skip the first, and see if we're one of the others.
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { all_in_hosts => $all_in_hosts }});
if ($all_in_hosts)
{
my $first_uuid = "";
foreach my $uuid (sort {$a cmp $b} keys %{$anvil->data->{cache}{database_handle}})
{
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { uuid => $uuid }});
if (not $first_uuid)
{
$first_uuid = $uuid;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { first_uuid => $first_uuid }});
# Skip the first UUID so it doesn't evaluate for
# shutdown.
next;
}
elsif ($uuid eq $host_uuid)
{
# This won't return until we're down.
$anvil->Database->shutdown({debug => 2});
}
}
}
}
=cut
# If we're the active database, dump our database out and rsync it to our peers.
my $peers = keys %{$anvil->data->{database}};
my $connections = $anvil->data->{sys}{database}{connections};
@ -763,7 +695,7 @@ sub handle_periodic_tasks
### NOTE: We call it once/day, but this will also trigger on restart of anvil-daemon. As such, we
### don't use '--force' and let striker-manage-install-target skip the repo update if it happened
### recently enough.
if ($type eq "striker")
if ($host_type eq "striker")
{
# Age out old data. This takes up to a minute.
$anvil->Database->_age_out_data();
@ -817,7 +749,7 @@ sub handle_periodic_tasks
# Update the next check time.
$anvil->data->{timing}{next_daily_check} = $now_time + $anvil->data->{timing}{daily_checks};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => {
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
"s1:timing::daily_checks" => $anvil->data->{timing}{daily_checks},
"s2:timing::next_daily_check" => $anvil->data->{timing}{next_daily_check},
}});
@ -1378,7 +1310,7 @@ AND
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { host_type => $host_type }});
if ($host_type eq "striker")
{
$anvil->Striker->check_httpd_conf({debug => 2});
$anvil->Striker->check_httpd_conf({debug => 3});
}
return(0);

File diff suppressed because it is too large Load Diff

@ -206,9 +206,11 @@ sub update_network
my $mtu = -e $full_path."/mtu" ? $anvil->Storage->read_file({file => $full_path."/mtu"}) : 0;
my $duplex = -e $full_path."/duplex" ? $anvil->Storage->read_file({file => $full_path."/duplex"}) : "unknown"; # full or half?
my $operational = -e $full_path."/operstate" ? $anvil->Storage->read_file({file => $full_path."/operstate"}) : "unknown"; # up or down
my $modalias = -e $full_path."/device/modalias" ? $anvil->Storage->read_file({file => $full_path."/device/modalias"}) : "unknown";
my $speed = $link_state ? $anvil->Storage->read_file({file => $full_path."/speed"}) : 0; # Mbps (ie: 1000 = Gbps), gives a very high number for unplugged link
my $media = "unknown";
my $type = "interface";
my $driver = "";
# Clean up some newlines.
$link_state =~ s/\n$//;
@ -216,6 +218,7 @@ sub update_network
$duplex =~ s/\n$//;
$operational =~ s/\n$//;
$speed =~ s/\n$//;
$modalias =~ s/\n$//;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
interface => $interface,
link_state => $link_state,
@ -223,8 +226,17 @@ sub update_network
duplex => $duplex,
operational => $operational,
speed => $speed,
modalias => $modalias,
}});
### NOTE: This only parses virtio so far.
# Pick out our driver.
if ($modalias =~ /^virtio:/)
{
$driver = "virtio";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { driver => $driver }});
}
# The MAC address can faked by a number of ways, so we make an explicit call to 'ethtool' to get the permanent mac address.
my $mac_address = "";
my $shell_call = $anvil->data->{path}{exe}{ethtool}." -P ".$interface;
@ -298,13 +310,19 @@ sub update_network
# If this is a virtual interface, set some fake values that don't actually exist on
# the system for the sake of a cleaner display.
if ($mac_address =~ /^52:54:00/)
if (($mac_address =~ /^52:54:00/) or ($driver eq "virtio"))
{
### Set some fake values.
# Speed is "as fast as possible", so we'll record 100 Gbps, but that is really kind of arbitrary.
$speed = 1000 if ((not $speed) or ($speed eq "-1"));
$duplex = "full" if not $duplex;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => {
if ((not $speed) or ($speed eq "-1"))
{
$speed = 10000;
}
if ((not $duplex) or ($duplex eq "unknown"))
{
$duplex = "full";
}
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
speed => $speed,
duplex => $duplex,
}});
@ -313,7 +331,7 @@ sub update_network
if (not $link_state)
{
$speed = 0;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { speed => $speed }});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { speed => $speed }});
}
# Is this a bond interface?

@ -22,8 +22,14 @@ $| = 1;
my $anvil = Anvil::Tools->new();
# Read switches (target ([user@]host[:port]) and the file with the target's password.
$anvil->data->{switches}{new} = 0;
$anvil->data->{switches}{xml} = 0;
$anvil->Get->switches;
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 2, key => "log_0115", variables => { program => $THIS_FILE }});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
'switches::new' => $anvil->data->{switches}{new},
'switches::xml' => $anvil->data->{switches}{xml},
}});
my $words_file = $anvil->data->{path}{words}{'words.xml'};
my $language = $anvil->Words->language;
@ -50,11 +56,27 @@ foreach my $line (split/\n/, $output)
}});
my $os_key = "os_list_".$os_code;
if ($anvil->data->{switches}{new})
{
# --xml only makes sense with '--new'. Without --new, we're comparing against the
if ((not exists $anvil->data->{words}{$words_file}{language}{$language}{key}{$os_key}) or (not $anvil->data->{words}{$words_file}{language}{$language}{key}{$os_key}{content}))
{
# Print already known.
print "\t\t<key name=\"".$os_key."\"><![CDATA[".$os_name."]]></key>\n";
}
}
else
{
# Which format?
if ($anvil->data->{switches}{xml})
{
print "\t\t<key name=\"".$os_key."\"><![CDATA[".$os_name."]]></key>\n";
}
else
{
print "key=".$os_code.",name=\"".$os_name."\"\n";
}
}
}
$anvil->nice_exit({exit_code => 0});

@ -270,6 +270,14 @@ sub scan
$anvil->Network->get_ips();
my $target = "local";
my $to_scan = [];
foreach my $target (sort {$a cmp $b} keys %{$anvil->data->{network}})
{
my $is_local = $anvil->Network->is_local({host => $target});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
target => $target,
is_local => $is_local,
}});
next if not $is_local;
foreach my $interface (sort {$a cmp $b} keys %{$anvil->data->{network}{$target}{interface}})
{
my $ip = $anvil->data->{network}{$target}{interface}{$interface}{ip};
@ -299,6 +307,7 @@ sub scan
call_nmap($anvil, $address);
}
}
}
# Update the rescan time to now, if no specific network was given.
if (not $anvil->data->{switches}{network})
@ -350,7 +359,8 @@ sub call_nmap
my $this_ip = "";
my $this_mac = "";
my $section = "";
my $shell_call = $anvil->data->{path}{exe}{nmap}." -sP -T4 --min-parallelism 100 --max-parallelism 256 ".$address;
my $shell_call = $anvil->data->{path}{exe}{nmap}." -sP -T4 -n --min-parallelism 100 --max-parallelism 256 ".$address;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { shell_call => $shell_call }});
open (my $file_handle, $shell_call." 2>&1 |") or $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 0, secure => 0, priority => "err", key => "log_0014", variables => { shell_call => $shell_call, error => $! }});
while(<$file_handle>)
{

Loading…
Cancel
Save