Save volume_type/group_type uuid into db when creating group

When creating groups, if volume type name or group type name is
passed, cinder-api will try to save the name rather uuid into
the database. It will make a foreign key constraint fails. After
this change, we always save uuid into database.

Change-Id: Ib333130325fc12a4753c7a128e823e992e8c8682
Closes-Bug: #1622476
This commit is contained in:
Cao Shufeng
2016-09-12 06:27:03 -04:00
parent d551f4dff7
commit cee739a4a8
2 changed files with 32 additions and 2 deletions

View File

@@ -151,8 +151,8 @@ class API(base.Base):
'status': c_fields.GroupStatus.CREATING,
'name': name,
'description': description,
'volume_type_ids': volume_types,
'group_type_id': group_type}
'volume_type_ids': [t['id'] for t in req_volume_types],
'group_type_id': req_group_type['id']}
group = None
try:
group = objects.Group(context=context, **kwargs)