Change in vdsm[master]: Extend setupNetworks API to accept defaultRoute

amuller at redhat.com amuller at redhat.com
Sun Jan 12 11:35:19 UTC 2014


Assaf Muller has posted comments on this change.

Change subject: Extend setupNetworks API to accept defaultRoute
......................................................................


Patch Set 1:

(5 comments)

....................................................
File lib/vdsm/tool/unified_persistence.py
Line 71
Line 72
Line 73
Line 74
Line 75
Notice that I only assign into networks[network]['bootproto'] if bootproto == 'dhcp'


Line 36:                   UPGRADE_NAME, networks, bondings)
Line 37:     _persist(networks, bondings)
Line 38: 
Line 39: 
Line 40: def _ifcfgFilter(filter, value):
Filter like audio filters you can pass on sound waves... Something that changes the output, not necessarily filtering out values. Anyway, if 'filter' has a very specific connotation in Python I'll change it.
Line 41:     """
Line 42:     If value is in the dict and hashable - Get its filtered value.
Line 43:     Otherwise: Return the original value
Line 44:     :param filter: Dictionary of 'from' -> 'to'


Line 54: def _toIfcfgFormat(value):
Line 55:     return _ifcfgFilter({'on': 'yes', 'off': 'no'}, value)
Line 56: 
Line 57: 
Line 58: def _fromIfcfgFormat(value):
I'll make the function assume that it can only expect 'yes' and 'no', but I find 'fromIfcfgFormat' vastly more expressive and clear than 'yesnoToBool'. It explains why the line of code exists, and not what it does.
Line 59:     return _ifcfgFilter({'yes': True, 'no': False}, value)
Line 60: 
Line 61: 
Line 62: def _getNetInfo():


Line 95:                     networks[network]['netmask'] = netParams['netmask']
Line 96:                 if netParams['gateway'] != '':
Line 97:                     networks[network]['gateway'] = netParams['gateway']
Line 98: 
Line 99:             networks[network]['defaultRoute'] = _fromIfcfgFormat(
I just noticed that this bit is wrong...

What we really want is to persist defaultRoute=True only for the management network (IE: Emulate proper engine behavior).
Line 100:                 ifcfg.get('DEFROUTE', False))
Line 101: 
Line 102:             # What if the 'physical device' is actually a VLAN?
Line 103:             if physicalDevice in netinfo.vlans:


....................................................
File vdsm/configNetwork.py
Line 253
Line 254
Line 255
Line 256
Line 257
Done


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I9b2ff711155eb0bd79ab84e979eb82c846362374
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Assaf Muller <amuller at redhat.com>
Gerrit-Reviewer: Antoni Segura Puimedon <asegurap at redhat.com>
Gerrit-Reviewer: Assaf Muller <amuller at redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Moti Asayag <masayag at redhat.com>
Gerrit-Reviewer: Yaniv Bronhaim <ybronhei at redhat.com>
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes


More information about the vdsm-patches mailing list