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:
@@ -147,6 +147,7 @@ class BaseTestCase(test.TestCase):
|
|||||||
inst['launch_time'] = '10'
|
inst['launch_time'] = '10'
|
||||||
inst['user_id'] = self.user_id
|
inst['user_id'] = self.user_id
|
||||||
inst['project_id'] = self.project_id
|
inst['project_id'] = self.project_id
|
||||||
|
inst['host'] = 'fake_host'
|
||||||
type_id = instance_types.get_instance_type_by_name(type_name)['id']
|
type_id = instance_types.get_instance_type_by_name(type_name)['id']
|
||||||
inst['instance_type_id'] = type_id
|
inst['instance_type_id'] = type_id
|
||||||
inst['ami_launch_index'] = 0
|
inst['ami_launch_index'] = 0
|
||||||
@@ -3017,6 +3018,10 @@ class ComputePolicyTestCase(BaseTestCase):
|
|||||||
|
|
||||||
def test_wrapped_method(self):
|
def test_wrapped_method(self):
|
||||||
instance = self._create_fake_instance()
|
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'])
|
self.compute.run_instance(self.context, instance['uuid'])
|
||||||
|
|
||||||
# force delete to fail
|
# force delete to fail
|
||||||
|
|||||||
Reference in New Issue
Block a user