|
|
83b9f8f |
From 165284de4e03fb72fb9e4ca811fbcc77618ff02d Mon Sep 17 00:00:00 2001
|
|
|
83b9f8f |
From: Igor Lvovsky <ilvovsky@redhat.com>
|
|
|
83b9f8f |
Date: Mon, 4 Jun 2012 11:02:56 +0300
|
|
|
83b9f8f |
Subject: [PATCH 04/17] Iterates over delete candidates networks only once
|
|
|
83b9f8f |
|
|
|
83b9f8f |
Change-Id: Iec45c1cb3d76a70555e256f96c983e13a0518cbe
|
|
|
83b9f8f |
Signed-off-by: Igor Lvovsky <ilvovsky@redhat.com>
|
|
|
83b9f8f |
Reviewed-on: http://gerrit.ovirt.org/5204
|
|
|
83b9f8f |
Reviewed-by: Livnat Peer <lpeer@redhat.com>
|
|
|
83b9f8f |
Reviewed-by: Shu Ming <shuming@linux.vnet.ibm.com>
|
|
|
83b9f8f |
Tested-by: Dan Kenigsberg <danken@redhat.com>
|
|
|
83b9f8f |
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
|
|
|
83b9f8f |
Reviewed-on: http://gerrit.ovirt.org/5546
|
|
|
83b9f8f |
Tested-by: Federico Simoncelli <fsimonce@redhat.com>
|
|
|
83b9f8f |
---
|
|
|
83b9f8f |
vdsm/configNetwork.py | 26 ++++++++++++--------------
|
|
|
83b9f8f |
1 files changed, 12 insertions(+), 14 deletions(-)
|
|
|
83b9f8f |
|
|
|
83b9f8f |
diff --git a/vdsm/configNetwork.py b/vdsm/configNetwork.py
|
|
|
83b9f8f |
index b37ff0f..3f2e5fe 100755
|
|
|
83b9f8f |
--- a/vdsm/configNetwork.py
|
|
|
83b9f8f |
+++ b/vdsm/configNetwork.py
|
|
|
83b9f8f |
@@ -1010,26 +1010,23 @@ def setupNetworks(networks={}, bondings={}, **options):
|
|
|
83b9f8f |
networksAdded = []
|
|
|
83b9f8f |
#bondingNetworks = {} # Reminder TODO
|
|
|
83b9f8f |
|
|
|
83b9f8f |
- logger.info("Setting up network")
|
|
|
83b9f8f |
- logger.debug("Setting up network according to configuration: networks:%r, bondings:%r, options:%r" % (networks, bondings, options))
|
|
|
83b9f8f |
+ logger.debug("Setting up network according to configuration: "
|
|
|
83b9f8f |
+ "networks:%r, bondings:%r, options:%r" % (networks,
|
|
|
83b9f8f |
+ bondings, options))
|
|
|
83b9f8f |
|
|
|
83b9f8f |
force = options.get('force', False)
|
|
|
83b9f8f |
if not utils.tobool(force):
|
|
|
83b9f8f |
logging.debug("Validating configuration")
|
|
|
83b9f8f |
- _validateNetworkSetup(dict(networks), dict(bondings), explicitBonding=options.get('explicitBonding', False))
|
|
|
83b9f8f |
+ _validateNetworkSetup(dict(networks), dict(bondings),
|
|
|
83b9f8f |
+ explicitBonding=options.get('explicitBonding',
|
|
|
83b9f8f |
+ False))
|
|
|
83b9f8f |
|
|
|
83b9f8f |
logger.debug("Applying...")
|
|
|
83b9f8f |
try:
|
|
|
83b9f8f |
- delnetworks = {}
|
|
|
83b9f8f |
- for network, networkAttrs in networks.iteritems():
|
|
|
83b9f8f |
+ # Remove networks with 'remove' attribute
|
|
|
83b9f8f |
+ for network, networkAttrs in networks.items():
|
|
|
83b9f8f |
if 'remove' in networkAttrs:
|
|
|
83b9f8f |
- delnetworks[network] = networkAttrs
|
|
|
83b9f8f |
-
|
|
|
83b9f8f |
- for network, networkAttrs in delnetworks.iteritems():
|
|
|
83b9f8f |
- if networkAttrs.pop('remove', False):
|
|
|
83b9f8f |
- assert not networkAttrs
|
|
|
83b9f8f |
-
|
|
|
83b9f8f |
- logger.debug('Removing network %r'%network)
|
|
|
83b9f8f |
+ logger.debug("Removing network %r" % network)
|
|
|
83b9f8f |
delNetwork(network, configWriter=configWriter, force=force)
|
|
|
83b9f8f |
del networks[network]
|
|
|
83b9f8f |
|
|
|
83b9f8f |
@@ -1041,12 +1038,13 @@ def setupNetworks(networks={}, bondings={}, **options):
|
|
|
83b9f8f |
d = dict(networkAttrs)
|
|
|
83b9f8f |
if 'bonding' in d:
|
|
|
83b9f8f |
d['nics'] = bondings[d['bonding']]['nics']
|
|
|
83b9f8f |
- d['bondingOptions'] = bondings[d['bonding']].get('options', None)
|
|
|
83b9f8f |
+ d['bondingOptions'] = bondings[d['bonding']].get('options',
|
|
|
83b9f8f |
+ None)
|
|
|
83b9f8f |
else:
|
|
|
83b9f8f |
d['nics'] = [d.pop('nic')]
|
|
|
83b9f8f |
d['force'] = force
|
|
|
83b9f8f |
|
|
|
83b9f8f |
- logger.debug('Adding network %r'%network)
|
|
|
83b9f8f |
+ logger.debug("Adding network %r" % network)
|
|
|
83b9f8f |
addNetwork(network, configWriter=configWriter, **d)
|
|
|
83b9f8f |
|
|
|
83b9f8f |
if utils.tobool(options.get('connectivityCheck', True)):
|
|
|
83b9f8f |
--
|
|
|
83b9f8f |
1.7.1
|
|
|
83b9f8f |
|