Change in vdsm[master]: net: api: drop connectivity_check_networks

phoracek at redhat.com phoracek at redhat.com
Fri Feb 26 12:25:55 UTC 2016


Petr Horáček has uploaded a new change for review.

Change subject: net: api: drop connectivity_check_networks
......................................................................

net: api: drop connectivity_check_networks

It is not needed anymore to explicitly remove networks after failed
connectivity check, it used to be required only by implicit bondings.

Now the whole removal is handled by rollback.

New test testSetupNetworksConnectivityCheckOverExistingBond() was
introduced to test if the removed code is not needed anymore:
  # If the new added network was created on top of
  # existing bond, we need to keep the bond on rollback
  # flow, else we will break the new created bond.

With this patch testSetupNetworksConnectivityCheck() works as a
test for previous patch 5780914a98f208e70d7050e78a330ab13425639d.

Change-Id: I7bbfe2705c7165381a353d7d3effb493a1738631
Signed-off-by: Petr Horáček <phoracek at redhat.com>
---
M lib/vdsm/network/api.py
M tests/functional/networkTests.py
2 files changed, 25 insertions(+), 15 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/70/54070/1

diff --git a/lib/vdsm/network/api.py b/lib/vdsm/network/api.py
index 01cd496..6605306 100644
--- a/lib/vdsm/network/api.py
+++ b/lib/vdsm/network/api.py
@@ -694,20 +694,11 @@
                            CONNECTIVITY_TIMEOUT_DEFAULT))
 
 
-def _check_connectivity(connectivity_check_networks, networks, bondings,
-                        options, logger):
+def _check_connectivity(networks, bondings, options, logger):
     if utils.tobool(options.get('connectivityCheck', True)):
         logger.debug('Checking connectivity...')
         if not _clientSeen(_get_connectivity_timeout(options)):
             logger.info('Connectivity check failed, rolling back')
-            for network in connectivity_check_networks:
-                # If the new added network was created on top of
-                # existing bond, we need to keep the bond on rollback
-                # flow, else we will break the new created bond.
-                _delNetwork(network, ConfiguratorClass(),
-                            bypassValidation=True,
-                            implicitBonding=networks[network].
-                            get('bonding') in bondings)
             raise ConfigNetworkError(ne.ERR_LOST_CONNECTION,
                                      'connectivity check failed')
 
@@ -808,7 +799,6 @@
     libvirt_nets = netinfo_networks()
     _netinfo = CachingNetInfo(_netinfo=netinfo_get(
         libvirtNets2vdsm(libvirt_nets)))
-    connectivity_check_networks = set()
 
     logger.debug("Applying...")
     in_rollback = options.get('_inRollback', False)
@@ -846,16 +836,13 @@
                 raise ConfigNetworkError(ne.ERR_BAD_BRIDGE, "Cannot delete "
                                          "network %r: It doesn't exist in the "
                                          "system" % network)
-            else:
-                connectivity_check_networks.add(network)
 
         _bonds_setup(bondings, configurator, _netinfo, in_rollback, logger)
 
         _add_missing_networks(configurator, networks, bondings,
                               logger, _netinfo)
 
-        _check_connectivity(connectivity_check_networks, networks, bondings,
-                            options, logger)
+        _check_connectivity(networks, bondings, options, logger)
 
     hooks.after_network_setup(_buildSetupHookDict(networks, bondings, options))
 
diff --git a/tests/functional/networkTests.py b/tests/functional/networkTests.py
index 2a71e6a..8554722 100644
--- a/tests/functional/networkTests.py
+++ b/tests/functional/networkTests.py
@@ -2461,6 +2461,29 @@
         self.assertEqual(status, errors.ERR_LOST_CONNECTION)
         self.assertNetworkDoesntExist(NETWORK_NAME)
 
+    @cleanupNet
+    def testSetupNetworksConnectivityCheckOverExistingBond(self):
+        with dummyIf(2) as nics:
+            # setup initial bonding
+            status, msg = self.setupNetworks(
+                {}, {BONDING_NAME: {'nics': nics}}, NOCHK)
+            self.assertEqual(status, SUCCESS, msg)
+            self.assertBondExists(BONDING_NAME, nics[:2])
+
+            # setup a network on top of existing bond
+            status, msg = self.setupNetworks(
+                {NETWORK_NAME: {'bridged': True, 'bonding': BONDING_NAME}}, {},
+                {'connectivityCheck': True, 'connectivityTimeout': 0.1})
+            self.assertEqual(status, errors.ERR_LOST_CONNECTION)
+            self.assertNetworkDoesntExist(NETWORK_NAME)
+            self.assertBondExists(BONDING_NAME, nics[:2])
+
+            # cleanup
+            status, msg = self.vdsm_net.setupNetworks(
+                {}, {BONDING_NAME: {'remove': True}}, NOCHK)
+            self.assertEqual(status, SUCCESS, msg)
+            self.assertBondDoesntExist(BONDING_NAME, nics)
+
     @permutations([[True], [False]])
     @cleanupNet
     def testSetupNetworkOutboundQos(self, bridged):


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7bbfe2705c7165381a353d7d3effb493a1738631
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Petr Horáček <phoracek at redhat.com>


More information about the vdsm-patches mailing list