Change in vdsm[master]: net: create bond properly during start_devices
ibarkan at redhat.com
ibarkan at redhat.com
Sun Aug 9 08:56:11 UTC 2015
Ido Barkan has uploaded a new change for review.
Change subject: net: create bond properly during start_devices
......................................................................
net: create bond properly during start_devices
This methof, that is used during networks rollback, calls ifup on
all ifcfg files it knows of however, to ifup a bond, one needs to
manually create it first, by writing '+bondingName' into
/sys/class/net/bonding_masters . Ifcfg configurators already does
so when creating bonds. Skipping this step causes ifup to fail and
complain: 'Device bond11 does not seem to be present, delaying
initialization.'
This also fixes
testSetupNetworksEmergencyDevicesCleanupBondOverwrite which is
almost never run because it is a slow test.
Change-Id: Ic48f3e8b51e4e7e8668902a785c7c271ada03df6
Signed-off-by: Ido Barkan <ibarkan at redhat.com>
---
M vdsm/network/configurators/ifcfg.py
1 file changed, 18 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/87/44587/1
diff --git a/vdsm/network/configurators/ifcfg.py b/vdsm/network/configurators/ifcfg.py
index e1cb96d..84d6df7 100644
--- a/vdsm/network/configurators/ifcfg.py
+++ b/vdsm/network/configurators/ifcfg.py
@@ -464,7 +464,7 @@
self.restoreAtomicNetworkBackup()
self.restoreAtomicBackup()
- start_devices(self._backups.iterkeys())
+ start_devices(self._backups.keys())
@classmethod
def clearBackups(cls):
@@ -704,12 +704,29 @@
def start_devices(device_ifcfgs):
for dev in _sort_device_ifcfgs(device_ifcfgs):
try:
+ if _ifcfg_defines_bonding(dev, device_ifcfgs):
+ with open(netinfo.BONDING_MASTERS, 'w') as bondingMasters:
+ bondingMasters.write('+%s\n' % dev)
_exec_ifup(dev)
except ConfigNetworkError:
logging.error('Failed to ifup device %s during rollback.', dev,
exc_info=True)
+def _ifcfg_defines_bonding(device_name, all_device_ifcfgs):
+ for ifcfg in all_device_ifcfgs:
+ if ifcfg.endswith('ifcfg-%s' % device_name):
+ try:
+ with open(ifcfg) as f:
+ return bool(re.search('^BONDING_OPTS=', f.read(),
+ re.MULTILINE))
+ except IOError as e:
+ if e.errno == os.errno.ENOENT:
+ continue
+ else:
+ raise
+
+
def _sort_device_ifcfgs(device_ifcfgs):
devices = {'Bridge': [],
'Vlan': [],
--
To view, visit https://gerrit.ovirt.org/44587
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic48f3e8b51e4e7e8668902a785c7c271ada03df6
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Ido Barkan <ibarkan at redhat.com>
More information about the vdsm-patches
mailing list