Hunt Xu has uploaded a new change for review.

Change subject: ifcfg: Do not reconfigure existing underlaying device for VLANs
......................................................................

ifcfg: Do not reconfigure existing underlaying device for VLANs

This commit is mostly a rework of commit
948057218 (http://gerrit.ovirt.org/#/c/7259/) with the benefit from
NetReload.

Change-Id: I6a0738c32aefd6eca7fd094ad6f51d8a07353bb2
Signed-off-by: huntxu <[email protected]>
---
M vdsm/netconf/ifcfg.py
1 file changed, 4 insertions(+), 26 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/74/16474/1

diff --git a/vdsm/netconf/ifcfg.py b/vdsm/netconf/ifcfg.py
index 4ccc15d..f30b05f 100644
--- a/vdsm/netconf/ifcfg.py
+++ b/vdsm/netconf/ifcfg.py
@@ -82,7 +82,10 @@
         self.configWriter.addVlan(vlan.name, bridge=bridge, mtu=vlan.mtu,
                                   ipaddr=ipaddr, netmask=netmask,
                                   gateway=gateway, bootproto=bootproto, **opts)
-        vlan.device.configure(**opts)
+        _netinfo = netinfo.NetInfo()
+        existed_devices = _netinfo.bondings.keys() + _netinfo.nics.keys()
+        if vlan.device.name not in existed_devices:
+            vlan.device.configure(**opts)
         self._addSourceRoute(vlan, ipaddr, netmask, gateway, bootproto)
         ifup(vlan.name, async)
 
@@ -141,7 +144,6 @@
         ifdown(vlan.name)
         self._removeSourceRoute(vlan)
         self.configWriter.removeVlan(vlan.name)
-        vlan.device.remove()
 
     def _ifaceDownAndCleanup(self, iface, _netinfo):
         """Returns True iff the iface is to be removed."""
@@ -554,18 +556,6 @@
         if bridge:
             conf += 'BRIDGE=%s\n' % pipes.quote(bridge)
 
-        if netinfo.NetInfo().ifaceUsers(bonding):
-            confParams = netinfo.getIfaceCfg(bonding)
-            if not ipaddr and bootproto != 'dhcp':
-                ipaddr = confParams.get('IPADDR', None)
-                netmask = confParams.get('NETMASK', None)
-                gateway = confParams.get('GATEWAY', None)
-                bootproto = confParams.get('BOOTPROTO', None)
-            if not mtu:
-                mtu = confParams.get('MTU', None)
-                if mtu:
-                    mtu = int(mtu)
-
         self._createConfFile(conf, bonding, ipaddr, netmask, gateway,
                              bootproto, mtu, onboot, **kwargs)
 
@@ -586,18 +576,6 @@
             conf += 'BRIDGE=%s\n' % pipes.quote(bridge)
         if bonding:
             conf += 'MASTER=%s\nSLAVE=yes\n' % pipes.quote(bonding)
-
-        if _netinfo.ifaceUsers(nic):
-            confParams = netinfo.getIfaceCfg(nic)
-            if not ipaddr and bootproto != 'dhcp':
-                ipaddr = confParams.get('IPADDR', None)
-                netmask = confParams.get('NETMASK', None)
-                gateway = confParams.get('GATEWAY', None)
-                bootproto = confParams.get('BOOTPROTO', None)
-            if not mtu:
-                mtu = confParams.get('MTU', None)
-                if mtu:
-                    mtu = int(mtu)
 
         self._createConfFile(conf, nic, ipaddr, netmask, gateway,
                              bootproto, mtu, onboot, **kwargs)


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6a0738c32aefd6eca7fd094ad6f51d8a07353bb2
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Hunt Xu <[email protected]>
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to