* Updated Network->collect_data() to find the GENERAL.DEVICES and
GENERAL.IP-IFACE from match.interface-name when the link is down.
* More work done on anvil-configure-host.
Signed-off-by: digimer <mkelly@alteeve.ca>
@ -753,6 +753,8 @@ The XML that failed sanity check was:
<keyname="error_0478">[ Error ] - This program must be run on a subnode.</key>
<keyname="error_0479">[ Error ] - This subnode is not in the cluster (failed to parse the CIB). Exiting.</key>
<keyname="error_0480">[ Error ] - The wanted interface: [#!variable!interface_name!#] which should have the MAC address: [#!variable!mac_address!#] was not found in Network Manager. Unable to proceed.</key>
<keyname="error_0481">[ Error ] - Failed to delete the 'connection.interface-name', got: [#!variable!output!#] and it should bhave been blank, aborting!</key>
<keyname="error_0482">[ Error ] - Failed to create the 'match.interface-name' value. Expected: [#!variable!new_name!#,#!variable!old_device!#], got: [#!variable!output!#], aborting!</key>
<!-- Files templates -->
<!-- NOTE: Translating these files requires an understanding of which lines are translatable -->
@ -3285,6 +3287,16 @@ proceeding.
- Threads per Core: [#!variable!old_threads!#] -> [#!variable!new_threads!#]
- Total Cores: .... [#!variable!old_total_cores!#] -> [#!variable!new_total_cores!#]]]></key>
<keyname="message_0382"><![CDATA[-=] Updated: #!variable!date!# - Press '<ctrl> + <c>' to exit]]></key>
<keyname="message_0383">Renaming old device/name: [#!variable!old_device!#/#!variable!old_name!#] with MAC: [#!variable!mac_address!#] to: [#!variable!new_name!#] using UUID: [#!variable!nm_uuid!#].</key>
<keyname="message_0384">- Updating the udev file: [#!variable!file!#].</key>
<keyname="message_0385">- Removing the old 'connection.interface-name': [#!variable!name!#].</key>
<keyname="message_0386">- Matching the new interface name: [#!variable!new_name!#] to the bios device name: [#!variable!old_device!#].</key>
<keyname="message_0387">- Setting the connection.id to the bios device name: [#!variable!old_device!#]</key>
<keyname="message_0388">The new interface names need a reboot to take effect.</key>
<keyname="message_0389">Rebooting NOW! The job will restart on reboot.</key>
<keyname="message_0390">Checking if the bond: [#!variable!bond_name!#] exists or not.</key>
<keyname="message_0391">- It does, its UUID is: [#!variable!nm_uuid!#].</key>
<keyname="message_0392">- The bond: [#!variable!bond_name!#] doesn't exist. Will create it using the primary interface: [#!variable!link1_name!#] (MAC: [#!variable!link1_mac!#], NM UUID: [#!variable!link1_nm_uuid!#) and the backup interface: : [#!variable!link2_name!#] (MAC: [#!variable!link2_mac!#], NM UUID: [#!variable!link2_nm_uuid!#).</key>
<!-- Translate names (protocols, etc) -->
<keyname="name_0001">Normal Password</key><!-- none in mail-server -->
# my $primary_interface = $anvil->data->{network_manager}{want}{bond}{$bond_name}{interfaces}->[0];
# if (not $primary_interface)
# {
# print "[ Error ] - There appears to be no primary interface specified for this bond!\n";
# $anvil->nice_exit({exit_code => 1});
# }
# print "- It does not, creating it with the primary interface: [".$primary_interface."] now.\n";
# my $shell_call = $anvil->data->{path}{exe}{nmcli}." connection add type bond con-name ".$bond_name." ifname ".$bond_name." bond.options \"mode=active-backup,miimon=100,downdelay=0,updelay=120000,primary=".$primary_interface."\"";
# $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,
# }});
#
# if ($return_code)
# {
# print "[ Error ] - The attempt to add the bond failed! The return code was: [".$return_code."]. The output, if any, was:\n";
# print "========\n";
# print $output."\n";
# print "========\n";
# $anvil->nice_exit({exit_code => 1});
# }
#
# my $bond_uuid = ($output =~ /\((.*?)\) successfully added/)[0];
# $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { bond_uuid => $bond_uuid }});
#
# if ($bond_uuid)
# {
# print " - Disabling DHCP on the new bond device: [".$bond_uuid."].\n";
# my ($output, $return_code) = modify_connection($anvil, $bond_uuid, "ipv4.method", "disabled");
* nmcli::uuid::<uuid>::<variable> = all 'variable: value' pairs returned by 'nmcli connection show <uuid>'
* nmcli::uuid::<uuid>::mac_address = MAC address (in lower case)
* nmcli::uuid::<uuid>::connected = 0 is down, unix timestamp (seconds since epoch) of when it connected if up.
* nmcli::uuid::<uuid>::mtu = This is the MTU (maximum transimssion unit in bytes) of the interface.
To make it easier to map a device by name or MAC address to a UUID, this lookup hash is provided. Note that 'device' is 'connection.interface-name' when available, falling back to 'GENERAL.DEVICES' otherwise.
B<< NOTE >>: An inactive interface will not report the 'connection.interface-name', and the bios device name will be returned (which is what is stored in 'GENERAL.DEVICES'. If you're trying to find a device, and the expected name doesn't exist, look up the device by MAC address. If that's not found, then the old GENERAL.DEVICES name can help you identify a replaced interface.
* nmcli::device::<device>::uuid = interface name (or device name)
* nmcli::mac_address::<mac_address>::uuid = MAC address (lower case)
Given that a single interface can have multiple IP addresses and routes, the IPs on a given interface are stored using a sequence number <1, 2, 3 ... n>. To make it easier to find what device has an IP, the IPs are stored with a quick access hash.
* nmcli::bond::<bond_device>::uuid = The UUID on the bond
* nmcli::bond::<bond_device>::carrier = 1,0 - indicates if the bond has a connection or not.
* nmcli::bond::<bond_device>::operstate = 1,0 - indicates if the bond is operational or not.
* nmcli::bond::<bond_device>::up = 1,0 - indicates if the bond up up or not.
* nmcli::bond::<bond_device>::interface::<interface>::up = 1,0 - indicates if the child interface is up or not.
Bridge data is simple, but also made easy to find. The only real data is the hash references for the interfaces connected to the bridge.
* nmcli::bridge::<device>::uuid = The UUID of the bridge
* nmcli::bridge::<device>::interface::<interface>::status = This is the link data for the connected interface (ie: 'BROADCAST,MULTICAST,MASTER,UP,LOWER_UP').
To make it easier to find interfaces, the following look up hash is available.
* nmcli::interface::<device>::uuid = The UUID of the interface
* nmcli::uuid::<uuid>::<variable> = all 'variable: value' pairs returned by 'nmcli connection show <uuid>'
* nmcli::uuid::<uuid>::mac_address = MAC address (in lower case)
* nmcli::uuid::<uuid>::connected = 0 is down, unix timestamp (seconds since epoch) of when it connected if up.
* nmcli::uuid::<uuid>::mtu = This is the MTU (maximum transimssion unit in bytes) of the interface.
To make it easier to map a device by name or MAC address to a UUID, this lookup hash is provided. Note that 'device' is 'connection.interface-name' when available, falling back to 'GENERAL.DEVICES' otherwise.
B<< NOTE >>: An inactive interface will not report the 'connection.interface-name', and the bios device name will be returned (which is what is stored in 'GENERAL.DEVICES'. If you're trying to find a device, and the expected name doesn't exist, look up the device by MAC address. If that's not found, then the old GENERAL.DEVICES name can help you identify a replaced interface.
* nmcli::device::<device>::uuid = interface name (or device name)
* nmcli::mac_address::<mac_address>::uuid = MAC address (lower case)
Given that a single interface can have multiple IP addresses and routes, the IPs on a given interface are stored using a sequence number <1, 2, 3 ... n>. To make it easier to find what device has an IP, the IPs are stored with a quick access hash.
* nmcli::bond::<bond_device>::uuid = The UUID on the bond
* nmcli::bond::<bond_device>::carrier = 1,0 - indicates if the bond has a connection or not.
* nmcli::bond::<bond_device>::operstate = 1,0 - indicates if the bond is operational or not.
* nmcli::bond::<bond_device>::up = 1,0 - indicates if the bond up up or not.
* nmcli::bond::<bond_device>::interface::<interface>::up = 1,0 - indicates if the child interface is up or not.
Bridge data is simple, but also made easy to find. The only real data is the hash references for the interfaces connected to the bridge.
* nmcli::bridge::<device>::uuid = The UUID of the bridge
* nmcli::bridge::<device>::interface::<interface>::status = This is the link data for the connected interface (ie: 'BROADCAST,MULTICAST,MASTER,UP,LOWER_UP').
To make it easier to find interfaces, the following look up hash is available.
* nmcli::interface::<device>::uuid = The UUID of the interface