From 5e7275f5bca9c7c6f30a442c3bd2b66eba19fe04 Mon Sep 17 00:00:00 2001 From: Dan Prince Date: Wed, 1 Aug 2012 10:55:14 -0400 Subject: Fix get_diagnostics RPC arg ordering. Updates the ordering of the compute managers get_diagnostics call so it works correctly with the current wrap_instance_fault and checks_instance_lock decorators. To work correctly 'instance' needs to be the first argument after the context. Fixes LP Bug #1031788. Change-Id: Ia7105eb272cd2932fc4f25b297ecab9e5ab8dbe2 --- nova/compute/manager.py | 2 +- nova/tests/compute/test_compute.py | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'nova') diff --git a/nova/compute/manager.py b/nova/compute/manager.py index fd0f9049a..26b8dbb7a 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -1762,7 +1762,7 @@ class ComputeManager(manager.SchedulerDependentManager): @exception.wrap_exception(notifier=notifier, publisher_id=publisher_id()) @wrap_instance_fault - def get_diagnostics(self, context, instance_uuid=None, instance=None): + def get_diagnostics(self, context, instance=None, instance_uuid=None): """Retrieve diagnostics for an instance on this host.""" if not instance: instance = self.db.instance_get_by_uuid(context, instance_uuid) diff --git a/nova/tests/compute/test_compute.py b/nova/tests/compute/test_compute.py index 5cee6f94d..8367065d3 100644 --- a/nova/tests/compute/test_compute.py +++ b/nova/tests/compute/test_compute.py @@ -868,7 +868,11 @@ class ComputeTestCase(BaseTestCase): self.compute.run_instance(self.context, instance['uuid']) diagnostics = self.compute.get_diagnostics(self.context, - instance['uuid']) + instance_uuid=instance['uuid']) + self.assertEqual(diagnostics, 'FAKE_DIAGNOSTICS') + + diagnostics = self.compute.get_diagnostics(self.context, + instance=instance) self.assertEqual(diagnostics, 'FAKE_DIAGNOSTICS') self.compute.terminate_instance(self.context, instance['uuid']) -- cgit