Confirm cross-cell resize while deleting a server
This adds the code to handle the TODO in the API code when deleting a server in 'resized' status. Like the traditional confirm resize code used here, this will synchronously RPC call conductor to orchestrate the confirm operation which will delete the instance-related records from the source cell before the API deletes the instance in the target cell. Part of blueprint cross-cell-resize Change-Id: I50b23c99a017bbfed98fd072112f0d06dd303829
This commit is contained in:
parent
85a1ac12e7
commit
6057373191
@ -2307,16 +2307,17 @@ class API(base.Base):
|
||||
instance=instance)
|
||||
return
|
||||
|
||||
src_host = migration.source_compute
|
||||
|
||||
# FIXME(mriedem): If migration.cross_cell_move, we need to also
|
||||
# cleanup the instance data from the source cell database.
|
||||
|
||||
self._record_action_start(context, instance,
|
||||
instance_actions.CONFIRM_RESIZE)
|
||||
|
||||
self.compute_rpcapi.confirm_resize(context,
|
||||
instance, migration, src_host, cast=False)
|
||||
# If migration.cross_cell_move, we need to also cleanup the instance
|
||||
# data from the source cell database.
|
||||
if migration.cross_cell_move:
|
||||
self.compute_task_api.confirm_snapshot_based_resize(
|
||||
context, instance, migration, do_cast=False)
|
||||
else:
|
||||
self.compute_rpcapi.confirm_resize(context,
|
||||
instance, migration, migration.source_compute, cast=False)
|
||||
|
||||
def _local_cleanup_bdm_volumes(self, bdms, instance, context):
|
||||
"""The method deletes the bdm records and, if a bdm is a volume, call
|
||||
|
@ -759,24 +759,7 @@ class TestMultiCellMigrate(integrated_helpers.ProviderUsageBaseTestCase):
|
||||
data is cleaned from both the source and target cell.
|
||||
"""
|
||||
server = self._resize_and_validate()[0]
|
||||
self.api.delete_server(server['id'])
|
||||
self._wait_until_deleted(server)
|
||||
# Now list servers to make sure it doesn't show up from the source cell
|
||||
servers = self.api.get_servers()
|
||||
self.assertEqual(0, len(servers), servers)
|
||||
# FIXME(mriedem): Need to cleanup from source cell in API method
|
||||
# _confirm_resize_on_deleting(). The above check passes because the
|
||||
# instance is still hidden in the source cell so the API filters it
|
||||
# out.
|
||||
target_host = server['OS-EXT-SRV-ATTR:host']
|
||||
source_host = 'host1' if target_host == 'host2' else 'host2'
|
||||
source_cell = self.cell_mappings[
|
||||
self.host_to_cell_mappings[source_host]]
|
||||
ctxt = nova_context.get_admin_context()
|
||||
with nova_context.target_cell(ctxt, source_cell) as cctxt:
|
||||
# Once the API is fixed this should raise InstanceNotFound.
|
||||
instance = objects.Instance.get_by_uuid(cctxt, server['id'])
|
||||
self.assertTrue(instance.hidden)
|
||||
self.delete_server_and_assert_cleanup(server)
|
||||
|
||||
def test_cold_migrate_target_host_in_other_cell(self):
|
||||
"""Tests cold migrating to a target host in another cell. This is
|
||||
|
Loading…
x
Reference in New Issue
Block a user