* Updated scan-network to check for inactive or activating interfaces and manually bring them up, if the uptime is less than 10 minutes.

* Fixed a bug in scancore-agents/Makefile.am where scan-network was missing.
* Started work on anvil-delete-server.8. Incomplete at this time.
* Updated Network->get_ips() to record the interface status.

Signed-off-by: Digimer <digimer@alteeve.ca>
main
Digimer 2 years ago
parent 55dd28e7f1
commit 15aadc3a4e
  1. 10
      Anvil/Tools/Network.pm
  2. 2
      man/anvil-check-memory.8
  3. 2
      man/anvil-configure-host.8
  4. 32
      man/anvil-delete-server.8
  5. 4
      scancore-agents/Makefile.am
  6. 50
      scancore-agents/scan-network/scan-network
  7. 1
      share/words.xml
  8. 5
      tools/anvil-delete-server

@ -1565,10 +1565,14 @@ sub get_ips
foreach my $line (split/\n/, $output)
{
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { line => $line }});
if ($line =~ /^\d+: (.*?): /)
if ($line =~ /^\d+: (.*?): <(.*?)>/)
{
$in_iface = $1;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { in_iface => $in_iface }});
$stateus = $2;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
in_iface => $in_iface,
status => $status,
}});
$anvil->data->{network}{$host}{interface}{$in_iface}{ip} = "" if not defined $anvil->data->{network}{$host}{interface}{$in_iface}{ip};
$anvil->data->{network}{$host}{interface}{$in_iface}{subnet_mask} = "" if not defined $anvil->data->{network}{$host}{interface}{$in_iface}{subnet_mask};
@ -1579,6 +1583,7 @@ sub get_ips
$anvil->data->{network}{$host}{interface}{$in_iface}{dns} = "" if not defined $anvil->data->{network}{$host}{interface}{$in_iface}{dns};
$anvil->data->{network}{$host}{interface}{$in_iface}{tx_bytes} = 0 if not defined $anvil->data->{network}{$host}{interface}{$in_iface}{tx_bytes};
$anvil->data->{network}{$host}{interface}{$in_iface}{rx_bytes} = 0 if not defined $anvil->data->{network}{$host}{interface}{$in_iface}{rx_bytes};
$anvil->data->{network}{$host}{interface}{$in_iface}{status} = $status
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
"network::${host}::interface::${in_iface}::ip" => $anvil->data->{network}{$host}{interface}{$in_iface}{ip},
"network::${host}::interface::${in_iface}::subnet_mask" => $anvil->data->{network}{$host}{interface}{$in_iface}{subnet_mask},
@ -1587,6 +1592,7 @@ sub get_ips
"network::${host}::interface::${in_iface}::default_gateway" => $anvil->data->{network}{$host}{interface}{$in_iface}{default_gateway},
"network::${host}::interface::${in_iface}::gateway" => $anvil->data->{network}{$host}{interface}{$in_iface}{gateway},
"network::${host}::interface::${in_iface}::dns" => $anvil->data->{network}{$host}{interface}{$in_iface}{dns},
"network::${host}::interface::${in_iface}::status" => $anvil->data->{network}{$host}{interface}{$in_iface}{status},
}});
if ($in_iface ne "lo")

@ -1,4 +1,4 @@
.\" Manpage for the Anvil! server boot program
.\" Manpage for the Anvil! memory checking tool
.\" Contact mkelly@alteeve.com to report issues, concerns or suggestions.
.TH anvil-check-memory "8" "August 02 2022" "Anvil! Intelligent Availability™ Platform"
.SH NAME

@ -1,4 +1,4 @@
.\" Manpage for the Anvil! server boot program
.\" Manpage for the Anvil! host configuration program
.\" Contact mkelly@alteeve.com to report issues, concerns or suggestions.
.TH anvil-check-memory "8" "August 02 2022" "Anvil! Intelligent Availability™ Platform"
.SH NAME

@ -0,0 +1,32 @@
.\" Manpage for the Anvil! server removal tool
.\" Contact mkelly@alteeve.com to report issues, concerns or suggestions.
.TH anvil-delete-server "8" "August 02 2022" "Anvil! Intelligent Availability™ Platform"
.SH NAME
anvil-delete-server \- This program deletes a server from an Anvil! sub-cluster.
.SH SYNOPSIS
.B anvil-delete-server
\fI\,<command> \/\fR[\fI\,options\/\fR]
.SH DESCRIPTION
This deletes a server, running or stopped, from an Anvil! subcluster. The resource allocated to this server are removed and returned to the resource pool as well.
.TP
This action is permanent!
.TP
.SH OPTIONS
.TP
\-?, \-h, \fB\-\-help\fR
Show this man page.
.TP
\fB\-\-log-secure\fR
When logging, record sensitive data, like passwords.
.TP
\-v, \-vv, \-vvv
Set the log level to 1, 2 or 3 respectively. Be aware that level 3 generates a significant amount of log data.
.SS "Commands:"
.TP
\fB\-\-job-uuid\fR <name>
The program is normally run as a job, with data on how to configure the host defined in the job. This switch allows the running of a specific job. If this is not set, the program will search for a job that has not yet been picked up by another process. If found, that job UUID is used automatically.
.IP
.SH AUTHOR
Written by Madison Kelly, Alteeve staff and the Anvil! project contributors.
.SH "REPORTING BUGS"
Report bugs to users@clusterlabs.org

@ -70,6 +70,8 @@ networkdir = ${targetdir}/scan-network
dist_network_DATA = \
scan-network/scan-network.sql \
scan-network/scan-network.xml
dist_network_SCRIPTS = \
scan-network
serverdir = ${targetdir}/scan-server
dist_server_DATA = \
@ -84,3 +86,5 @@ dist_storcli_DATA = \
scan-storcli/scan-storcli.xml
dist_storcli_SCRIPTS = \
scan-storcli/scan-storcli

@ -462,6 +462,16 @@ sub collect_data
$anvil->Network->get_ips({debug => 2});
# Read the data from the ifcfg files, if available. We'll use this to check for bond interfaces that
# didn't start.
$anvil->Network->check_network();
my $uptime = $anvil->Get->uptime();
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { uptime => $uptime }});
if ($uptime < 600)
{
$anvil->Network->read_nmcli({debug => 2})
}
# The 'local_host' is needed to pull data recorded by Network->get_ips();
my $local_host = $anvil->Get->short_host_name();
my $directory = "/sys/class/net";
@ -1037,6 +1047,46 @@ sub collect_data
"new::interface::${interface}::tx_bytes" => $anvil->data->{new}{interface}{$interface}{tx_bytes}." (".$anvil->Convert->bytes_to_human_readable({'bytes' => $anvil->data->{new}{interface}{$interface}{tx_bytes}}).")",
"new::interface::${interface}::rx_bytes" => $anvil->data->{new}{interface}{$interface}{rx_bytes}." (".$anvil->Convert->bytes_to_human_readable({'bytes' => $anvil->data->{new}{interface}{$interface}{rx_bytes}}).")",
}});
# On some occassions, an interface that is in a bond won't start. If the host uptime
# is less than ten minutes, and a bond's member interface is down, up it.
if ($uptime < 600)
{
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
"nmcli::${local_host}::device_to_uuid::${interface}" => $anvil->data->{nmcli}{$local_host}{device_to_uuid}{$interface},
}});
my $uuid = $anvil->data->{nmcli}{$local_host}{device_to_uuid}{$interface};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { uuid => $uuid }});
if ($uuid)
{
my $state = $anvil->data->{nmcli}{$local_host}{uuid}{$uuid}{'state'};
my $filename = $anvil->data->{nmcli}{$local_host}{uuid}{$uuid}{filename};
my $name = ($filename =~ /ifcfg-(.*?)$/)[0];
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
filename => $filename,
name => $name,
'state' => $state,
}});
if ($state ne "active")
{
# Try brinding the interface up.
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "warning_0147", variables => {
interface => $interface,
uptime => $uptime,
}});
my $shell_call = $anvil->data->{path}{exe}{ifup}." ".$name;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { shell_call => $shell_call }});
my ($output, $return_code) = $anvil->System->call({shell_call => $shell_call});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
output => $output,
return_code => $return_code,
}});
}
}
}
}
# Record the IP address info.

@ -3265,6 +3265,7 @@ The error was:
#!variable!error!#
========
</key>
<key name="warning_0147">[ Warning ] - The interface: [#!variable!interface!#] is in a bond, but it is down. The system uptime is: [#!variable!uptime!#], so it might be a problem where the interface didn't start on boot as it should have. So we're going to bring the interface up.</key>
<!-- The entries below here are not sequential, but use a key to find the entry. -->
<!-- Run 'striker-parse-os-list to find new entries. -->

@ -29,10 +29,9 @@ my $anvil = Anvil::Tools->new();
# Read switches (target ([user@]host[:port]) and the file with the target's password. If the password is
# passed directly, it will be used. Otherwise, the password will be read from the database.
$anvil->data->{switches}{'job-uuid'} = "";
$anvil->Get->switches;
$anvil->Get->switches({list => ["job-uuid"], man => $THIS_FILE});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => $anvil->data->{switches}});
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 2, secure => 0, key => "log_0115", variables => { program => $THIS_FILE }});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { 'switches::job-uuid' => $anvil->data->{switches}{'job-uuid'} }});
$anvil->Database->connect();
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 3, secure => 0, key => "log_0132"});

Loading…
Cancel
Save