Merge "[SVf] update rccg name property to metadata"

This commit is contained in:
Zuul 2022-02-14 16:55:13 +00:00 committed by Gerrit Code Review
commit 44351a4a41
3 changed files with 33 additions and 16 deletions

View File

@ -14092,7 +14092,8 @@ class StorwizeSVCReplicationTestCase(test.TestCase):
'create_rccg')) as create_rccg:
with ((mock.patch.object(
storwize_svc_common.StorwizeSVCCommonDriver,
'update_group'))) as update_group:
'_update_replication_grp'))) as update_rep_group:
update_rep_group.return_value = (dict(), dict(), dict())
# Create group from source group
model_update, volumes_model_update = (
self.driver.create_group_from_src(self.ctxt,
@ -14102,8 +14103,8 @@ class StorwizeSVCReplicationTestCase(test.TestCase):
src_volumes))
create_rccg.assert_called()
self.assertEqual(1, create_rccg.call_count)
update_group.assert_called()
self.assertEqual(1, update_group.call_count)
update_rep_group.assert_called()
self.assertEqual(1, update_rep_group.call_count)
model_update = self.driver.delete_group(
self.ctxt, clone_group, [clone_vol1, clone_vol2])
self.assertEqual(fields.GroupStatus.DELETED,
@ -14207,8 +14208,11 @@ class StorwizeSVCReplicationTestCase(test.TestCase):
model_update['status'],
"CG create from src created passed")
rccg_name = self.driver._get_rccg_name(clone_group)
for each_vol in volumes_model_update:
self.assertEqual('available', each_vol['status'])
self.assertEqual(rccg_name,
each_vol['metadata']['Consistency Group Name'])
model_update = self.driver.delete_group(self.ctxt, clone_group,
[clone_vol1, clone_vol2])
@ -14218,8 +14222,8 @@ class StorwizeSVCReplicationTestCase(test.TestCase):
'create_rccg')) as create_rccg:
with ((mock.patch.object(
storwize_svc_common.StorwizeSVCCommonDriver,
'update_group'))) as update_group:
'_update_replication_grp'))) as update_rep_group:
update_rep_group.return_value = (dict(), dict(), dict())
# Create group from source as group snapshot
model_update, volumes_model_update = (
self.driver.create_group_from_src(self.ctxt,
@ -14230,8 +14234,8 @@ class StorwizeSVCReplicationTestCase(test.TestCase):
None))
create_rccg.assert_called()
self.assertEqual(1, create_rccg.call_count)
update_group.assert_called()
self.assertEqual(1, update_group.call_count)
update_rep_group.assert_called()
self.assertEqual(1, update_rep_group.call_count)
model_update = (
self.driver.delete_group(self.ctxt, clone_group,

View File

@ -6111,16 +6111,20 @@ class StorwizeSVCCommonDriver(san.SanDriver,
for vol in volumes:
rep_type = self._get_volume_replicated_type(context,
vol)
volume_model = dict()
for model in volumes_model:
if vol.id == model["id"]:
volume_model = model
break
if rep_type:
replica_obj = self._get_replica_obj(rep_type)
replica_obj.volume_replication_setup(context, vol)
volumes_model[volumes.index(vol)]['replication_status'] = (
volume_model['replication_status'] = (
fields.ReplicationStatus.ENABLED)
# Updating replication properties for a volume with replication
# enabled.
volumes_model[volumes.index(vol)] = (
self._update_replication_properties(
context, vol, volumes_model[volumes.index(vol)]))
self._update_replication_properties(context, vol,
volume_model)
opts = self._get_vdisk_params(vol['volume_type_id'],
volume_metadata=
@ -6129,9 +6133,7 @@ class StorwizeSVCCommonDriver(san.SanDriver,
# Updating QoS properties for a volume
self._helpers.add_vdisk_qos(vol['name'], opts['qos'],
vol['size'])
volumes_model[volumes.index(vol)] = (
self._qos_model_update(
volumes_model[volumes.index(vol)], vol))
self._qos_model_update(volume_model, vol)
if is_hyper_group:
self._helpers.ensure_vdisk_no_fc_mappings(vol['name'],
@ -6146,8 +6148,12 @@ class StorwizeSVCCommonDriver(san.SanDriver,
if volume_utils.is_group_a_type(
group, "consistent_group_replication_enabled"):
self.update_group(context, group, add_volumes=volumes,
remove_volumes=[])
model_update, added_vols, removed_vols = (
self._update_replication_grp(context, group, volumes, []))
if model_update.get('status') != fields.GroupStatus.ERROR:
# Updating RCCG property to volume metadata
for model in volumes_model:
model['metadata']['Consistency Group Name'] = rccg_name
LOG.debug("Leave: create_group_from_src.")
return model_update, volumes_model

View File

@ -0,0 +1,7 @@
---
fixes:
- |
IBM Spectrum Virtualize family driver
`Bug #1943682 <https://bugs.launchpad.net/cinder/+bug/1943682>`_:
Updating rccg_name property to volume metadata for the resultant
volumes of a clone_group from a source_group or a group_snapshot.