summaryrefslogtreecommitdiff
path: root/ironic/tests/unit/drivers/modules/network/test_common.py
diff options
context:
space:
mode:
authorJulia Kreger <juliaashleykreger@gmail.com>2018-03-26 21:06:20 -0700
committerJim Rollenhagen <jim@jimrollenhagen.com>2018-04-12 08:18:44 -0400
commit3a4e259a3714cedcad567e229e983f1b559c2668 (patch)
tree9cd7cba2f74379dc5f4949ab67281ea716df2f5b /ironic/tests/unit/drivers/modules/network/test_common.py
parent9143ec7bafa6c7e4007a35675467b6434c6f9b73 (diff)
downloadironic-3a4e259a3714cedcad567e229e983f1b559c2668.tar.gz
Remove vifs upon teardown
Since we removed the ability for nova to cleanly remove the vif during teardown because that created a race condition, the removal of all vif attachment records only seems to be the right thing to do since we can't realistically change nova try harder, and functionally we are otherwise looking at massive locking changes. Removing vif records is the lesser evil until we can reach consensus on completely revamping locking to allow for greater concurrency. Change-Id: I8d683d2d506c97535b5a8f9a5de4c070c7e887df Story: #1743652 Task: #9275
Diffstat (limited to 'ironic/tests/unit/drivers/modules/network/test_common.py')
-rw-r--r--ironic/tests/unit/drivers/modules/network/test_common.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/ironic/tests/unit/drivers/modules/network/test_common.py b/ironic/tests/unit/drivers/modules/network/test_common.py
index a64fc348f..70f3b1307 100644
--- a/ironic/tests/unit/drivers/modules/network/test_common.py
+++ b/ironic/tests/unit/drivers/modules/network/test_common.py
@@ -935,6 +935,20 @@ class TestNeutronVifPortIDMixin(db_base.DbTestCase):
@mock.patch.object(common.VIFPortIDMixin, '_clear_vif_from_port_like_obj')
@mock.patch.object(neutron_common, 'unbind_neutron_port', autospec=True)
@mock.patch.object(common.VIFPortIDMixin, '_get_port_like_obj_by_vif_id')
+ def test_vif_detach_deleting_node(self, mock_get, mock_unp, mock_clear):
+ self.node.provision_state = states.DELETING
+ self.node.save()
+ mock_get.return_value = self.port
+ with task_manager.acquire(self.context, self.node.id) as task:
+ self.interface.vif_detach(task, 'fake_vif_id')
+ mock_unp.assert_called_once_with('fake_vif_id',
+ context=task.context)
+ mock_get.assert_called_once_with(task, 'fake_vif_id')
+ mock_clear.assert_called_once_with(self.port)
+
+ @mock.patch.object(common.VIFPortIDMixin, '_clear_vif_from_port_like_obj')
+ @mock.patch.object(neutron_common, 'unbind_neutron_port', autospec=True)
+ @mock.patch.object(common.VIFPortIDMixin, '_get_port_like_obj_by_vif_id')
def test_vif_detach_active_node_failure(self, mock_get, mock_unp,
mock_clear):
self.node.provision_state = states.ACTIVE