From 5dc7bcee56ca4d7cad9dfe16f879cabd23192521 Mon Sep 17 00:00:00 2001 From: Muawia Khan Date: Wed, 30 Mar 2016 14:43:34 +0500 Subject: [PATCH] Remove network information from IOVisor vif IOVisor vif driver fails with some network names because of schema usage in ifc_ctl, so this changeset removes the network name along to the ifc_ctl Change-Id: If91591acd95cd965ed2b8738136f2bd3d7bc4b0b Closes-Bug: #1527370 Signed-off-by: Muawia Khan --- nova/tests/unit/virt/libvirt/test_vif.py | 15 ++++++++++++--- nova/virt/libvirt/vif.py | 12 ++++-------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/nova/tests/unit/virt/libvirt/test_vif.py b/nova/tests/unit/virt/libvirt/test_vif.py index e15fe3938523..7aa20fe3def5 100644 --- a/nova/tests/unit/virt/libvirt/test_vif.py +++ b/nova/tests/unit/virt/libvirt/test_vif.py @@ -927,15 +927,24 @@ class LibvirtVifTestCase(test.NoDBTestCase): d = vif.LibvirtGenericVIFDriver() with mock.patch.object(utils, 'execute') as execute: execute.side_effect = processutils.ProcessExecutionError - d.unplug(self.instance, self.vif_ivs) + d.unplug(self.instance, self.vif_iovisor) @mock.patch('nova.network.linux_net.device_exists') def test_plug_iovisor(self, device_exists): device_exists.return_value = True d = vif.LibvirtGenericVIFDriver() with mock.patch.object(utils, 'execute') as execute: - execute.side_effect = processutils.ProcessExecutionError - d.plug(self.instance, self.vif_ivs) + d.plug(self.instance, self.vif_iovisor) + execute.assert_has_calls([ + mock.call('ifc_ctl', 'gateway', 'add_port', + 'tap-xxx-yyy-zzz', run_as_root=True), + mock.call('ifc_ctl', 'gateway', 'ifup', + 'tap-xxx-yyy-zzz', + 'access_vm', self.vif_iovisor['id'], + self.vif_iovisor['address'], + 'pgtag2=%s' % self.vif_iovisor['network']['id'], + 'pgtag1=%s' % self.instance.project_id, + run_as_root=True)]) def test_unplug_vrouter_with_details(self): d = vif.LibvirtGenericVIFDriver() diff --git a/nova/virt/libvirt/vif.py b/nova/virt/libvirt/vif.py index 3d8aeab261dd..2b1be374b5e5 100644 --- a/nova/virt/libvirt/vif.py +++ b/nova/virt/libvirt/vif.py @@ -647,10 +647,9 @@ class LibvirtGenericVIFDriver(object): utils.execute('ifc_ctl', 'gateway', 'add_port', dev, run_as_root=True) utils.execute('ifc_ctl', 'gateway', 'ifup', dev, - 'access_vm', - vif['network']['label'] + "_" + iface_id, - vif['address'], 'pgtag2=%s' % net_id, - 'pgtag1=%s' % tenant_id, run_as_root=True) + 'access_vm', iface_id, vif['address'], + 'pgtag2=%s' % net_id, 'pgtag1=%s' % tenant_id, + run_as_root=True) except processutils.ProcessExecutionError: LOG.exception(_LE("Failed while plugging vif"), instance=instance) @@ -912,13 +911,10 @@ class LibvirtGenericVIFDriver(object): Delete network device and to their respective connection to the Virtual Domain in PLUMgrid Platform. """ - iface_id = vif['id'] dev = self.get_vif_devname(vif) try: utils.execute('ifc_ctl', 'gateway', 'ifdown', - dev, 'access_vm', - vif['network']['label'] + "_" + iface_id, - vif['address'], run_as_root=True) + dev, run_as_root=True) utils.execute('ifc_ctl', 'gateway', 'del_port', dev, run_as_root=True) linux_net.delete_net_dev(dev)