diff options
| author | Russell Bryant <rbryant@redhat.com> | 2012-07-25 15:59:47 -0400 |
|---|---|---|
| committer | Russell Bryant <rbryant@redhat.com> | 2012-07-25 20:44:20 -0400 |
| commit | 7c489cbdf45cdc9c4fb6d1ecfed52fe8702ed52f (patch) | |
| tree | 384471b70f4da1d9008d2963e65f54a5ab50bdec /nova/compute | |
| parent | a6f06782157a5cd3384ae63d723f98e01c0792a1 (diff) | |
Send a full instance via rpc for check_can_live_migrate_source.
Change the check_can_live_migrate_source method of the compute
rpc API to take a full instance over rpc instead of just the instance
UUID. This cuts down on database access needed by nova-compute.
Part of blueprint no-db-messaging.
Change-Id: Ifc655fb86c94adc9a64e878a89a77342313cace2
Diffstat (limited to 'nova/compute')
| -rw-r--r-- | nova/compute/manager.py | 15 | ||||
| -rw-r--r-- | nova/compute/rpcapi.py | 7 |
2 files changed, 14 insertions, 8 deletions
diff --git a/nova/compute/manager.py b/nova/compute/manager.py index 339dbcb5f..1a423a3c8 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -297,7 +297,7 @@ def _get_additional_capabilities(): class ComputeManager(manager.SchedulerDependentManager): """Manages the running instances from creation to destruction.""" - RPC_API_VERSION = '1.10' + RPC_API_VERSION = '1.11' def __init__(self, compute_driver=None, *args, **kwargs): """Load configuration options and connect to the hypervisor.""" @@ -2119,19 +2119,22 @@ class ComputeManager(manager.SchedulerDependentManager): dest_check_data) @exception.wrap_exception(notifier=notifier, publisher_id=publisher_id()) - def check_can_live_migrate_source(self, ctxt, instance_id, - dest_check_data): + def check_can_live_migrate_source(self, ctxt, dest_check_data, + instance_id=None, instance=None): """Check if it is possible to execute live migration. This checks if the live migration can succeed, based on the results from check_can_live_migrate_destination. :param context: security context - :param instance_id: nova.db.sqlalchemy.models.Instance.Id + :param instance: dict of instance data + :param instance_id: (deprecated and only supplied if no instance passed + in) nova.db.sqlalchemy.models.Instance.Id :param dest_check_data: result of check_can_live_migrate_destination """ - instance_ref = self.db.instance_get(ctxt, instance_id) - self.driver.check_can_live_migrate_source(ctxt, instance_ref, + if not instance: + instance = self.db.instance_get(ctxt, instance_id) + self.driver.check_can_live_migrate_source(ctxt, instance, dest_check_data) def pre_live_migration(self, context, instance_id, diff --git a/nova/compute/rpcapi.py b/nova/compute/rpcapi.py index 89a9e9e5f..9644781f4 100644 --- a/nova/compute/rpcapi.py +++ b/nova/compute/rpcapi.py @@ -70,6 +70,8 @@ class ComputeAPI(nova.openstack.common.rpc.proxy.RpcProxy): 1.9 - Remove instance_uuid, add instance argument to attach_volume() 1.10 - Remove instance_id, add instance argument to check_can_live_migrate_destination() + 1.11 - Remove instance_id, add instance argument to + check_can_live_migrate_source() ''' BASE_RPC_API_VERSION = '1.0' @@ -118,11 +120,12 @@ class ComputeAPI(nova.openstack.common.rpc.proxy.RpcProxy): version='1.10') def check_can_live_migrate_source(self, ctxt, instance, dest_check_data): + instance_p = jsonutils.to_primitive(instance) self.call(ctxt, self.make_msg('check_can_live_migrate_source', - instance_id=instance['id'], + instance=instance_p, dest_check_data=dest_check_data), topic=_compute_topic(self.topic, ctxt, None, instance), - version='1.2') + version='1.11') def check_shared_storage_test_file(self, ctxt, filename, host): raise rpc_common.RPCException(message=_('Deprecated from version 1.2')) |
