Merge "Convert instance_type to object in prep_resize"

This commit is contained in:
Jenkins 2015-07-28 20:02:21 +00:00 committed by Gerrit Code Review
commit ffe6c50712
2 changed files with 9 additions and 1 deletions

View File

@ -3530,6 +3530,13 @@ class ComputeManager(manager.Manager):
LOG.debug("No node specified, defaulting to %s", node,
instance=instance)
# NOTE(melwitt): Remove this in version 5.0 of the RPC API
# Code downstream may expect extra_specs to be populated since it
# is receiving an object, so lookup the flavor to ensure this.
if not isinstance(instance_type, objects.Flavor):
instance_type = objects.Flavor.get_by_id(context,
instance_type['id'])
quotas = objects.Quotas.from_reservations(context,
reservations,
instance=instance)

View File

@ -4267,6 +4267,7 @@ class ComputeTestCase(BaseTestCase):
migration = objects.Migration(context=self.context.elevated())
migration.instance_uuid = 'b48316c5-71e8-45e4-9884-6c78055b9b13'
migration.new_instance_type_id = '1'
instance_type = objects.Flavor()
actions = [
("reboot_instance", task_states.REBOOTING,
@ -4303,7 +4304,7 @@ class ComputeTestCase(BaseTestCase):
'reservations': []}),
("prep_resize", task_states.RESIZE_PREP,
{'image': {},
'instance_type': {},
'instance_type': instance_type,
'reservations': [],
'request_spec': {},
'filter_properties': {},