Ido Barkan has uploaded a new change for review. Change subject: net: support strings for 'bridged' in kernelConfig ......................................................................
net: support strings for 'bridged' in kernelConfig Because kernelConfig did not know how to normalize this parameter in running config, _should_keep_bridged got wrong parameters if setupNetworks edited a network with 'bridged': 'false'. This resulted in a bridge being left behind after the network was removed. Change-Id: Ib6eb36e69c14c752712ed16d86ed5dd37007f7b7 Signed-off-by: Ido Barkan <ibar...@redhat.com> --- M lib/vdsm/netconfpersistence.py M tests/functional/networkTests.py 2 files changed, 25 insertions(+), 2 deletions(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/46/43446/1 diff --git a/lib/vdsm/netconfpersistence.py b/lib/vdsm/netconfpersistence.py index b8de93d..02deb8c 100644 --- a/lib/vdsm/netconfpersistence.py +++ b/lib/vdsm/netconfpersistence.py @@ -326,9 +326,11 @@ def _normalize_bridge(self, config_copy): for net_attr in config_copy.networks.itervalues(): - if net_attr.get('bridged', True): + if utils.tobool(net_attr.get('bridged', True)): net_attr['bridged'] = True self._normalize_stp(net_attr) + else: + net_attr['bridged'] = False def _normalize_stp(self, net_attr): stp = net_attr.pop('stp', net_attr.pop('STP', None)) diff --git a/tests/functional/networkTests.py b/tests/functional/networkTests.py index adc7d1c..3edc2bc 100644 --- a/tests/functional/networkTests.py +++ b/tests/functional/networkTests.py @@ -1491,7 +1491,28 @@ self.assertEquals(status, SUCCESS, msg) self.vdsm_net.save_config() - + + @cleanupNet + @RequireDummyMod + @ValidateRunningAsRoot + def testRemovingBridgeDoesNotLeaveBridge(self): + with dummyIf(1) as nics: + nic, = nics + status, msg = self.setupNetworks( + {NETWORK_NAME: {'nic': nic, 'STP': 'no', 'bridged': 'true', + 'mtu': 1500}}, {}, NOCHK) + self.assertEquals(status, SUCCESS, msg) + bridge = ipwrapper.getLink(NETWORK_NAME) + status, msg = self.setupNetworks( + {NETWORK_NAME: {'nic': nic, 'bridged': 'false', 'mtu': 1500}}, + {}, NOCHK) + self.assertEquals(status, SUCCESS, msg) + self.assertNotIn( + bridge.name, (l.name for l in ipwrapper.getLinks())) + status, msg = self.setupNetworks( + {NETWORK_NAME: {'remove': True}}, {}, NOCHK) + self.assertEquals(status, SUCCESS, msg) + @cleanupNet @RequireDummyMod @ValidateRunningAsRoot -- To view, visit https://gerrit.ovirt.org/43446 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ib6eb36e69c14c752712ed16d86ed5dd37007f7b7 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: ovirt-3.5 Gerrit-Owner: Ido Barkan <ibar...@redhat.com> _______________________________________________ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches