Change in vdsm[master]: network: persistence: skip bonds owned and used by vdsm
phoracek at redhat.com
phoracek at redhat.com
Wed Mar 11 14:58:44 UTC 2015
Petr Horáček has uploaded a new change for review.
Change subject: network: persistence: skip bonds owned and used by vdsm
......................................................................
network: persistence: skip bonds owned and used by vdsm
Change-Id: Idb643a0c3681631db7bd875a03ebdb91fd893e70
Signed-off-by: Petr Horáček <phoracek at redhat.com>
---
M lib/vdsm/tool/unified_persistence.py
1 file changed, 22 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/87/38587/1
diff --git a/lib/vdsm/tool/unified_persistence.py b/lib/vdsm/tool/unified_persistence.py
index 802d4c5..3d16aa1 100644
--- a/lib/vdsm/tool/unified_persistence.py
+++ b/lib/vdsm/tool/unified_persistence.py
@@ -115,7 +115,7 @@
bondings = {}
for bonding, bondingParams in netinfo.bondings.iteritems():
# If the bond is unused, skip it
- if not bondingParams['slaves'] or not _owned(bonding):
+ if not bondingParams['slaves']:
continue
bondings[bonding] = {'nics': bondingParams['slaves']}
@@ -127,6 +127,20 @@
return bondings
netinfo = NetInfo()
+ networks = _processNetworks(netinfo)
+ bonds = _processBondings(netinfo)
+
+ # Filter out non-owned and non-used bonds
+ for bonding in bonds.keys():
+ if not _owned(bonding) and not _used(networks, bonding):
+ del bonds[bonding]
+
+ # Test if networks' bonds are persited
+ for network in networks:
+ if network.get('bonding'):
+ if network['bonding'] not in bonds:
+ raise Exception('FUUUU')
+
return _processNetworks(netinfo), _processBondings(netinfo)
@@ -144,6 +158,13 @@
runningConfig.store()
+def _used(networks, bonding):
+ for network in networks:
+ if network.get('bonding') == bonding:
+ return True
+ return False
+
+
def _owned(devname):
try:
with open(NET_CONF_PREF + devname) as conf:
--
To view, visit https://gerrit.ovirt.org/38587
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Idb643a0c3681631db7bd875a03ebdb91fd893e70
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Petr Horáček <phoracek at redhat.com>
More information about the vdsm-patches
mailing list