Merge "Update scheduler instance info at confirm resize" into stable/stein
This commit is contained in:
commit
333ba44450
|
@ -4181,6 +4181,10 @@ class ComputeManager(manager.Manager):
|
|||
# allocations in placement, delete them here.
|
||||
self._delete_allocation_after_move(
|
||||
context, instance, migration)
|
||||
# Also as the instance is not any more on this host, update
|
||||
# the scheduler about the move
|
||||
self._delete_scheduler_instance_info(
|
||||
context, instance.uuid)
|
||||
|
||||
do_confirm_resize(context, instance, migration.id)
|
||||
|
||||
|
|
|
@ -371,7 +371,7 @@ class ServerGroupTestV21(ServerGroupTestBase):
|
|||
self.assertNotEqual(servers[0]['OS-EXT-SRV-ATTR:host'],
|
||||
migrated_server['OS-EXT-SRV-ATTR:host'])
|
||||
|
||||
def test_migrate_with_anti_affinity_stale_scheduler_instance_info(self):
|
||||
def test_migrate_with_anti_affinity_confirm_updates_scheduler(self):
|
||||
# Start additional host to test migration with anti-affinity
|
||||
compute3 = self.start_service('compute', host='host3')
|
||||
|
||||
|
@ -400,23 +400,12 @@ class ServerGroupTestV21(ServerGroupTestBase):
|
|||
self.admin_api.post_server_action(servers[1]['id'], post)
|
||||
self._wait_for_state_change(self.admin_api, servers[1], 'ACTIVE')
|
||||
|
||||
# NOTE(gibi): This is bug 1869050. The confirm resize does to update
|
||||
# the scheduler instance info so the migrate_server occupies two host
|
||||
# according to the stale information in the scheduler.
|
||||
# Alternatively waiting for the periodic _sync_scheduler_instance_info
|
||||
# call would update the stale data.
|
||||
server3 = self._boot_a_server_to_group(created_group)
|
||||
|
||||
server3 = self._boot_a_server_to_group(
|
||||
created_group, expected_status='ERROR')
|
||||
self.assertIn('No valid host', server3['fault']['message'])
|
||||
|
||||
# When bug 1869050 is fixed the following is expected:
|
||||
# server3 = self._boot_a_server_to_group(created_group)
|
||||
#
|
||||
# # we have 3 servers that should occupy 3 different hosts
|
||||
# hosts = {server['OS-EXT-SRV-ATTR:host']
|
||||
# for server in [servers[0], migrated_server, server3]}
|
||||
# self.assertEqual(3, len(hosts))
|
||||
# we have 3 servers that should occupy 3 different hosts
|
||||
hosts = {server['OS-EXT-SRV-ATTR:host']
|
||||
for server in [servers[0], migrated_server, server3]}
|
||||
self.assertEqual(3, len(hosts))
|
||||
|
||||
def test_resize_to_same_host_with_anti_affinity(self):
|
||||
self.flags(allow_resize_to_same_host=True)
|
||||
|
|
|
@ -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()
|
||||
|
||||
|
|
Loading…
Reference in New Issue