Change in vdsm[master]: netinfo: bootproto4 is now 'dhcp'/'none' instead of a boolean

asegurap at redhat.com asegurap at redhat.com
Sun Mar 2 08:09:51 UTC 2014


Antoni Segura Puimedon has posted comments on this change.

Change subject: netinfo: bootproto4 is now 'dhcp'/'none' instead of a boolean
......................................................................


Patch Set 9:

(2 comments)

http://gerrit.ovirt.org/#/c/25170/9/lib/vdsm/netinfo.py
File lib/vdsm/netinfo.py:

Line 668:         elif dev.isVLAN():
Line 669:             d['vlans'][dev.name] = _vlaninfo(dev, ipaddrs)
Line 670: 
Line 671:     # Older Engines use BOOTPROTO=dhcp/none from ifcfg files; stay compatible
Line 672:     for netInfo in d['networks'].itervalues():
can we use netAttrs instead of netInfo. Too many things are netinfo NetInfo and netInfo in this module and I find it very confusing.
Line 673:         if netInfo['bridged']:
Line 674:             netInfo['cfg']['BOOTPROTO'] = netInfo['bootproto4']
Line 675: 
Line 676:         for devType in ('bondings', 'bridges', 'nics', 'vlans'):


Line 678: 
Line 679:             if dev:
Line 680:                 dev['cfg']['BOOTPROTO'] = netInfo['bootproto4']
Line 681:                 break
Line 682: 
I think this whole block should be moved to a helper method.

    def _cfgBootprotoCompat(nets, *devDicts):
        """Set network 'cfg' 'BOOTPROTO' for backwards engine compatibility."""
        for netAttrs in nets.itervalues():
            if netAttrs['bridged']:
                netAttrs['cfg']['BOOTPROTO'] = netAttrs['bootproto4']
    
            for dev, devAttrs in ((dev, devAttrs) for (dev, devAttrs) in chain(
                    *[devDict.iteritems() for devDict in devDicts])):
                if dev == netAttrs['iface']:
                    devAttrs['cfg']['BOOTPROTO'] = netAttrs['bootproto4']
                    break

Which could be called like:
    _cfgBootprotoCompat(d['networks'], d['bridges'], d['vlans'], d['bondings'],
                        d['nics'])
Line 683:     return d
Line 684: 
Line 685: 
Line 686: def isVlanned(dev):


-- 
To view, visit http://gerrit.ovirt.org/25170
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Iaef31f93da978a5793fceae28763ceafedb8d3b6
Gerrit-PatchSet: 9
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Ondřej Svoboda <osvoboda at redhat.com>
Gerrit-Reviewer: Antoni Segura Puimedon <asegurap at redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Ondřej Svoboda <osvoboda at redhat.com>
Gerrit-Reviewer: automation at ovirt.org
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes


More information about the vdsm-patches mailing list