Merge "Route shared storage RPC to evac dest at startup"

This commit is contained in:
Zuul 2024-11-06 18:45:13 +00:00 committed by Gerrit Code Review
commit 3b530ac15b
4 changed files with 13 additions and 13 deletions

View File

@ -826,8 +826,9 @@ class ComputeManager(manager.Manager):
context, instance)
bdi = self._get_instance_block_device_info(context,
instance)
evac = evacuations[instance.uuid]
destroy_disks = not (self._is_instance_storage_shared(
context, instance))
context, instance, host=evac.dest_compute))
except exception.InstanceNotFound:
network_info = network_model.NetworkInfo()
bdi = {}

View File

@ -14,7 +14,6 @@ import fixtures
import threading
from oslo_log import log as logging
from oslo_messaging import MessagingTimeout
from nova.tests.functional.libvirt import base
@ -128,12 +127,5 @@ class TestComputeStartupInProgressEvacuation(
# finishes
contd.set()
# This is bug 2085975 as the shared storage check fails with exception
# and therefore nova defaults to not cleaning up the local disk of the
# instance.
self.assertEqual(MessagingTimeout, type(rpc_exception))
# when host is not passed rpc defaults to instance.host
self.assertIsNone(rpc_target_host)
# when fixed it should not fail
# self.assertIsNone(rpc_exception)
# self.assertEqual('compute2', rpc_target_host)
self.assertIsNone(rpc_exception)
self.assertEqual('compute2', rpc_target_host)

View File

@ -7667,6 +7667,7 @@ class ComputeTestCase(BaseTestCase,
migration = objects.Migration(instance_uuid=evacuated_instance.uuid)
migration.source_node = NODENAME
migration.dest_compute = "dest-host"
mock_get_filter.return_value = [migration]
instances.append(evacuated_instance)
mock_get_inst.return_value = instances
@ -7694,7 +7695,8 @@ class ComputeTestCase(BaseTestCase,
mock_get_inst.assert_called_once_with(fake_context)
mock_get_nw.assert_called_once_with(fake_context, evacuated_instance)
mock_get_blk.assert_called_once_with(fake_context, evacuated_instance)
mock_is_inst.assert_called_once_with(fake_context, evacuated_instance)
mock_is_inst.assert_called_once_with(
fake_context, evacuated_instance, host='dest-host')
mock_destroy.assert_called_once_with(fake_context, evacuated_instance,
'fake_network_info',
'fake_bdi', False)
@ -7739,6 +7741,7 @@ class ComputeTestCase(BaseTestCase,
migration = objects.Migration(instance_uuid=evacuated_instance.uuid)
migration.source_node = NODENAME
migration.dest_compute = 'dest-host'
mock_get_filter.return_value = [migration]
instances.append(evacuated_instance)
mock_get_drv.return_value = instances
@ -7765,7 +7768,7 @@ class ComputeTestCase(BaseTestCase,
mock_check.assert_called_once_with(fake_context,
{'filename': 'tmpfilename'},
instance=evacuated_instance,
host=None)
host='dest-host')
mock_check_clean.assert_called_once_with(fake_context,
{'filename': 'tmpfilename'})
mock_destroy.assert_called_once_with(fake_context, evacuated_instance,
@ -7811,6 +7814,7 @@ class ComputeTestCase(BaseTestCase,
migration = objects.Migration(instance_uuid=evacuated_instance.uuid)
migration.source_node = NODENAME
migration.dest_compute = 'dest-host'
mock_get_filter.return_value = [migration]
instances.append(evacuated_instance)
mock_get_inst.return_value = instances

View File

@ -5086,6 +5086,7 @@ class ComputeManagerUnitTestCase(test.NoDBTestCase,
# Consider the migration successful
migration.status = 'done'
migration.source_node = 'fake-node'
migration.dest_compute = 'dest-host'
node_cache = {
uuids.our_node_uuid:
@ -5151,11 +5152,13 @@ class ComputeManagerUnitTestCase(test.NoDBTestCase,
# compute was down
migration_1.status = 'done'
migration_1.source_node = 'deleted-node'
migration_1.dest_compute = 'dest-host'
migration_2 = objects.Migration(instance_uuid=instance_2.uuid)
# Consider the migration successful
migration_2.status = 'done'
migration_2.source_node = 'fake-node'
migration_2.dest_compute = 'dest-host'
node_cache = {
uuids.our_node_uuid: