From 56af643e32c9612825a1d94bf8e05c0e9ce48bfd Mon Sep 17 00:00:00 2001 From: Chris Behrens Date: Sat, 21 Jan 2012 07:40:24 +0000 Subject: [PATCH] Refactor compute api messaging calls to compute manager API's calls to compute manager all use instance_uuid now. That allows us to refactor _cast_compute_message and make everything use it. This removes an extra DB call in a lot of cases where we already had the instance object, but then passed an instance_uuid into _cast_compute_message with no host, where it would look the object up again. Change-Id: Ia0739efcab0ca362c5bb89cd45c920bf762098f3 --- nova/tests/test_compute.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/nova/tests/test_compute.py b/nova/tests/test_compute.py index 421a0ef8..79e9f827 100644 --- a/nova/tests/test_compute.py +++ b/nova/tests/test_compute.py @@ -147,6 +147,7 @@ class BaseTestCase(test.TestCase): inst['launch_time'] = '10' inst['user_id'] = self.user_id inst['project_id'] = self.project_id + inst['host'] = 'fake_host' type_id = instance_types.get_instance_type_by_name(type_name)['id'] inst['instance_type_id'] = type_id inst['ami_launch_index'] = 0 @@ -3017,6 +3018,10 @@ class ComputePolicyTestCase(BaseTestCase): def test_wrapped_method(self): instance = self._create_fake_instance() + # Reset this to None for this policy check. If it's set, it + # tries to do a compute_api.update() and we're not testing for + # that here. + instance['host'] = None self.compute.run_instance(self.context, instance['uuid']) # force delete to fail