* Added strings for making size suffixes translatable and updated Convert->bytes_to_human_readable to use them.

* Fixed a bug in tools/anvil-update-states where the MAC of an interface that is the backup in an active-backup bond would be the MAC of the active member instead of its real MAC.
* Fixed a bug in Convert->add_commas() where a passed in value of '0' returned an empty string.

Signed-off-by: Digimer <digimer@alteeve.ca>
main
Digimer 5 years ago
parent b9e8d2a971
commit 7cf1db3b37
  1. 75
      Anvil/Tools/Convert.pm
  2. 11
      Anvil/Tools/Database.pm
  3. 20
      Anvil/Tools/Network.pm
  4. 17
      share/words.xml
  5. 6
      tools/anvil-update-states

@ -125,7 +125,7 @@ sub add_commas
return ($number); return ($number);
} }
local($_) = $whole ? $whole : ""; local($_) = defined $whole ? $whole : "";
1 while s/^(-?\d+)(\d{3})/$1,$2/; 1 while s/^(-?\d+)(\d{3})/$1,$2/;
$whole = $_; $whole = $_;
@ -249,53 +249,53 @@ sub bytes_to_human_readable
{ {
# Yebibyte # Yebibyte
$human_readable_size = sprintf("%.3f", ($human_readable_size /= (2 ** 80))); $human_readable_size = sprintf("%.3f", ($human_readable_size /= (2 ** 80)));
$suffix = "YiB"; $suffix = $anvil->Words->string({key => "suffix_0030"});
} }
elsif ($unit =~ /Z/i) elsif ($unit =~ /Z/i)
{ {
# Zebibyte # Zebibyte
$human_readable_size = sprintf("%.3f", ($human_readable_size /= (2 ** 70))); $human_readable_size = sprintf("%.3f", ($human_readable_size /= (2 ** 70)));
$suffix = "ZiB"; $suffix = $anvil->Words->string({key => "suffix_0029"});
} }
elsif ($unit =~ /E/i) elsif ($unit =~ /E/i)
{ {
# Exbibyte # Exbibyte
$human_readable_size = sprintf("%.3f", ($human_readable_size /= (2 ** 60))); $human_readable_size = sprintf("%.3f", ($human_readable_size /= (2 ** 60)));
$suffix = "EiB"; $suffix = $anvil->Words->string({key => "suffix_0028"});
} }
elsif ($unit =~ /P/i) elsif ($unit =~ /P/i)
{ {
# Pebibyte # Pebibyte
$human_readable_size = sprintf("%.3f", ($human_readable_size /= (2 ** 50))); $human_readable_size = sprintf("%.3f", ($human_readable_size /= (2 ** 50)));
$suffix = "PiB"; $suffix = $anvil->Words->string({key => "suffix_0027"});
} }
elsif ($unit =~ /T/i) elsif ($unit =~ /T/i)
{ {
# Tebibyte # Tebibyte
$human_readable_size = sprintf("%.2f", ($human_readable_size /= (2 ** 40))); $human_readable_size = sprintf("%.2f", ($human_readable_size /= (2 ** 40)));
$suffix = "TiB"; $suffix = $anvil->Words->string({key => "suffix_0026"});
} }
elsif ($unit =~ /G/i) elsif ($unit =~ /G/i)
{ {
# Gibibyte # Gibibyte
$human_readable_size = sprintf("%.2f", ($human_readable_size /= (2 ** 30))); $human_readable_size = sprintf("%.2f", ($human_readable_size /= (2 ** 30)));
$suffix = "GiB"; $suffix = $anvil->Words->string({key => "suffix_0025"});
} }
elsif ($unit =~ /M/i) elsif ($unit =~ /M/i)
{ {
# Mebibyte # Mebibyte
$human_readable_size = sprintf("%.2f", ($human_readable_size /= (2 ** 20))); $human_readable_size = sprintf("%.2f", ($human_readable_size /= (2 ** 20)));
$suffix = "MiB"; $suffix = $anvil->Words->string({key => "suffix_0024"});
} }
elsif ($unit =~ /K/i) elsif ($unit =~ /K/i)
{ {
# Kibibyte # Kibibyte
$human_readable_size = sprintf("%.1f", ($human_readable_size /= (2 ** 10))); $human_readable_size = sprintf("%.1f", ($human_readable_size /= (2 ** 10)));
$suffix = "KiB"; $suffix = $anvil->Words->string({key => "suffix_0023"});
} }
else else
{ {
$suffix = "B"; $suffix = $anvil->Words->string({key => "suffix_0014"});
} }
} }
else else
@ -305,53 +305,53 @@ sub bytes_to_human_readable
{ {
# Yebibyte # Yebibyte
$human_readable_size = sprintf("%.3f", ($human_readable_size /= (2 ** 80))); $human_readable_size = sprintf("%.3f", ($human_readable_size /= (2 ** 80)));
$suffix = "YiB"; $suffix = $anvil->Words->string({key => "suffix_0030"});
} }
elsif ($human_readable_size >= (2 ** 70)) elsif ($human_readable_size >= (2 ** 70))
{ {
# Zebibyte # Zebibyte
$human_readable_size = sprintf("%.3f", ($human_readable_size /= (2 ** 70))); $human_readable_size = sprintf("%.3f", ($human_readable_size /= (2 ** 70)));
$suffix = "ZiB"; $suffix = $anvil->Words->string({key => "suffix_0029"});
} }
elsif ($human_readable_size >= (2 ** 60)) elsif ($human_readable_size >= (2 ** 60))
{ {
# Exbibyte # Exbibyte
$human_readable_size = sprintf("%.3f", ($human_readable_size /= (2 ** 60))); $human_readable_size = sprintf("%.3f", ($human_readable_size /= (2 ** 60)));
$suffix = "EiB"; $suffix = $anvil->Words->string({key => "suffix_0028"});
} }
elsif ($human_readable_size >= (2 ** 50)) elsif ($human_readable_size >= (2 ** 50))
{ {
# Pebibyte # Pebibyte
$human_readable_size = sprintf("%.3f", ($human_readable_size /= (2 ** 50))); $human_readable_size = sprintf("%.3f", ($human_readable_size /= (2 ** 50)));
$suffix = "PiB"; $suffix = $anvil->Words->string({key => "suffix_0027"});
} }
elsif ($human_readable_size >= (2 ** 40)) elsif ($human_readable_size >= (2 ** 40))
{ {
# Tebibyte # Tebibyte
$human_readable_size = sprintf("%.2f", ($human_readable_size /= (2 ** 40))); $human_readable_size = sprintf("%.2f", ($human_readable_size /= (2 ** 40)));
$suffix = "TiB"; $suffix = $anvil->Words->string({key => "suffix_0026"});
} }
elsif ($human_readable_size >= (2 ** 30)) elsif ($human_readable_size >= (2 ** 30))
{ {
# Gibibyte # Gibibyte
$human_readable_size = sprintf("%.2f", ($human_readable_size /= (2 ** 30))); $human_readable_size = sprintf("%.2f", ($human_readable_size /= (2 ** 30)));
$suffix = "GiB"; $suffix = $anvil->Words->string({key => "suffix_0025"});
} }
elsif ($human_readable_size >= (2 ** 20)) elsif ($human_readable_size >= (2 ** 20))
{ {
# Mebibyte # Mebibyte
$human_readable_size = sprintf("%.2f", ($human_readable_size /= (2 ** 20))); $human_readable_size = sprintf("%.2f", ($human_readable_size /= (2 ** 20)));
$suffix = "MiB"; $suffix = $anvil->Words->string({key => "suffix_0024"});
} }
elsif ($human_readable_size >= (2 ** 10)) elsif ($human_readable_size >= (2 ** 10))
{ {
# Kibibyte # Kibibyte
$human_readable_size = sprintf("%.1f", ($human_readable_size /= (2 ** 10))); $human_readable_size = sprintf("%.1f", ($human_readable_size /= (2 ** 10)));
$suffix = "KiB"; $suffix = $anvil->Words->string({key => "suffix_0023"});
} }
else else
{ {
$suffix = "B"; $suffix = $anvil->Words->string({key => "suffix_0014"});
} }
} }
} }
@ -365,53 +365,53 @@ sub bytes_to_human_readable
{ {
# Yottabyte # Yottabyte
$human_readable_size = sprintf("%.3f", ($human_readable_size /= (10 ** 24))); $human_readable_size = sprintf("%.3f", ($human_readable_size /= (10 ** 24)));
$suffix = "YB"; $suffix = $anvil->Words->string({key => "suffix_0022"});
} }
elsif ($unit =~ /Z/i) elsif ($unit =~ /Z/i)
{ {
# Zettabyte # Zettabyte
$human_readable_size = sprintf("%.3f", ($human_readable_size /= (10 ** 21))); $human_readable_size = sprintf("%.3f", ($human_readable_size /= (10 ** 21)));
$suffix = "ZB"; $suffix = $anvil->Words->string({key => "suffix_0021"});
} }
elsif ($unit =~ /E/i) elsif ($unit =~ /E/i)
{ {
# Exabyte # Exabyte
$human_readable_size = sprintf("%.3f", ($human_readable_size /= (10 ** 18))); $human_readable_size = sprintf("%.3f", ($human_readable_size /= (10 ** 18)));
$suffix = "EB"; $suffix = $anvil->Words->string({key => "suffix_0020"});
} }
elsif ($unit =~ /P/i) elsif ($unit =~ /P/i)
{ {
# Petabyte # Petabyte
$human_readable_size = sprintf("%.3f", ($human_readable_size /= (10 ** 15))); $human_readable_size = sprintf("%.3f", ($human_readable_size /= (10 ** 15)));
$suffix = "PB"; $suffix = $anvil->Words->string({key => "suffix_0019"});
} }
elsif ($unit =~ /T/i) elsif ($unit =~ /T/i)
{ {
# Terabyte # Terabyte
$human_readable_size = sprintf("%.2f", ($human_readable_size /= (10 ** 12))); $human_readable_size = sprintf("%.2f", ($human_readable_size /= (10 ** 12)));
$suffix = "TB"; $suffix = $anvil->Words->string({key => "suffix_0018"});
} }
elsif ($unit =~ /G/i) elsif ($unit =~ /G/i)
{ {
# Gigabyte # Gigabyte
$human_readable_size = sprintf("%.2f", ($human_readable_size /= (10 ** 9))); $human_readable_size = sprintf("%.2f", ($human_readable_size /= (10 ** 9)));
$suffix = "GB"; $suffix = $anvil->Words->string({key => "suffix_0017"});
} }
elsif ($unit =~ /M/i) elsif ($unit =~ /M/i)
{ {
# Megabyte # Megabyte
$human_readable_size = sprintf("%.2f", ($human_readable_size /= (10 ** 6))); $human_readable_size = sprintf("%.2f", ($human_readable_size /= (10 ** 6)));
$suffix = "MB"; $suffix = $anvil->Words->string({key => "suffix_0016"});
} }
elsif ($unit =~ /K/i) elsif ($unit =~ /K/i)
{ {
# Kilobyte # Kilobyte
$human_readable_size = sprintf("%.1f", ($human_readable_size /= (10 ** 3))); $human_readable_size = sprintf("%.1f", ($human_readable_size /= (10 ** 3)));
$suffix = "KB"; $suffix = $anvil->Words->string({key => "suffix_0015"});
} }
else else
{ {
$suffix = "b"; $suffix = $anvil->Words->string({key => "suffix_0014"});
} }
} }
else else
@ -421,53 +421,54 @@ sub bytes_to_human_readable
{ {
# Yottabyte # Yottabyte
$human_readable_size = sprintf("%.3f", ($human_readable_size /= (10 ** 24))); $human_readable_size = sprintf("%.3f", ($human_readable_size /= (10 ** 24)));
$suffix = "YB"; $suffix = $anvil->Words->string({key => "suffix_0022"});
} }
elsif ($human_readable_size >= (10 ** 21)) elsif ($human_readable_size >= (10 ** 21))
{ {
# Zettabyte # Zettabyte
$human_readable_size = sprintf("%.3f", ($human_readable_size /= (10 ** 21))); $human_readable_size = sprintf("%.3f", ($human_readable_size /= (10 ** 21)));
$suffix = "ZB"; $suffix = $anvil->Words->string({key => "suffix_0021"});
} }
elsif ($human_readable_size >= (10 ** 18)) elsif ($human_readable_size >= (10 ** 18))
{ {
# Exabyte # Exabyte
$human_readable_size = sprintf("%.3f", ($human_readable_size /= (10 ** 18))); $human_readable_size = sprintf("%.3f", ($human_readable_size /= (10 ** 18)));
$suffix = "EB"; $suffix = $anvil->Words->string({key => "suffix_0020"});
} }
elsif ($human_readable_size >= (10 ** 15)) elsif ($human_readable_size >= (10 ** 15))
{ {
# Petabyte # Petabyte
$human_readable_size = sprintf("%.3f", ($human_readable_size /= (10 ** 15))); $human_readable_size = sprintf("%.3f", ($human_readable_size /= (10 ** 15)));
$suffix = "PB"; $suffix = $anvil->Words->string({key => "suffix_0019"});
} }
elsif ($human_readable_size >= (10 ** 12)) elsif ($human_readable_size >= (10 ** 12))
{ {
# Terabyte # Terabyte
$human_readable_size = sprintf("%.2f", ($human_readable_size /= (10 ** 12))); $human_readable_size = sprintf("%.2f", ($human_readable_size /= (10 ** 12)));
$suffix = "TB"; $suffix = $anvil->Words->string({key => "suffix_0018"});
} }
elsif ($human_readable_size >= (10 ** 9)) elsif ($human_readable_size >= (10 ** 9))
{ {
# Gigabyte # Gigabyte
$human_readable_size = sprintf("%.2f", ($human_readable_size /= (10 ** 9))); $human_readable_size = sprintf("%.2f", ($human_readable_size /= (10 ** 9)));
$suffix = "GB"; $suffix = $anvil->Words->string({key => "suffix_0017"});
} }
elsif ($human_readable_size >= (10 ** 6)) elsif ($human_readable_size >= (10 ** 6))
{ {
# Megabyte # Megabyte
$human_readable_size = sprintf("%.2f", ($human_readable_size /= (10 ** 6))); $human_readable_size = sprintf("%.2f", ($human_readable_size /= (10 ** 6)));
$suffix = "MB"; $suffix = $anvil->Words->string({key => "suffix_0016"});
} }
elsif ($human_readable_size >= (10 ** 3)) elsif ($human_readable_size >= (10 ** 3))
{ {
# Kilobyte # Kilobyte
$human_readable_size = sprintf("%.1f", ($human_readable_size /= (10 ** 3))); $human_readable_size = sprintf("%.1f", ($human_readable_size /= (10 ** 3)));
$suffix = "KB"; $suffix = $anvil->Words->string({key => "suffix_0015"});
} }
else else
{ {
$suffix = "b"; # Bytes
$suffix = $anvil->Words->string({key => "suffix_0014"});
} }
} }
} }

@ -4437,7 +4437,16 @@ sub insert_or_update_network_interfaces
{ {
# See if I know this NIC by referencing it's MAC and name. The name is needed because virtual # See if I know this NIC by referencing it's MAC and name. The name is needed because virtual
# devices can share the MAC with the real interface. # devices can share the MAC with the real interface.
my $query = "SELECT network_interface_uuid FROM network_interfaces WHERE network_interface_mac_address = ".$anvil->Database->quote($network_interface_mac_address)." AND network_interface_name = ".$anvil->Database->quote($network_interface_name).";"; my $query = "
SELECT
network_interface_uuid
FROM
network_interfaces
WHERE
network_interface_mac_address = ".$anvil->Database->quote($network_interface_mac_address)."
AND
network_interface_name = ".$anvil->Database->quote($network_interface_name)."
;";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }});
$network_interface_uuid = $anvil->Database->query({uuid => $uuid, query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__})->[0]->[0]; $network_interface_uuid = $anvil->Database->query({uuid => $uuid, query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__})->[0]->[0];

@ -805,10 +805,10 @@ FROM
AND AND
bond_host_uuid = ".$anvil->Database->quote($host_uuid)." bond_host_uuid = ".$anvil->Database->quote($host_uuid)."
;"; ;";
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 3, key => "log_0124", variables => { query => $query }}); $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 $results = $anvil->Database->query({query => $query, source => $THIS_FILE, line => __LINE__});
my $count = @{$results}; my $count = @{$results};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
results => $results, results => $results,
count => $count, count => $count,
}}); }});
@ -893,10 +893,10 @@ WHERE
AND AND
bridge_host_uuid = ".$anvil->Database->quote($host_uuid)." bridge_host_uuid = ".$anvil->Database->quote($host_uuid)."
;"; ;";
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 3, key => "log_0124", variables => { query => $query }}); $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => $debug, key => "log_0124", variables => { query => $query }});
$results = $anvil->Database->query({query => $query, source => $THIS_FILE, line => __LINE__}); $results = $anvil->Database->query({query => $query, source => $THIS_FILE, line => __LINE__});
$count = @{$results}; $count = @{$results};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
results => $results, results => $results,
count => $count, count => $count,
}}); }});
@ -966,10 +966,10 @@ AND
ORDER BY ORDER BY
modified_date DESC modified_date DESC
;"; ;";
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 3, key => "log_0124", variables => { query => $query }}); $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => $debug, key => "log_0124", variables => { query => $query }});
$results = $anvil->Database->query({query => $query, source => $THIS_FILE, line => __LINE__}); $results = $anvil->Database->query({query => $query, source => $THIS_FILE, line => __LINE__});
$count = @{$results}; $count = @{$results};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
results => $results, results => $results,
count => $count, count => $count,
}}); }});
@ -991,11 +991,19 @@ ORDER BY
if (($network_interface_bond_uuid) && (defined $anvil->data->{network}{$host}{bond_uuid}{$network_interface_bond_uuid}{name})) if (($network_interface_bond_uuid) && (defined $anvil->data->{network}{$host}{bond_uuid}{$network_interface_bond_uuid}{name}))
{ {
$bond_name = $anvil->data->{network}{$host}{bond_uuid}{$network_interface_bond_uuid}{name}; $bond_name = $anvil->data->{network}{$host}{bond_uuid}{$network_interface_bond_uuid}{name};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
network_interface_name => $network_interface_name,
bond_name => $bond_name,
}});
push @{$anvil->data->{network}{$host}{interface}{$bond_name}{interfaces}}, $network_interface_name; push @{$anvil->data->{network}{$host}{interface}{$bond_name}{interfaces}}, $network_interface_name;
} }
if (($network_interface_bridge_uuid) && (defined $anvil->data->{network}{$host}{bridge_uuid}{$network_interface_bridge_uuid}{name})) if (($network_interface_bridge_uuid) && (defined $anvil->data->{network}{$host}{bridge_uuid}{$network_interface_bridge_uuid}{name}))
{ {
$bridge_name = $anvil->data->{network}{$host}{bridge_uuid}{$network_interface_bridge_uuid}{name}; $bridge_name = $anvil->data->{network}{$host}{bridge_uuid}{$network_interface_bridge_uuid}{name};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
network_interface_name => $network_interface_name,
bridge_name => $bridge_name,
}});
push @{$anvil->data->{network}{$host}{interface}{$bridge_name}{interfaces}}, $network_interface_name; push @{$anvil->data->{network}{$host}{interface}{$bridge_name}{interfaces}}, $network_interface_name;
} }
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {

@ -1029,6 +1029,15 @@ If you are comfortable that the target has changed for a known reason, you can s
<key name="suffix_0045">Exbibytes</key> <!-- Long suffix for 'exbibyte' (1,152,921,504,606,846,976 bytes). --> <key name="suffix_0045">Exbibytes</key> <!-- Long suffix for 'exbibyte' (1,152,921,504,606,846,976 bytes). -->
<key name="suffix_0046">Zebibytes</key> <!-- Long suffix for 'zebibyte' (1,180,591,620,717,411,303,424 bytes). --> <key name="suffix_0046">Zebibytes</key> <!-- Long suffix for 'zebibyte' (1,180,591,620,717,411,303,424 bytes). -->
<key name="suffix_0047">Yobibytes</key> <!-- Long suffix for 'yobibyte' (1,208,925,819,614,629,174,706,176 bytes). --> <key name="suffix_0047">Yobibytes</key> <!-- Long suffix for 'yobibyte' (1,208,925,819,614,629,174,706,176 bytes). -->
<key name="suffix_0048">bps</key> <!-- Short suffix for 'bits per second'. -->
<key name="suffix_0049">Kbps</key> <!-- Short suffix for 'kilobits per second' (1,000 bits per second). -->
<key name="suffix_0050">Mbps</key> <!-- Short suffix for 'megabits per second' (1,000,000 bits per second). -->
<key name="suffix_0051">Gbps</key> <!-- Short suffix for 'gigabits per second' (1,000,000,000 bits per second). -->
<key name="suffix_0052">Tbps</key> <!-- Short suffix for 'terabits per second' (1,000,000,000,000 bits per second). -->
<key name="suffix_0053">Pbps</key> <!-- Short suffix for 'petabits per second' (1,000,000,000,000,000 bits per second). -->
<key name="suffix_0054">Ebps</key> <!-- Short suffix for 'exabits per second' (1,000,000,000,000,000,000 bits per second). -->
<key name="suffix_0055">Zbps</key> <!-- Short suffix for 'zettabits per second' (1,000,000,000,000,000,000,000 bits per second). -->
<key name="suffix_0056">Ybps</key> <!-- Short suffix for 'yotabits per second' (1,000,000,000,000,000,000,000,000 bits per second). -->
<key name="prefix_0001">[ Error ] - </key> <key name="prefix_0001">[ Error ] - </key>
<key name="prefix_0002">[ Warning ] - </key> <key name="prefix_0002">[ Warning ] - </key>
@ -1250,6 +1259,14 @@ Failed to generate an RSA public key for the user: [#!variable!user!#]. The outp
<key name="unit_0002">No</key> <key name="unit_0002">No</key>
<key name="unit_0003">None</key> <key name="unit_0003">None</key>
<key name="unit_0004">Unknown</key> <key name="unit_0004">Unknown</key>
<key name="unit_0005"><![CDATA[<none>]]></key>
<key name="unit_0006">Balance Round-Robin</key> <!-- Bonding mode 0 (balance-rr) - See: /usr/share/doc/iputils/README.bonding -->
<key name="unit_0007">Active/Backup</key> <!-- Bonding mode 1 (active-backup) -->
<key name="unit_0008">Balanced Exclusive OR</key> <!-- Bonding mode 2 (balanced-xor) -->
<key name="unit_0009">Broadcast</key> <!-- Bonding mode 3 (broadcast) -->
<key name="unit_0010">Dynamic Link Aggregation (802.3ad)</key> <!-- Bonding mode 4 (802.3ad) -->
<key name="unit_0011">Balanced Transmit Load balancing</key> <!-- Bonding mode 5 (balanced-tlb) -->
<key name="unit_0012">Balanced Adaptive Load balancing</key> <!-- Bonding mode 6 (balanced-alb) -->
<!-- TODO: Merge these into 'unit' --> <!-- TODO: Merge these into 'unit' -->
<!-- These are works and strings used by javascript/jqery --> <!-- These are works and strings used by javascript/jqery -->

@ -87,6 +87,12 @@ sub update_network
my $media = "unknown"; my $media = "unknown";
my $type = "interface"; my $type = "interface";
# If the NIC is a bond member, the MAC address could be virtual.
if (-e $full_path."/bonding_slave/perm_hwaddr")
{
$mac_address = $anvil->Storage->read_file({file => $full_path."/bonding_slave/perm_hwaddr"});
}
# Clean up some newlines. # Clean up some newlines.
$mac_address =~ s/\n$//; $mac_address =~ s/\n$//;
$link_state =~ s/\n$//; $link_state =~ s/\n$//;

Loading…
Cancel
Save