Browse Source

Add group_type_id in create_group_snapshot

group_type_id should be set when a group_snapshot is created,
however it was missed in the code. This patch adds the missing
group_type_id in create_group_snapshot.

Change-Id: I5fdb3324e19f53a1116a04fcb34f6776c42a798d
Closes-Bug: #1632265
changes/33/385733/1
xing-yang 5 years ago
parent
commit
7aab553313
  1. 3
      cinder/group/api.py
  2. 4
      cinder/tests/unit/group/test_groups_api.py

3
cinder/group/api.py

@ -759,7 +759,8 @@ class API(base.Base):
'project_id': context.project_id,
'status': "creating",
'name': name,
'description': description}
'description': description,
'group_type_id': group.group_type_id}
group_snapshot = None
group_snapshot_id = None

4
cinder/tests/unit/group/test_groups_api.py

@ -290,6 +290,7 @@ class GroupAPITestCase(test.TestCase):
name = "fake_name"
description = "fake description"
mock_group.id = fake.GROUP_ID
mock_group.group_type_id = fake.GROUP_TYPE_ID
mock_group.volumes = []
ret_group_snap = self.group_api.create_group_snapshot(
self.ctxt, mock_group, name, description)
@ -300,7 +301,8 @@ class GroupAPITestCase(test.TestCase):
'project_id': self.ctxt.project_id,
'status': "creating",
'name': name,
'description': description}
'description': description,
'group_type_id': fake.GROUP_TYPE_ID}
mock_group_snap.assert_called_once_with(self.ctxt, **options)
ret_group_snap.create.assert_called_once_with()
mock_create_in_db.assert_called_once_with(self.ctxt, [],

Loading…
Cancel
Save