Merge "Dell EMC SC: Return dict in delete_cgsnapshot"

This commit is contained in:
Jenkins 2017-02-15 03:54:39 +00:00 committed by Gerrit Code Review
commit fa33d1557b
2 changed files with 11 additions and 9 deletions

View File

@ -2494,8 +2494,7 @@ class DellSCSanISCSIDriverTestCase(test.TestCase):
mock_close_connection,
mock_open_connection,
mock_init):
mock_snapshot = mock.MagicMock()
expected_snapshots = [mock_snapshot]
mock_snapshot = {'id': fake.SNAPSHOT_ID, 'status': 'available'}
context = {}
cgsnap = {'consistencygroup_id': fake.CONSISTENCY_GROUP_ID,
'id': fake.CGSNAPSHOT_ID, 'status': 'deleted'}
@ -2506,7 +2505,8 @@ class DellSCSanISCSIDriverTestCase(test.TestCase):
mock_delete_cg_replay.assert_called_once_with(self.SCRPLAYPROFILE,
fake.CGSNAPSHOT_ID)
self.assertEqual({'status': cgsnap['status']}, model_update)
self.assertEqual(expected_snapshots, snapshots)
self.assertEqual([{'id': fake.SNAPSHOT_ID, 'status': 'deleted'}],
snapshots)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'delete_cg_replay')
@ -2519,8 +2519,7 @@ class DellSCSanISCSIDriverTestCase(test.TestCase):
mock_close_connection,
mock_open_connection,
mock_init):
mock_snapshot = mock.MagicMock()
expected_snapshots = [mock_snapshot]
mock_snapshot = {'id': fake.SNAPSHOT_ID, 'status': 'available'}
context = {}
cgsnap = {'consistencygroup_id': fake.CONSISTENCY_GROUP_ID,
'id': fake.CGSNAPSHOT_ID, 'status': 'deleted'}
@ -2530,7 +2529,8 @@ class DellSCSanISCSIDriverTestCase(test.TestCase):
fake.CONSISTENCY_GROUP_ID)
self.assertFalse(mock_delete_cg_replay.called)
self.assertEqual({'status': cgsnap['status']}, model_update)
self.assertEqual(expected_snapshots, snapshots)
self.assertEqual([{'id': fake.SNAPSHOT_ID, 'status': 'deleted'}],
snapshots)
@mock.patch.object(dell_storagecenter_api.StorageCenterApi,
'delete_cg_replay',

View File

@ -929,13 +929,15 @@ class DellCommonDriver(driver.ManageableVD,
msg = (_('Unable to delete Consistency Group snapshot %s')
% snapshotid)
raise exception.VolumeBackendAPIException(data=msg)
snapshot_updates = []
for snapshot in snapshots:
snapshot.status = fields.SnapshotStatus.DELETED
snapshot_updates.append(
{'id': snapshot['id'],
'status': fields.SnapshotStatus.DELETED})
model_update = {'status': fields.SnapshotStatus.DELETED}
return model_update, snapshots
return model_update, snapshot_updates
def manage_existing(self, volume, existing_ref):
"""Brings an existing backend storage object under Cinder management.