diff options
| author | Jenkins <jenkins@review.openstack.org> | 2012-07-27 13:58:54 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2012-07-27 13:58:54 +0000 |
| commit | 0c1cd1fa3c7f14820b3e606a892ce36a1b90882a (patch) | |
| tree | a2237a3b21bfccd7f68fa3c8eb6ee644944bcdb9 /nova | |
| parent | 2ae2d9483ea5647a07152021bff510c4bf256775 (diff) | |
| parent | 6106973d2fdf57be67d6de4bd5924321ed7e5772 (diff) | |
Merge "Send a full instance via rpc for get_diagnostics."
Diffstat (limited to 'nova')
| -rw-r--r-- | nova/compute/manager.py | 13 | ||||
| -rw-r--r-- | nova/compute/rpcapi.py | 7 | ||||
| -rw-r--r-- | nova/tests/compute/test_rpcapi.py | 4 |
3 files changed, 14 insertions, 10 deletions
diff --git a/nova/compute/manager.py b/nova/compute/manager.py index d744a069b..aeebc577a 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -298,7 +298,7 @@ def _get_additional_capabilities(): class ComputeManager(manager.SchedulerDependentManager): """Manages the running instances from creation to destruction.""" - RPC_API_VERSION = '1.15' + RPC_API_VERSION = '1.16' def __init__(self, compute_driver=None, *args, **kwargs): """Load configuration options and connect to the hypervisor.""" @@ -1777,14 +1777,15 @@ class ComputeManager(manager.SchedulerDependentManager): @exception.wrap_exception(notifier=notifier, publisher_id=publisher_id()) @wrap_instance_fault - def get_diagnostics(self, context, instance_uuid): + def get_diagnostics(self, context, instance_uuid=None, instance=None): """Retrieve diagnostics for an instance on this host.""" - instance_ref = self.db.instance_get_by_uuid(context, instance_uuid) - current_power_state = self._get_power_state(context, instance_ref) + if not instance: + instance = self.db.instance_get_by_uuid(context, instance_uuid) + current_power_state = self._get_power_state(context, instance) if current_power_state == power_state.RUNNING: LOG.audit(_("Retrieving diagnostics"), context=context, - instance=instance_ref) - return self.driver.get_diagnostics(instance_ref) + instance=instance) + return self.driver.get_diagnostics(instance) @exception.wrap_exception(notifier=notifier, publisher_id=publisher_id()) @checks_instance_lock diff --git a/nova/compute/rpcapi.py b/nova/compute/rpcapi.py index 35db1fe72..95f7f0d23 100644 --- a/nova/compute/rpcapi.py +++ b/nova/compute/rpcapi.py @@ -77,6 +77,7 @@ class ComputeAPI(nova.openstack.common.rpc.proxy.RpcProxy): 1.14 - Remove instance_uuid, add instance argument to finish_resize() 1.15 - Remove instance_uuid, add instance argument to finish_revert_resize() + 1.16 - Remove instance_uuid, add instance argument to get_diagnostics() ''' BASE_RPC_API_VERSION = '1.0' @@ -181,9 +182,11 @@ class ComputeAPI(nova.openstack.common.rpc.proxy.RpcProxy): topic=_compute_topic(self.topic, ctxt, host, None)) def get_diagnostics(self, ctxt, instance): + instance_p = jsonutils.to_primitive(instance) return self.call(ctxt, self.make_msg('get_diagnostics', - instance_uuid=instance['uuid']), - topic=_compute_topic(self.topic, ctxt, None, instance)) + instance=instance_p), + topic=_compute_topic(self.topic, ctxt, None, instance), + version='1.16') def get_instance_disk_info(self, ctxt, instance): return self.call(ctxt, self.make_msg('get_instance_disk_info', diff --git a/nova/tests/compute/test_rpcapi.py b/nova/tests/compute/test_rpcapi.py index 427acf949..bec10009c 100644 --- a/nova/tests/compute/test_rpcapi.py +++ b/nova/tests/compute/test_rpcapi.py @@ -53,7 +53,7 @@ class ComputeRpcAPITestCase(test.TestCase): 'check_can_live_migrate_destination', 'check_can_live_migrate_source', 'confirm_resize', 'detach_volume', 'finish_resize', 'finish_revert_resize', - 'get_console_output', + 'get_console_output', 'get_diagnostics', 'pause_instance', 'reboot_instance', 'suspend_instance', 'unpause_instance' ] @@ -183,7 +183,7 @@ class ComputeRpcAPITestCase(test.TestCase): def test_get_diagnostics(self): self._test_compute_api('get_diagnostics', 'call', - instance=self.fake_instance) + instance=self.fake_instance, version='1.16') def test_get_instance_disk_info(self): self._test_compute_api('get_instance_disk_info', 'call', |
