From e32f01ac93c96395aec14b520ac6792d811f1c03 Mon Sep 17 00:00:00 2001 From: Devananda van der Veen Date: Wed, 14 Nov 2012 11:25:14 -0800 Subject: add instance_type_extra_specs to instances Adding instance_type_extra_specs as instance['extra_specs'] so that this info is passed to driver.spawn() later on. This is needed by the baremetal driver. Change-Id: Icbfba835c9a060193597cc00a7c0e404b7ccfdd4 --- nova/db/sqlalchemy/api.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'nova/db') diff --git a/nova/db/sqlalchemy/api.py b/nova/db/sqlalchemy/api.py index eb1247e7d..40e0445bd 100644 --- a/nova/db/sqlalchemy/api.py +++ b/nova/db/sqlalchemy/api.py @@ -1807,6 +1807,18 @@ def _instance_update(context, instance_uuid, values, copy_old_instance=False): with session.begin(): instance_ref = instance_get_by_uuid(context, instance_uuid, session=session) + # TODO(deva): remove extra_specs from here after it is included + # in system_metadata. Until then, the baremetal driver + # needs extra_specs added to instance[] + inst_type_ref = _instance_type_get_query(context, session=session).\ + filter_by(id=instance_ref['instance_type_id']).\ + first() + if inst_type_ref: + instance_ref['extra_specs'] = \ + _dict_with_extra_specs(inst_type_ref).get('extra_specs', {}) + else: + instance_ref['extra_specs'] = {} + if "expected_task_state" in values: # it is not a db column so always pop out expected = values.pop("expected_task_state") -- cgit