Revert "Removing workaround"
It was identified that there are certain conditions which can cause
issues here and still need this workaround. It is believed that these
can be replicated with the libvirt driver and bug 1560468 will be
updated to reflect it.
Sridhar Venkat is to own validating that issue with the libvirt driver
and pursuing a global fix. Until then we will revert this 'removing
workaround' to add it back in.
This reverts commit ea4dcbb3cc.
Conflicts:
nova_powervm/tests/virt/powervm/tasks/test_network.py
Change-Id: I20febda537130da03cac03a75876fda173a99d71
This commit is contained in:
@@ -212,10 +212,13 @@ class TestNetwork(test.TestCase):
|
||||
# Run method
|
||||
p_vifs = tf_net.PlugVifs(mock.MagicMock(), self.apt, inst, net_info,
|
||||
'host_uuid', 'slot_mgr')
|
||||
p_vifs.execute(self.mock_lpar_wrap)
|
||||
with mock.patch.object(inst, 'save') as mock_inst_save:
|
||||
p_vifs.execute(self.mock_lpar_wrap)
|
||||
|
||||
# The create should have only been called once.
|
||||
self.assertEqual(1, mock_plug.call_count)
|
||||
# Should have called save to save the new host and then changed it back
|
||||
self.assertEqual(2, mock_inst_save.call_count)
|
||||
self.assertEqual('host1', inst.host)
|
||||
|
||||
@mock.patch('nova_powervm.virt.powervm.vif.plug')
|
||||
@@ -243,11 +246,14 @@ class TestNetwork(test.TestCase):
|
||||
# Run method
|
||||
p_vifs = tf_net.PlugVifs(mock.MagicMock(), self.apt, inst, net_info,
|
||||
'host_uuid', 'slot_mgr')
|
||||
self.assertRaises(exception.VirtualInterfaceCreateException,
|
||||
p_vifs.execute, self.mock_lpar_wrap)
|
||||
with mock.patch.object(inst, 'save') as mock_inst_save:
|
||||
self.assertRaises(exception.VirtualInterfaceCreateException,
|
||||
p_vifs.execute, self.mock_lpar_wrap)
|
||||
|
||||
# The create should have only been called once.
|
||||
self.assertEqual(1, mock_plug.call_count)
|
||||
# Should have called save to save the new host and then changed it back
|
||||
self.assertEqual(2, mock_inst_save.call_count)
|
||||
self.assertEqual('host1', inst.host)
|
||||
|
||||
@mock.patch('nova_powervm.virt.powervm.vif.unplug')
|
||||
|
||||
@@ -153,6 +153,22 @@ class PlugVifs(task.Task):
|
||||
instance=self.instance)
|
||||
raise exception.VirtualInterfaceCreateException()
|
||||
|
||||
# TODO(KYLEH): We're setting up to wait for an instance event. The
|
||||
# event needs to come back to our compute manager so we need to ensure
|
||||
# the instance.host is set to our host. We shouldn't need to do this
|
||||
# but in the evacuate/recreate case it may reflect the old host.
|
||||
# See: https://bugs.launchpad.net/nova/+bug/1535918
|
||||
undo_host_change = False
|
||||
if self.instance.host != CONF.host:
|
||||
LOG.warning(_LW('Instance was not assigned to this host. '
|
||||
'It was assigned to: %s'), self.instance.host,
|
||||
instance=self.instance)
|
||||
# Update the instance...
|
||||
old_host = self.instance.host
|
||||
self.instance.host = CONF.host
|
||||
self.instance.save()
|
||||
undo_host_change = True
|
||||
|
||||
# For the VIFs, run the creates (and wait for the events back)
|
||||
try:
|
||||
with self.virt_api.wait_for_instance_event(
|
||||
@@ -172,6 +188,12 @@ class PlugVifs(task.Task):
|
||||
'%(sys)s'), {'sys': self.instance.name},
|
||||
instance=self.instance)
|
||||
raise exception.VirtualInterfaceCreateException()
|
||||
finally:
|
||||
if undo_host_change:
|
||||
LOG.info(_LI('Undoing temporary host assignment to instance.'),
|
||||
instance=self.instance)
|
||||
self.instance.host = old_host
|
||||
self.instance.save()
|
||||
|
||||
# Return the list of created VIFs.
|
||||
return cna_w_list
|
||||
|
||||
Reference in New Issue
Block a user