Merge "Fix cells use of legacy bdms during local instance delete operations"
This commit is contained in:
commit
fe1d118c0c
|
@ -20,7 +20,6 @@ import oslo_messaging as messaging
|
|||
from oslo_utils import excutils
|
||||
|
||||
from nova import availability_zones
|
||||
from nova import block_device
|
||||
from nova.cells import rpcapi as cells_rpcapi
|
||||
from nova.cells import utils as cells_utils
|
||||
from nova.compute import api as compute_api
|
||||
|
@ -220,9 +219,8 @@ class ComputeCellsAPI(compute_api.API):
|
|||
delete_type = method_name == 'soft_delete' and 'soft' or 'hard'
|
||||
self.cells_rpcapi.instance_delete_everywhere(context,
|
||||
instance, delete_type)
|
||||
bdms = block_device.legacy_mapping(
|
||||
self.db.block_device_mapping_get_all_by_instance(
|
||||
context, instance.uuid))
|
||||
bdms = objects.BlockDeviceMappingList.get_by_instance_uuid(
|
||||
context, instance.uuid)
|
||||
# NOTE(danms): If we try to delete an instance with no cell,
|
||||
# there isn't anything to salvage, so we can hard-delete here.
|
||||
try:
|
||||
|
|
|
@ -19,6 +19,7 @@ import functools
|
|||
import inspect
|
||||
|
||||
import mock
|
||||
from mox3 import mox
|
||||
from oslo_config import cfg
|
||||
from oslo_utils import timeutils
|
||||
|
||||
|
@ -143,10 +144,14 @@ class CellsComputeAPITestCase(test_compute.ComputeAPITestCase):
|
|||
cells_rpcapi = self.compute_api.cells_rpcapi
|
||||
self.mox.StubOutWithMock(cells_rpcapi,
|
||||
'instance_delete_everywhere')
|
||||
self.mox.StubOutWithMock(compute_api.API, '_local_delete')
|
||||
inst = self._create_fake_instance_obj()
|
||||
delete_type = method_name == 'soft_delete' and 'soft' or 'hard'
|
||||
cells_rpcapi.instance_delete_everywhere(self.context,
|
||||
inst, delete_type)
|
||||
compute_api.API._local_delete(self.context, inst,
|
||||
mox.IsA(objects.BlockDeviceMappingList),
|
||||
method_name, mox.IgnoreArg())
|
||||
self.mox.ReplayAll()
|
||||
self.stubs.Set(self.compute_api.network_api, 'deallocate_for_instance',
|
||||
lambda *a, **kw: None)
|
||||
|
|
Loading…
Reference in New Issue