summaryrefslogtreecommitdiffstats
path: root/nova/db
diff options
context:
space:
mode:
authorDevananda van der Veen <devananda.vdv@gmail.com>2012-11-14 11:25:14 -0800
committerDevananda van der Veen <devananda.vdv@gmail.com>2012-11-16 11:26:17 -0800
commite32f01ac93c96395aec14b520ac6792d811f1c03 (patch)
treed713bcb356ff00a35428cd9442cdea0986a683c1 /nova/db
parent40d7bcb8a3b797cfa691d83d8694a3c9c81ad8dc (diff)
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
Diffstat (limited to 'nova/db')
-rw-r--r--nova/db/sqlalchemy/api.py12
1 files changed, 12 insertions, 0 deletions
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")