From 10daa81057b2cfc0a3e21624b50b0b5d610b4db2 Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Wed, 2 Jan 2013 10:59:42 -0800 Subject: Move block_device_mapping destroy operations to conductor This patch moves the compute/manager's use of block_device_mapping_destroy operations to the conductor. Specifically: - block_device_mapping_destroy() - block_device_mapping_destroy_by_instance_and_device() - block_device_mapping_destroy_by_instance_and_volume() Once again, this just adds a single destroy operation to the conductor's RPC API and replicates the older interfaces in the public API. Further, the first now takes a list of bdms to be destroyed (unlike the db operation it mirrors) so that multiple RPC calls can be avoided for bulk delete operations. Related to blueprint no-db-compute-manager Change-Id: Ib93184ee6d32fcda90f75a26b579787e4625e9ae --- nova/compute/manager.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'nova/compute') diff --git a/nova/compute/manager.py b/nova/compute/manager.py index 4eb829fda..295125f90 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -1053,8 +1053,7 @@ class ComputeManager(manager.SchedulerDependentManager): instance_uuid) # ensure block device mappings are not leaked - for bdm in bdms: - self.db.block_device_mapping_destroy(context, bdm['id']) + self.conductor_api.block_device_mapping_destroy(context, bdms) self._notify_about_instance_usage(context, instance, "delete.end", system_metadata=system_meta) @@ -2318,8 +2317,9 @@ class ComputeManager(manager.SchedulerDependentManager): mountpoint, instance) except Exception: with excutils.save_and_reraise_exception(): - self.db.block_device_mapping_destroy_by_instance_and_device( - context, instance.get('uuid'), mountpoint) + capi = self.conductor_api + capi.block_device_mapping_destroy_by_instance_and_device( + context, instance, mountpoint) def _attach_volume(self, context, volume_id, mountpoint, instance): volume = self.volume_api.get(context, volume_id) @@ -2430,8 +2430,8 @@ class ComputeManager(manager.SchedulerDependentManager): connector = self.driver.get_volume_connector(instance) self.volume_api.terminate_connection(context, volume, connector) self.volume_api.detach(context.elevated(), volume) - self.db.block_device_mapping_destroy_by_instance_and_volume( - context, instance['uuid'], volume_id) + self.conductor_api.block_device_mapping_destroy_by_instance_and_volume( + context, instance, volume_id) @exception.wrap_exception(notifier=notifier, publisher_id=publisher_id()) def remove_volume_connection(self, context, volume_id, instance): -- cgit