Skip to content

Commit

Permalink
Remove network information from IOVisor vif
Browse files Browse the repository at this point in the history
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
(cherry picked from commit 5dc7bce)
  • Loading branch information
Muawia Khan committed Sep 30, 2016
1 parent 81bdcef commit 50f508a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
20 changes: 12 additions & 8 deletions nova/tests/unit/virt/libvirt/test_vif.py
Original file line number Diff line number Diff line change
Expand Up @@ -900,23 +900,27 @@ def test_unplug_iovisor(self):
d = vif.LibvirtGenericVIFDriver()
with mock.patch.object(utils, 'execute') as execute:
execute.side_effect = processutils.ProcessExecutionError
mynetwork = network_model.Network(id='network-id-xxx-yyy-zzz',
label='mylabel')
myvif = network_model.VIF(id='vif-xxx-yyy-zzz',
address='ca:fe:de:ad:be:ef',
network=mynetwork)
d.unplug_iovisor(None, myvif)
d.unplug_iovisor(None, 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
instance = objects.Instance(id=1,
uuid='f0000000-0000-0000-0000-000000000001',
project_id='myproject')
d.plug_iovisor(instance, self.vif_ivs)
d.plug_iovisor(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' % instance.project_id,
run_as_root=True)])

def test_unplug_vrouter_with_details(self):
d = vif.LibvirtGenericVIFDriver()
Expand Down
12 changes: 4 additions & 8 deletions nova/virt/libvirt/vif.py
Original file line number Diff line number Diff line change
Expand Up @@ -624,10 +624,9 @@ def plug_iovisor(self, instance, vif):
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)

Expand Down Expand Up @@ -886,13 +885,10 @@ def unplug_iovisor(self, instance, vif):
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)
Expand Down

0 comments on commit 50f508a

Please sign in to comment.