'name': 'group_name',
'status': 'deleting'}
+ test_cg_with_type = {'id': 'consistencygroup_id',
+ 'name': 'group_name',
+ 'status': 'creating',
+ 'volume_type_id':
+ 'abc1-2320-9013-8813-8941-1374-8112-1231,'
+ '19fdd0dd-03b3-4d7c-b541-f4df46f308c8'}
+
test_cgsnapshot = {
'consistencygroup_id': 'consistencygroup_id',
'id': 'cgsnapshot_id',
cg_name))]
fake_cli.assert_has_calls(expect_cmd)
+ @mock.patch(
+ "cinder.volume.volume_types.get_volume_type_extra_specs",
+ mock.Mock(side_effect=[{'storagetype:provisioning': 'thin'},
+ {'storagetype:provisioning': 'compressed'}]))
+ def test_create_consistency_group_failed_with_compression(self):
+ self.driverSetup([], [])
+ self.assertRaisesRegexp(exception.VolumeBackendAPIException,
+ "Failed to create consistency group "
+ "consistencygroup_id "
+ "because VNX consistency group cannot "
+ "accept compressed LUNs as members.",
+ self.driver.create_consistencygroup,
+ None,
+ self.testData.test_cg_with_type)
+
def test_delete_consistency_group(self):
cg_name = self.testData.test_cg['id']
commands = [self.testData.DELETE_CONSISTENCYGROUP_CMD(cg_name),
if len(fields) == 2 and fields[0] == key:
return fields[1]
+ def _consistencygroup_creation_check(self, group):
+ """Check extra spec for consistency group."""
+
+ if group.get('volume_type_id') is not None:
+ for id in group['volume_type_id'].split(","):
+ provisioning, tiering = self._get_extra_spec_value(
+ volume_types.get_volume_type_extra_specs(id))
+ if provisioning == 'compressed':
+ msg = _("Failed to create consistency group %s "
+ "because VNX consistency group cannot "
+ "accept compressed LUNs as members.") % group['id']
+ raise exception.VolumeBackendAPIException(data=msg)
+
def create_consistencygroup(self, context, group):
"""Creates a consistency group."""
LOG.info(_LI('Start to create consistency group: %(group_name)s '
'id: %(id)s'),
{'group_name': group['name'], 'id': group['id']})
+ self._consistencygroup_creation_check(group)
+
model_update = {'status': 'available'}
try:
self._client.create_consistencygroup(context, group)