Antoni Segura Puimedon has uploaded a new change for review. Change subject: net: skip network restoration if its physical devs are missing ......................................................................
net: skip network restoration if its physical devs are missing When performing network restoration on boot it is important that the operation configures as many networks as it can and that the operation does not fail so that vdsm can start. In case a device breaks down, it is possible that the host had other networks configured that would still allow remote access after reboot. This patch allows this use case by filtering out bond and net configuration depending on missing physical devices. It also introduces error level logs to make it very apparent when troubleshooting. Bug-Url: https://bugzilla.redhat.com/1113091 Change-Id: I9f1370696f2398fe2c3cd9ad92424b126bcd4b7c Signed-off-by: Antoni S. Puimedon <[email protected]> --- M vdsm/vdsm-restore-net-config 1 file changed, 33 insertions(+), 0 deletions(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/13/29313/1 diff --git a/vdsm/vdsm-restore-net-config b/vdsm/vdsm-restore-net-config index 7adfcac..9f08871 100755 --- a/vdsm/vdsm-restore-net-config +++ b/vdsm/vdsm-restore-net-config @@ -22,6 +22,7 @@ import logging.config from vdsm.config import config +from vdsm import netinfo # Ifcfg persistence restoration from network.configurators import ifcfg @@ -63,6 +64,38 @@ persistentConfig = PersistentConfig() nets = persistentConfig.networks bonds = persistentConfig.bonds + + # Filter out nets and bonds that use devices which are not present + available_nics = netinfo.nics() + unavailable_bonds = {} + for bond, attrs in bonds.items(): + unavailable_bond_nics = any(nic for nic in attrs['nics'] if + nic in available_nics) + if unavailable_bond_nics: + unavailable_bonds[bond] = bonds.pop(bond) + + for net, attrs in nets.items(): + bond = attrs.get('bonding') + if bond is not None: + if bond in unavailable_bonds: + logging.error('Some of the nics required by bond "%s" (%s) ' + 'are missing. Network "%s" will not be ' + 'configured as a consequence' % + (bond, unavailable_bonds[bond]['nics'], net)) + del nets[net] + else: + continue + + nic = attrs.get('nic') + if nic is not None: + if nic not in available_nics: + logging.error('Nic "%s" required by network %s is missing. ' + 'The network will not be configured' % + (nic, net)) + del nets[net] + else: + continue + logging.debug('Calling setupNetworks with networks (%s) and bond (%s).', nets, bonds) setupNetworks(nets, bonds, connectivityCheck=False, _inRollback=True) -- To view, visit http://gerrit.ovirt.org/29313 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I9f1370696f2398fe2c3cd9ad92424b126bcd4b7c Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Antoni Segura Puimedon <[email protected]> _______________________________________________ vdsm-patches mailing list [email protected] https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
