[Pure Storage] Add missing DB values when performing create CG from
CG snap Return the correct metadata from new volumes created after cloning a consistency group from a snapshot. Previously nothing was returned which causes issue with PowerVC. Change-Id: Ia11abfe5f12aedd364fcd5ecd979733178c7dbd1 Closes-Bug: #1945824
This commit is contained in:
parent
91d0a6512f
commit
35c0788377
@ -1679,7 +1679,7 @@ class PureBaseVolumeDriverTestCase(PureBaseSharedDriverTestCase):
|
||||
mock_cgsnapshot = mock.Mock()
|
||||
mock_snapshots = [mock.Mock() for i in range(5)]
|
||||
mock_volumes = [mock.Mock() for i in range(5)]
|
||||
result = self.driver.create_consistencygroup_from_src(
|
||||
self.driver.create_consistencygroup_from_src(
|
||||
mock_context,
|
||||
mock_group,
|
||||
mock_volumes,
|
||||
@ -1688,7 +1688,6 @@ class PureBaseVolumeDriverTestCase(PureBaseSharedDriverTestCase):
|
||||
source_cg=None,
|
||||
source_vols=None
|
||||
)
|
||||
self.assertEqual((None, None), result)
|
||||
mock_create_cg.assert_called_with(mock_context, mock_group)
|
||||
expected_calls = [mock.call(vol, snap)
|
||||
for vol, snap in zip(mock_volumes, mock_snapshots)]
|
||||
@ -1715,14 +1714,13 @@ class PureBaseVolumeDriverTestCase(PureBaseSharedDriverTestCase):
|
||||
mock_source_cg = mock.MagicMock()
|
||||
mock_volumes = [mock.MagicMock() for i in range(num_volumes)]
|
||||
mock_source_vols = [mock.MagicMock() for i in range(num_volumes)]
|
||||
result = self.driver.create_consistencygroup_from_src(
|
||||
self.driver.create_consistencygroup_from_src(
|
||||
mock_context,
|
||||
mock_group,
|
||||
mock_volumes,
|
||||
source_cg=mock_source_cg,
|
||||
source_vols=mock_source_vols
|
||||
)
|
||||
self.assertEqual((None, None), result)
|
||||
mock_create_cg.assert_called_with(mock_context, mock_group)
|
||||
self.assertTrue(self.array.create_pgroup_snapshot.called)
|
||||
self.assertTrue(self.array.destroy_pgroup.called)
|
||||
|
@ -550,6 +550,7 @@ class PureBaseVolumeDriver(san.SanDriver):
|
||||
repl_status = fields.ReplicationStatus.ENABLED
|
||||
|
||||
model_update = {
|
||||
'id': volume.id,
|
||||
'provider_id': purity_vol_name,
|
||||
'replication_status': repl_status,
|
||||
}
|
||||
@ -976,8 +977,11 @@ class PureBaseVolumeDriver(san.SanDriver):
|
||||
|
||||
The new volumes will be consistent with the snapshot.
|
||||
"""
|
||||
vol_models = []
|
||||
for volume, snapshot in zip(volumes, snapshots):
|
||||
self.create_volume_from_snapshot(volume, snapshot)
|
||||
vol_models.append(self.create_volume_from_snapshot(volume,
|
||||
snapshot))
|
||||
return vol_models
|
||||
|
||||
def _create_cg_from_cg(self, group, source_group, volumes, source_vols):
|
||||
"""Creates a new consistency group from an existing cg.
|
||||
@ -985,6 +989,7 @@ class PureBaseVolumeDriver(san.SanDriver):
|
||||
The new volumes will be in a consistent state, but this requires
|
||||
taking a new temporary group snapshot and cloning from that.
|
||||
"""
|
||||
vol_models = []
|
||||
pgroup_name = self._get_pgroup_name(source_group)
|
||||
tmp_suffix = '%s-tmp' % uuid.uuid4()
|
||||
tmp_pgsnap_name = '%(pgroup_name)s.%(pgsnap_suffix)s' % {
|
||||
@ -1013,19 +1018,21 @@ class PureBaseVolumeDriver(san.SanDriver):
|
||||
)
|
||||
finally:
|
||||
self._delete_pgsnapshot(tmp_pgsnap_name)
|
||||
return vol_models
|
||||
|
||||
@pure_driver_debug_trace
|
||||
def create_consistencygroup_from_src(self, context, group, volumes,
|
||||
cgsnapshot=None, snapshots=None,
|
||||
source_cg=None, source_vols=None):
|
||||
self.create_consistencygroup(context, group)
|
||||
model_update = self.create_consistencygroup(context, group)
|
||||
if cgsnapshot and snapshots:
|
||||
self._create_cg_from_cgsnap(volumes,
|
||||
snapshots)
|
||||
vol_models = self._create_cg_from_cgsnap(volumes,
|
||||
snapshots)
|
||||
elif source_cg:
|
||||
self._create_cg_from_cg(group, source_cg, volumes, source_vols)
|
||||
vol_models = self._create_cg_from_cg(group, source_cg,
|
||||
volumes, source_vols)
|
||||
|
||||
return None, None
|
||||
return model_update, vol_models
|
||||
|
||||
@pure_driver_debug_trace
|
||||
def delete_consistencygroup(self, context, group, volumes):
|
||||
|
5
releasenotes/notes/bug_1945824-7f8f238e274ddebd.yaml
Normal file
5
releasenotes/notes/bug_1945824-7f8f238e274ddebd.yaml
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
fixes:
|
||||
- |
|
||||
Pure Storage driver `Bug #1945824 <https://bugs.launchpad.net/cinder/+bug/1945824>`_:
|
||||
Fixed missing DB values when creating new consistency group from CG snapshot.
|
Loading…
Reference in New Issue
Block a user