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
This commit is contained in:
Chris Behrens
2012-01-21 07:40:24 +00:00
parent 847c17dd5d
commit 56af643e32

View File

@@ -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