summaryrefslogtreecommitdiff
path: root/nova/tests/unit
diff options
context:
space:
mode:
authorBalazs Gibizer <balazs.gibizer@est.tech>2020-03-25 17:48:23 +0100
committerElod Illes <elod.illes@est.tech>2020-05-20 19:48:46 +0200
commite1116ee3b776ec84e4ce7d6ac9346fa0d43269b5 (patch)
treefd1ed59e3e354087154817e22a7f74d667854993 /nova/tests/unit
parent2a15e0096bc87234a930bb75b73d4874f0f7ec87 (diff)
downloadnova-e1116ee3b776ec84e4ce7d6ac9346fa0d43269b5.tar.gz
Update scheduler instance info at confirm resize
When a resize is confirmed the instance does not belong to the source compute any more. In the past the scheduler instance info is only updated by the _sync_scheduler_instance_info periodic. This caused that server boots with anti-affinity did not consider the source host. But now at the end of the confirm_resize call the compute also updates the scheduler about the move. Conflicts: nova/tests/unit/compute/test_compute_mgr.py due to Ib50b6b02208f5bd2972de8a6f8f685c19745514c and Ia6d8a7909081b0b856bd7e290e234af7e42a2b38 are missing from stable/stein Change-Id: Ic50e72e289b56ac54720ad0b719ceeb32487b8c8 Closes-Bug: #1869050 (cherry picked from commit 738110db7492b1360f5f197e8ecafd69a3b141b4) (cherry picked from commit e8b3927c92d29c74fd0c79b5a51b7a34e9d66236) (cherry picked from commit e34b375a6161b15d92beba64fa281f40634ffeab)
Diffstat (limited to 'nova/tests/unit')
-rw-r--r--nova/tests/unit/compute/test_compute_mgr.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/nova/tests/unit/compute/test_compute_mgr.py b/nova/tests/unit/compute/test_compute_mgr.py
index c28737467f..3eaff8acb6 100644
--- a/nova/tests/unit/compute/test_compute_mgr.py
+++ b/nova/tests/unit/compute/test_compute_mgr.py
@@ -7634,7 +7634,8 @@ class ComputeManagerMigrationTestCase(test.NoDBTestCase,
do_revert_resize()
do_finish_revert_resize()
- def test_confirm_resize_deletes_allocations(self):
+ def test_confirm_resize_deletes_allocations_and_update_scheduler(self):
+ @mock.patch.object(self.compute, '_delete_scheduler_instance_info')
@mock.patch('nova.objects.Instance.get_by_uuid')
@mock.patch('nova.objects.Migration.get_by_id')
@mock.patch.object(self.migration, 'save')
@@ -7646,7 +7647,8 @@ class ComputeManagerMigrationTestCase(test.NoDBTestCase,
@mock.patch.object(self.instance, 'save')
def do_confirm_resize(mock_save, mock_drop, mock_delete,
mock_confirm, mock_nwapi, mock_notify,
- mock_mig_save, mock_mig_get, mock_inst_get):
+ mock_mig_save, mock_mig_get, mock_inst_get,
+ mock_delete_scheduler_info):
self._mock_rt()
self.instance.migration_context = objects.MigrationContext(
new_pci_devices=None,
@@ -7663,6 +7665,8 @@ class ComputeManagerMigrationTestCase(test.NoDBTestCase,
mock_save.assert_called_with(expected_task_state=
[None, task_states.DELETING,
task_states.SOFT_DELETING])
+ mock_delete_scheduler_info.assert_called_once_with(
+ self.context, self.instance.uuid)
do_confirm_resize()