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 $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 $media = "unknown";
my $type = "interface";
my $type = "interface";
my $driver = "";
my $tx_bytes = 0; # How many bytes transmitted
my $tx_bytes = 0; # How many bytes transmitted
my $rx_bytes = 0; # How many bytes received
my $rx_bytes = 0; # How many bytes received
@ -326,6 +406,7 @@ sub collect_data
$duplex =~ s/\n$//;
$duplex =~ s/\n$//;
$operational =~ s/\n$//;
$operational =~ s/\n$//;
$speed =~ s/\n$//;
$speed =~ s/\n$//;
$modalias =~ s/\n$//;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
interface => $interface,
interface => $interface,
link_state => $link_state,
link_state => $link_state,
@ -333,8 +414,17 @@ sub collect_data
duplex => $duplex,
duplex => $duplex,
operational => $operational,
operational => $operational,
speed => $speed,
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.
# 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 $mac_address = "";
my $shell_call = $anvil->data->{path}{exe}{ethtool}." -P ".$interface;
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
# 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.
# 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.
### Set some fake values.
# Speed is "as fast as possible", so we'll record 100 Gbps, but that is really kind of arbitrary.
# 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"));
if ((not $speed) or ($speed eq "-1"))
$duplex = "full" if not $duplex;
{
$speed = 10000;
}
if ((not $duplex) or ($duplex eq "unknown"))
{
$duplex = "full";
}
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
speed => $speed,
speed => $speed,
duplex => $duplex,
duplex => $duplex,
@ -885,9 +981,31 @@ ORDER BY
uuid => $bridge_uuid,
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).";";
@ -215,5 +215,6 @@ This mode is NOT supported by the Anvil! Intelligent Availability™ platform!
</key>
</key>
<keyname="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>
<keyname="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>
<keyname="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>
<keyname="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>
<keyname="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>
<keyname="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>
<keyname="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>
<keyname="error_0358">This is not a Striker host.</key>
<keyname="error_0358">This is not a Striker host.</key>
<keyname="error_0359">There are no databases available, exiting.</key>
<keyname="error_0360">Unable to find the Anvil! information for the Anvil! UUID: [#!variable!anvil_uuid!#].</key>
<keyname="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 -->
<!-- Files templates -->
<!-- NOTE: Translating these files requires an understanding of which lines are translatable -->
<!-- NOTE: Translating these files requires an understanding of which lines are translatable -->
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 $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 $media = "unknown";
my $type = "interface";
my $type = "interface";
my $driver = "";
# Clean up some newlines.
# Clean up some newlines.
$link_state =~ s/\n$//;
$link_state =~ s/\n$//;
@ -216,6 +218,7 @@ sub update_network
$duplex =~ s/\n$//;
$duplex =~ s/\n$//;
$operational =~ s/\n$//;
$operational =~ s/\n$//;
$speed =~ s/\n$//;
$speed =~ s/\n$//;
$modalias =~ s/\n$//;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
interface => $interface,
interface => $interface,
link_state => $link_state,
link_state => $link_state,
@ -223,8 +226,17 @@ sub update_network
duplex => $duplex,
duplex => $duplex,
operational => $operational,
operational => $operational,
speed => $speed,
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.
# 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 $mac_address = "";
my $shell_call = $anvil->data->{path}{exe}{ethtool}." -P ".$interface;
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
# 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.
# 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.
### Set some fake values.
# Speed is "as fast as possible", so we'll record 100 Gbps, but that is really kind of arbitrary.
# 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"));
if ((not $speed) or ($speed eq "-1"))
$duplex = "full" if not $duplex;
{
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => {
$speed = 10000;
}
if ((not $duplex) or ($duplex eq "unknown"))
{
$duplex = "full";
}
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
speed => $speed,
speed => $speed,
duplex => $duplex,
duplex => $duplex,
}});
}});
@ -313,7 +331,7 @@ sub update_network
if (not $link_state)
if (not $link_state)
{
{
$speed = 0;
$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 }});
# Read switches (target ([user@]host[:port]) and the file with the target's password.
# 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->Get->switches;
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 2, key => "log_0115", variables => { program => $THIS_FILE }});
$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 $words_file = $anvil->data->{path}{words}{'words.xml'};
my $language = $anvil->Words->language;
my $language = $anvil->Words->language;
@ -50,11 +56,27 @@ foreach my $line (split/\n/, $output)
}});
}});
my $os_key = "os_list_".$os_code;
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}))
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}))