Change in vdsm[master]: netconf: Simplify addSourceRoute arguments

wudxw at linux.vnet.ibm.com wudxw at linux.vnet.ibm.com
Thu Aug 15 09:56:25 UTC 2013


Mark Wu has uploaded a new change for review.

Change subject: netconf: Simplify addSourceRoute arguments
......................................................................

netconf: Simplify addSourceRoute arguments

Change-Id: I1bf06f865abbed8cf1fdcca909cbf78c6e5f66f4
Signed-off-by: Mark Wu <wudxw at linux.vnet.ibm.com>
---
M vdsm/netconf/__init__.py
M vdsm/netconf/ifcfg.py
2 files changed, 10 insertions(+), 13 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/68/18168/1

diff --git a/vdsm/netconf/__init__.py b/vdsm/netconf/__init__.py
index 4936fda..5513448 100644
--- a/vdsm/netconf/__init__.py
+++ b/vdsm/netconf/__init__.py
@@ -75,7 +75,8 @@
     def removeLibvirtNetwork(self, network):
         self.configApplier.removeLibvirtNetwork(network)
 
-    def _addSourceRoute(self, netEnt, ipaddr, netmask, gateway, bootproto):
+    def _addSourceRoute(self, netEnt):
+        ipaddr, netmask, gateway, bootproto, _, _ = netEnt.ipConfig
         # bootproto is None for both static and no bootproto
         if bootproto != 'dhcp' and netEnt.master is None:
             logging.debug("Adding source route %s, %s, %s, %s" %
diff --git a/vdsm/netconf/ifcfg.py b/vdsm/netconf/ifcfg.py
index eb47255..41bbc1e 100644
--- a/vdsm/netconf/ifcfg.py
+++ b/vdsm/netconf/ifcfg.py
@@ -60,31 +60,28 @@
             self._libvirtAdded = set()
 
     def configureBridge(self, bridge, **opts):
-        ipaddr, netmask, gateway, bootproto, async, _ = bridge.ipConfig
         self.configApplier.addBridge(bridge, **opts)
         ifdown(bridge.name)
         if bridge.port:
             bridge.port.configure(**opts)
-        self._addSourceRoute(bridge, ipaddr, netmask, gateway, bootproto)
-        ifup(bridge.name, async)
+        self._addSourceRoute(bridge)
+        ifup(bridge.name, bridge.ipConfig.async)
 
     def configureVlan(self, vlan, **opts):
-        ipaddr, netmask, gateway, bootproto, async, _ = vlan.ipConfig
         self.configApplier.addVlan(vlan, **opts)
         vlan.device.configure(**opts)
-        self._addSourceRoute(vlan, ipaddr, netmask, gateway, bootproto)
-        ifup(vlan.name, async)
+        self._addSourceRoute(vlan)
+        ifup(vlan.name, vlan.ipConfig.async)
 
     def configureBond(self, bond, **opts):
-        ipaddr, netmask, gateway, bootproto, async, _ = bond.ipConfig
         self.configApplier.addBonding(bond, **opts)
         if not netinfo.isVlanned(bond.name):
             for slave in bond.slaves:
                 ifdown(slave.name)
         for slave in bond.slaves:
             slave.configure(**opts)
-        self._addSourceRoute(bond, ipaddr, netmask, gateway, bootproto)
-        ifup(bond.name, async)
+        self._addSourceRoute(bond)
+        ifup(bond.name, bond.ipConfig.async)
 
     def editBonding(self, bond, _netinfo):
         ifdown(bond.name)
@@ -96,13 +93,12 @@
         self.configureBond(bond)
 
     def configureNic(self, nic, **opts):
-        ipaddr, netmask, gateway, bootproto, async, _ = nic.ipConfig
         self.configApplier.addNic(nic, **opts)
-        self._addSourceRoute(nic, ipaddr, netmask, gateway, bootproto)
+        self._addSourceRoute(nic)
         if nic.bond is None:
             if not netinfo.isVlanned(nic.name):
                 ifdown(nic.name)
-            ifup(nic.name, async)
+            ifup(nic.name, nic.ipConfig.async)
 
     def removeBridge(self, bridge):
         DynamicSourceRoute.addInterfaceTracking(bridge)


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1bf06f865abbed8cf1fdcca909cbf78c6e5f66f4
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Mark Wu <wudxw at linux.vnet.ibm.com>


More information about the vdsm-patches mailing list