[SVf] update rccg name property to metadata
[Spectrum Virtualize family] While creating a group either from source_group or group_snapshot, the resulted group-volumes metadata is not updated with the rccg_name attribute. This is happening due to the order of some function calls to update volume metadata. Providing a fix to update rccg_name property to volume metadata which could cover all the possible cases like add a volume to the group, create a group from source_group and create a group from group_snapshot. Closes-Bug: #1943682 Change-Id: I0bfb79db4f69c0705a1e0fa971376d14c232d5cb
This commit is contained in:
parent
de6d54108b
commit
88d3005df4
@ -13849,7 +13849,8 @@ class StorwizeSVCReplicationTestCase(test.TestCase):
|
|||||||
'create_rccg')) as create_rccg:
|
'create_rccg')) as create_rccg:
|
||||||
with ((mock.patch.object(
|
with ((mock.patch.object(
|
||||||
storwize_svc_common.StorwizeSVCCommonDriver,
|
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
|
# Create group from source group
|
||||||
model_update, volumes_model_update = (
|
model_update, volumes_model_update = (
|
||||||
self.driver.create_group_from_src(self.ctxt,
|
self.driver.create_group_from_src(self.ctxt,
|
||||||
@ -13859,8 +13860,8 @@ class StorwizeSVCReplicationTestCase(test.TestCase):
|
|||||||
src_volumes))
|
src_volumes))
|
||||||
create_rccg.assert_called()
|
create_rccg.assert_called()
|
||||||
self.assertEqual(1, create_rccg.call_count)
|
self.assertEqual(1, create_rccg.call_count)
|
||||||
update_group.assert_called()
|
update_rep_group.assert_called()
|
||||||
self.assertEqual(1, update_group.call_count)
|
self.assertEqual(1, update_rep_group.call_count)
|
||||||
model_update = self.driver.delete_group(
|
model_update = self.driver.delete_group(
|
||||||
self.ctxt, clone_group, [clone_vol1, clone_vol2])
|
self.ctxt, clone_group, [clone_vol1, clone_vol2])
|
||||||
self.assertEqual(fields.GroupStatus.DELETED,
|
self.assertEqual(fields.GroupStatus.DELETED,
|
||||||
@ -13964,8 +13965,11 @@ class StorwizeSVCReplicationTestCase(test.TestCase):
|
|||||||
model_update['status'],
|
model_update['status'],
|
||||||
"CG create from src created passed")
|
"CG create from src created passed")
|
||||||
|
|
||||||
|
rccg_name = self.driver._get_rccg_name(clone_group)
|
||||||
for each_vol in volumes_model_update:
|
for each_vol in volumes_model_update:
|
||||||
self.assertEqual('available', each_vol['status'])
|
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,
|
model_update = self.driver.delete_group(self.ctxt, clone_group,
|
||||||
[clone_vol1, clone_vol2])
|
[clone_vol1, clone_vol2])
|
||||||
@ -13975,8 +13979,8 @@ class StorwizeSVCReplicationTestCase(test.TestCase):
|
|||||||
'create_rccg')) as create_rccg:
|
'create_rccg')) as create_rccg:
|
||||||
with ((mock.patch.object(
|
with ((mock.patch.object(
|
||||||
storwize_svc_common.StorwizeSVCCommonDriver,
|
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
|
# Create group from source as group snapshot
|
||||||
model_update, volumes_model_update = (
|
model_update, volumes_model_update = (
|
||||||
self.driver.create_group_from_src(self.ctxt,
|
self.driver.create_group_from_src(self.ctxt,
|
||||||
@ -13987,8 +13991,8 @@ class StorwizeSVCReplicationTestCase(test.TestCase):
|
|||||||
None))
|
None))
|
||||||
create_rccg.assert_called()
|
create_rccg.assert_called()
|
||||||
self.assertEqual(1, create_rccg.call_count)
|
self.assertEqual(1, create_rccg.call_count)
|
||||||
update_group.assert_called()
|
update_rep_group.assert_called()
|
||||||
self.assertEqual(1, update_group.call_count)
|
self.assertEqual(1, update_rep_group.call_count)
|
||||||
|
|
||||||
model_update = (
|
model_update = (
|
||||||
self.driver.delete_group(self.ctxt, clone_group,
|
self.driver.delete_group(self.ctxt, clone_group,
|
||||||
|
@ -6081,16 +6081,20 @@ class StorwizeSVCCommonDriver(san.SanDriver,
|
|||||||
for vol in volumes:
|
for vol in volumes:
|
||||||
rep_type = self._get_volume_replicated_type(context,
|
rep_type = self._get_volume_replicated_type(context,
|
||||||
vol)
|
vol)
|
||||||
|
volume_model = dict()
|
||||||
|
for model in volumes_model:
|
||||||
|
if vol.id == model["id"]:
|
||||||
|
volume_model = model
|
||||||
|
break
|
||||||
if rep_type:
|
if rep_type:
|
||||||
replica_obj = self._get_replica_obj(rep_type)
|
replica_obj = self._get_replica_obj(rep_type)
|
||||||
replica_obj.volume_replication_setup(context, vol)
|
replica_obj.volume_replication_setup(context, vol)
|
||||||
volumes_model[volumes.index(vol)]['replication_status'] = (
|
volume_model['replication_status'] = (
|
||||||
fields.ReplicationStatus.ENABLED)
|
fields.ReplicationStatus.ENABLED)
|
||||||
# Updating replication properties for a volume with replication
|
# Updating replication properties for a volume with replication
|
||||||
# enabled.
|
# enabled.
|
||||||
volumes_model[volumes.index(vol)] = (
|
self._update_replication_properties(context, vol,
|
||||||
self._update_replication_properties(
|
volume_model)
|
||||||
context, vol, volumes_model[volumes.index(vol)]))
|
|
||||||
|
|
||||||
opts = self._get_vdisk_params(vol['volume_type_id'],
|
opts = self._get_vdisk_params(vol['volume_type_id'],
|
||||||
volume_metadata=
|
volume_metadata=
|
||||||
@ -6099,9 +6103,7 @@ class StorwizeSVCCommonDriver(san.SanDriver,
|
|||||||
# Updating QoS properties for a volume
|
# Updating QoS properties for a volume
|
||||||
self._helpers.add_vdisk_qos(vol['name'], opts['qos'],
|
self._helpers.add_vdisk_qos(vol['name'], opts['qos'],
|
||||||
vol['size'])
|
vol['size'])
|
||||||
volumes_model[volumes.index(vol)] = (
|
self._qos_model_update(volume_model, vol)
|
||||||
self._qos_model_update(
|
|
||||||
volumes_model[volumes.index(vol)], vol))
|
|
||||||
|
|
||||||
if is_hyper_group:
|
if is_hyper_group:
|
||||||
self._helpers.ensure_vdisk_no_fc_mappings(vol['name'],
|
self._helpers.ensure_vdisk_no_fc_mappings(vol['name'],
|
||||||
@ -6116,8 +6118,12 @@ class StorwizeSVCCommonDriver(san.SanDriver,
|
|||||||
|
|
||||||
if volume_utils.is_group_a_type(
|
if volume_utils.is_group_a_type(
|
||||||
group, "consistent_group_replication_enabled"):
|
group, "consistent_group_replication_enabled"):
|
||||||
self.update_group(context, group, add_volumes=volumes,
|
model_update, added_vols, removed_vols = (
|
||||||
remove_volumes=[])
|
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.")
|
LOG.debug("Leave: create_group_from_src.")
|
||||||
return model_update, volumes_model
|
return model_update, volumes_model
|
||||||
|
@ -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.
|
Loading…
Reference in New Issue
Block a user