diff options
| author | Russell Bryant <rbryant@redhat.com> | 2012-07-20 16:03:18 -0400 |
|---|---|---|
| committer | Russell Bryant <rbryant@redhat.com> | 2012-07-25 20:10:35 -0400 |
| commit | a43909352f2ef8c4a3fc540f8952ab2defa09ad6 (patch) | |
| tree | 808c7c6553261c5185a52091aff2314f92b047bf /nova/compute | |
| parent | 1d0362929d2bbb39a5665b0d0ce9972ca66c643b (diff) | |
Send a full instance via rpc for get_console_output.
Change the get_console_output 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: I114081fceddc2c7226aab9bd560f3664000a43af
Diffstat (limited to 'nova/compute')
| -rw-r--r-- | nova/compute/manager.py | 12 | ||||
| -rw-r--r-- | nova/compute/rpcapi.py | 8 |
2 files changed, 13 insertions, 7 deletions
diff --git a/nova/compute/manager.py b/nova/compute/manager.py index 368556dea..bb75efc5a 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.6' + RPC_API_VERSION = '1.7' def __init__(self, compute_driver=None, *args, **kwargs): """Load configuration options and connect to the hypervisor.""" @@ -1885,14 +1885,16 @@ class ComputeManager(manager.SchedulerDependentManager): @exception.wrap_exception(notifier=notifier, publisher_id=publisher_id()) @wrap_instance_fault - def get_console_output(self, context, instance_uuid, tail_length=None): + def get_console_output(self, context, instance=None, instance_uuid=None, + tail_length=None): """Send the console output for the given instance.""" context = context.elevated() - instance_ref = self.db.instance_get_by_uuid(context, instance_uuid) + if not instance: + instance = self.db.instance_get_by_uuid(context, instance_uuid) LOG.audit(_("Get console output"), context=context, - instance=instance_ref) - output = self.driver.get_console_output(instance_ref) + instance=instance) + output = self.driver.get_console_output(instance) if tail_length is not None: output = self._tail_log(output, tail_length) diff --git a/nova/compute/rpcapi.py b/nova/compute/rpcapi.py index c893bb0d5..4d5e495d6 100644 --- a/nova/compute/rpcapi.py +++ b/nova/compute/rpcapi.py @@ -63,6 +63,8 @@ class ComputeAPI(nova.openstack.common.rpc.proxy.RpcProxy): 1.5 - Remove instance_uuid, add instance argument to pause_instance(), unpause_instance() 1.6 - Remove instance_uuid, add instance argument to suspend_instance() + 1.7 - Remove instance_uuid, add instance argument to + get_console_output() ''' BASE_RPC_API_VERSION = '1.0' @@ -149,9 +151,11 @@ class ComputeAPI(nova.openstack.common.rpc.proxy.RpcProxy): topic=_compute_topic(self.topic, ctxt, host, None)) def get_console_output(self, ctxt, instance, tail_length): + instance_p = jsonutils.to_primitive(instance) return self.call(ctxt, self.make_msg('get_console_output', - instance_uuid=instance['uuid'], tail_length=tail_length), - topic=_compute_topic(self.topic, ctxt, None, instance)) + instance=instance_p, tail_length=tail_length), + topic=_compute_topic(self.topic, ctxt, None, instance), + version='1.7') def get_console_pool_info(self, ctxt, console_type, host): return self.call(ctxt, self.make_msg('get_console_pool_info', |
