Igor Lvovsky has uploaded a new change for review. Change subject: Preserve MTU on bond/nic when VLAN without MTU added ......................................................................
Preserve MTU on bond/nic when VLAN without MTU added Change-Id: I48ef1ddd11ae3a9d450d55cf5c68be3b83af5b03 Signed-off-by: Igor Lvovsky <ilvov...@redhat.com> --- M vdsm/configNetwork.py 1 file changed, 16 insertions(+), 8 deletions(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/22/7322/1 diff --git a/vdsm/configNetwork.py b/vdsm/configNetwork.py index 7374ef5..199adfa 100755 --- a/vdsm/configNetwork.py +++ b/vdsm/configNetwork.py @@ -368,16 +368,23 @@ gateway=None, bootproto=None, mtu=None, onboot='yes', **kwargs): """ Create ifcfg-* file with proper fields per device """ cf = self.NET_CONF_PREF + name + # Check whether we need to preserve prev ip/mask/gateway/mtu + confParams = None + if os.path.exists(cf): + confParams = self._getConfigValue(cf, ['IPADDR', 'NETMASK', + 'GATEWAY', 'MTU']) + cfg = """DEVICE=%s\nONBOOT=%s\n""" % (pipes.quote(name), pipes.quote(onboot)) cfg += conf - # Check whether we need to preserve prev ip/mask/gateway - if not ipaddr and os.path.exists(cf): - confParams = self._getConfigValue(cf, ['IPADDR', 'NETMASK', - 'GATEWAY']) - ipaddr = confParams['IPADDR'] - netmask = confParams['NETMASK'] - gateway = confParams['GATEWAY'] + + if confParams: + if not ipaddr: + ipaddr = confParams['IPADDR'] + netmask = confParams['NETMASK'] + gateway = confParams['GATEWAY'] + if not mtu: + mtu = confParams['MTU'] if ipaddr: cfg = cfg + 'IPADDR=%s\nNETMASK=%s\n' % (pipes.quote(ipaddr), @@ -392,7 +399,8 @@ cfg = cfg + 'BOOTPROTO=%s\n' % pipes.quote(bootproto) if mtu: - cfg = cfg + 'MTU=%d\n' % mtu + cfg = cfg + 'MTU=%s\n' % mtu + cfg += 'NM_CONTROLLED=no\n' BLACKLIST = ['TYPE', 'NAME', 'DEVICE', 'bondingOptions', 'force', 'blockingdhcp', -- To view, visit http://gerrit.ovirt.org/7322 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I48ef1ddd11ae3a9d450d55cf5c68be3b83af5b03 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Igor Lvovsky <ilvov...@redhat.com> _______________________________________________ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches