Change in vdsm[master]: network: No need to call setupNetworks with empty arguments ...

ibarkan at redhat.com ibarkan at redhat.com
Thu Mar 26 07:16:06 UTC 2015


Ido Barkan has uploaded a new change for review.

Change subject: network: No need to call setupNetworks with empty arguments during network restoration
......................................................................

network: No need to call setupNetworks with empty arguments during network
restoration

Lets not trust setupNetwork implementation so that it is really a no-op when
called with empty input.

Change-Id: I0241e7379f799e65bbeba3e13a288e52e5dbc734
Signed-off-by: Ido Barkan <ibarkan at redhat.com>
---
M vdsm/vdsm-restore-net-config
1 file changed, 13 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/14/39214/1

diff --git a/vdsm/vdsm-restore-net-config b/vdsm/vdsm-restore-net-config
index 2fdba11..9bfd7a8 100755
--- a/vdsm/vdsm-restore-net-config
+++ b/vdsm/vdsm-restore-net-config
@@ -58,10 +58,13 @@
         removeNetworks[network] = {'remove': True}
     for bond in runningConfig.bonds:
         removeBonds[bond] = {'remove': True}
-    logging.debug('Removing all networks (%s) and bonds (%s) in running '
-                  'config.', removeNetworks, removeBonds)
-    setupNetworks(removeNetworks, removeBonds, connectivityCheck=False,
-                  _inRollback=True)
+    if removeNetworks or removeBonds:
+        logging.debug('Removing all networks (%s) and bonds (%s) in running '
+                      'config.', removeNetworks, removeBonds)
+        setupNetworks(removeNetworks, removeBonds, connectivityCheck=False,
+                      _inRollback=True)
+    else:
+        logging.debug('runningConfig is empty. Nothing to remove')
 
     # Flush vdsm configurations left-overs from any configurator on the system
     # so that changes of configurator and persistence system are smooth.
@@ -75,9 +78,12 @@
     persistentConfig = PersistentConfig()
     nets, bonds = _filter_nets_bonds(persistentConfig.networks,
                                      persistentConfig.bonds)
-    logging.debug('Calling setupNetworks with networks (%s) and bond (%s).',
-                  nets, bonds)
-    setupNetworks(nets, bonds, connectivityCheck=False, _inRollback=True)
+    if nets or bonds:
+        logging.debug('Calling setupNetworks with networks '
+                      '(%s) and bond (%s).', nets, bonds)
+        setupNetworks(nets, bonds, connectivityCheck=False, _inRollback=True)
+    else:
+        logging.debug('Nothing to restore')
 
 
 def _filter_nets_bonds(nets, bonds):


-- 
To view, visit https://gerrit.ovirt.org/39214
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0241e7379f799e65bbeba3e13a288e52e5dbc734
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Ido Barkan <ibarkan at redhat.com>


More information about the vdsm-patches mailing list