Change in vdsm[master]: Separate adding libvirt network from configuring host networ...
wudxw at linux.vnet.ibm.com
wudxw at linux.vnet.ibm.com
Mon May 20 09:21:26 UTC 2013
Mark Wu has uploaded a new change for review.
Change subject: Separate adding libvirt network from configuring host network.
......................................................................
Separate adding libvirt network from configuring host network.
It makes it simpler to test the network configure functions, and
also make the code a little bit cleaner.
Change-Id: I0bb352ac7c298baa4a3e4a5cba7d23b0b033952f
Signed-off-by: Mark Wu <wudxw at linux.vnet.ibm.com>
---
M vdsm/configNetwork.py
M vdsm/netconf/ifcfg.py
M vdsm/netmodels.py
3 files changed, 14 insertions(+), 23 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/80/14880/1
diff --git a/vdsm/configNetwork.py b/vdsm/configNetwork.py
index ea749da..4ed5166 100755
--- a/vdsm/configNetwork.py
+++ b/vdsm/configNetwork.py
@@ -219,7 +219,8 @@
for nic in nics:
if nic not in vlanedIfaces:
ifdown(nic)
- netEnt.configure(network=network, **options)
+ netEnt.configure(**options)
+ configurator.configureLibvirtNetwork(network, bridged, netEnt.name)
def assertBridgeClean(bridge, vlan, bonding, nics):
diff --git a/vdsm/netconf/ifcfg.py b/vdsm/netconf/ifcfg.py
index 0855335..674814f 100644
--- a/vdsm/netconf/ifcfg.py
+++ b/vdsm/netconf/ifcfg.py
@@ -64,7 +64,7 @@
self.configWriter = None
self._libvirtAdded = set()
- def configureBridge(self, bridge, network=None, **opts):
+ def configureBridge(self, bridge, **opts):
try:
ipaddr = bridge.ip.inet.address
netmask = bridge.ip.inet.netmask
@@ -81,10 +81,8 @@
port.configure(bridge=bridge.name, **opts)
ifup(bridge.name, bootproto == 'dhcp' and
not utils.tobool(opts.get('blockingdhcp')))
- self.configWriter.createLibvirtNetwork(network, True)
- self._libvirtAdded.add(bridge.name)
- def configureVlan(self, vlan, network=None, bridge=None, **opts):
+ def configureVlan(self, vlan, bridge=None, **opts):
try:
ipaddr = vlan.ip.inet.address
netmask = vlan.ip.inet.netmask
@@ -99,12 +97,8 @@
vlan.device.configure(vlan=vlan.name, **opts)
ifup(vlan.name, bootproto == 'dhcp' and
not utils.tobool(opts.get('blockingdhcp')))
- if network:
- self.configWriter.createLibvirtNetwork(network, False, vlan.name)
- self._libvirtAdded.add(network)
- def configureBond(self, bond, network=None, bridge=None, vlan=None,
- **opts):
+ def configureBond(self, bond, bridge=None, vlan=None, **opts):
try:
ipaddr = bond.ip.inet.address
netmask = bond.ip.inet.netmask
@@ -121,12 +115,8 @@
slave.configure(bonding=bond.name, **opts)
ifup(bond.name, bootproto == 'dhcp' and
not utils.tobool(opts.get('blockingdhcp')))
- if network:
- self.configWriter.createLibvirtNetwork(network, False, bond.name)
- self._libvirtAdded.add(network)
- def configureNic(self, nic, network=None, bridge=None, bonding=None,
- vlan=None, **opts):
+ def configureNic(self, nic, bridge=None, bonding=None, vlan=None, **opts):
try:
ipaddr = nic.ip.inet.address
netmask = nic.ip.inet.netmask
@@ -141,9 +131,10 @@
if not bonding:
ifup(nic.name, bootproto == 'dhcp' and
not utils.tobool(opts.get('blockingdhcp')))
- if network:
- self.configWriter.createLibvirtNetwork(network, False, nic.name)
- self._libvirtAdded.add(network)
+
+ def configureLibvirtNetwork(self, network, bridged, iface):
+ self.configWriter.createLibvirtNetwork(network, True, iface)
+ self._libvirtAdded.add(network)
class ConfigWriter(object):
diff --git a/vdsm/netmodels.py b/vdsm/netmodels.py
index ef2d5c0..fa84e60 100644
--- a/vdsm/netmodels.py
+++ b/vdsm/netmodels.py
@@ -38,9 +38,9 @@
self.state = state
self.configurator = configurator
- def configure(self, network=None, bridge=None, bonding=None, vlan=None,
+ def configure(self, bridge=None, bonding=None, vlan=None,
**opts):
- self.configurator.configureNic(self, network=network, bridge=bridge,
+ self.configurator.configureNic(self, bridge=bridge,
bonding=bonding, vlan=vlan, **opts)
def remove(self, network=None, bond=None):
@@ -75,9 +75,8 @@
def __repr__(self):
return '.%s(%r)' % (self.tag, self.device)
- def configure(self, network=None, bridge=None, **opts):
- self.configurator.configureVlan(self, network=network, bridge=bridge,
- **opts)
+ def configure(self, bridge=None, **opts):
+ self.configurator.configureVlan(self, bridge=bridge, **opts)
def remove(self, force=False):
self.configurator.removeVlan(self.name)
--
To view, visit http://gerrit.ovirt.org/14880
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I0bb352ac7c298baa4a3e4a5cba7d23b0b033952f
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