Change in vdsm[master]: network: persistence: skip bonds owned and used by vdsm

danken at redhat.com danken at redhat.com
Wed Mar 11 17:38:35 UTC 2015


Dan Kenigsberg has posted comments on this change.

Change subject: network: persistence: skip bonds owned and used by vdsm
......................................................................


Patch Set 3: Code-Review-1

(3 comments)

https://gerrit.ovirt.org/#/c/38587/3/lib/vdsm/tool/unified_persistence.py
File lib/vdsm/tool/unified_persistence.py:

Line 128: 
Line 129:     netinfo = NetInfo()
Line 130:     networks = _processNetworks(netinfo)
Line 131:     bonds = _processBondings(netinfo)
Line 132: 
I don't like adding O(N*B) complexity when we can have O(N+B)

used_bonds = set(
  attr['bonding'] for attr in networks.keys()
  if 'bonding' in attr)
Line 133:     # Filter out non-owned and non-used bonds
Line 134:     for bonding in bonds.keys():
Line 135:         if not _owned(bonding) and not _used(networks, bonding):
Line 136:             del bonds[bonding]


Line 140: attributes.get('bonding')
it is perfectly valid for attributes.get('bonding') to return None (if the net is nicless or depends on a nic).

Add

  bond = attributes.get('bonding')
  if bond is None: # no bond dependency
     continue


Line 137: 
Line 138:     # Test if networks' bonds are persited
Line 139:     for network, attributes in networks.iteritems():
Line 140:         if attributes.get('bonding') not in bonds:
Line 141:             raise Exception('Network %s miss its bonds', network)
please use % instead of "," - this is not a log message

Also, please include the bond name in the text.

 raise Exception('Network %s depends on missing bond %s' %( network, attributes.get('bonding'))
Line 142: 
Line 143:     return networks, bonds
Line 144: 
Line 145: 


-- 
To view, visit https://gerrit.ovirt.org/38587
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Idb643a0c3681631db7bd875a03ebdb91fd893e70
Gerrit-PatchSet: 3
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Petr Horáček <phoracek at redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Ido Barkan <ibarkan at redhat.com>
Gerrit-Reviewer: Petr Horáček <phoracek at redhat.com>
Gerrit-Reviewer: automation at ovirt.org
Gerrit-HasComments: Yes


More information about the vdsm-patches mailing list