diff --git a/cinder/tests/unit/volume/drivers/dell/test_dellsc.py b/cinder/tests/unit/volume/drivers/dell/test_dellsc.py index 9464eee8eee..7e2afe092c6 100644 --- a/cinder/tests/unit/volume/drivers/dell/test_dellsc.py +++ b/cinder/tests/unit/volume/drivers/dell/test_dellsc.py @@ -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', diff --git a/cinder/volume/drivers/dell/dell_storagecenter_common.py b/cinder/volume/drivers/dell/dell_storagecenter_common.py index fb6534d6a86..c5ed1d69406 100644 --- a/cinder/volume/drivers/dell/dell_storagecenter_common.py +++ b/cinder/volume/drivers/dell/dell_storagecenter_common.py @@ -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.