Dell EMC SC: Return dict from delete_consisgroup

The Dell EMC SC driver was returning the volumes object when deleting
a consisency group. This has been changed to return a dict.

Also renamed some variables in the delete_cgsnapshot tests.

Change-Id: I79a9ebc304c85c14c4fafddc2699e6afdbd99b83
Closes-Bug: #1665032
This commit is contained in:
Tom Swanson 2017-02-15 10:48:17 -06:00
parent aeaa5772a3
commit 5e6ab0a764
2 changed files with 13 additions and 10 deletions

View File

@ -2294,17 +2294,18 @@ class DellSCSanISCSIDriverTestCase(test.TestCase):
mock_close_connection,
mock_open_connection,
mock_init):
mock_volume = mock.MagicMock()
expected_volumes = [mock_volume]
volume = {'id': fake.VOLUME_ID}
expected_volumes = [{'id': fake.VOLUME_ID,
'status': 'deleted'}]
context = {}
group = {'id': fake.CONSISTENCY_GROUP_ID,
'status': fields.ConsistencyGroupStatus.DELETED}
model_update, volumes = self.driver.delete_consistencygroup(
context, group, [mock_volume])
context, group, [volume])
mock_find_replay_profile.assert_called_once_with(
fake.CONSISTENCY_GROUP_ID)
mock_delete_replay_profile.assert_called_once_with(self.SCRPLAYPROFILE)
mock_delete_volume.assert_called_once_with(mock_volume)
mock_delete_volume.assert_called_once_with(volume)
self.assertEqual(group['status'], model_update['status'])
self.assertEqual(expected_volumes, volumes)
@ -2494,12 +2495,12 @@ class DellSCSanISCSIDriverTestCase(test.TestCase):
mock_close_connection,
mock_open_connection,
mock_init):
mock_snapshot = {'id': fake.SNAPSHOT_ID, 'status': 'available'}
snapshot = {'id': fake.SNAPSHOT_ID, 'status': 'available'}
context = {}
cgsnap = {'consistencygroup_id': fake.CONSISTENCY_GROUP_ID,
'id': fake.CGSNAPSHOT_ID, 'status': 'deleted'}
model_update, snapshots = self.driver.delete_cgsnapshot(
context, cgsnap, [mock_snapshot])
context, cgsnap, [snapshot])
mock_find_replay_profile.assert_called_once_with(
fake.CONSISTENCY_GROUP_ID)
mock_delete_cg_replay.assert_called_once_with(self.SCRPLAYPROFILE,
@ -2519,12 +2520,12 @@ class DellSCSanISCSIDriverTestCase(test.TestCase):
mock_close_connection,
mock_open_connection,
mock_init):
mock_snapshot = {'id': fake.SNAPSHOT_ID, 'status': 'available'}
snapshot = {'id': fake.SNAPSHOT_ID, 'status': 'available'}
context = {}
cgsnap = {'consistencygroup_id': fake.CONSISTENCY_GROUP_ID,
'id': fake.CGSNAPSHOT_ID, 'status': 'deleted'}
model_update, snapshots = self.driver.delete_cgsnapshot(
context, cgsnap, [mock_snapshot])
context, cgsnap, [snapshot])
mock_find_replay_profile.assert_called_once_with(
fake.CONSISTENCY_GROUP_ID)
self.assertFalse(mock_delete_cg_replay.called)

View File

@ -820,13 +820,15 @@ class DellCommonDriver(driver.ManageableVD,
# as we are trying to delete it anyway.
# Trundle through the list deleting the volumes.
volume_updates = []
for volume in volumes:
self.delete_volume(volume)
volume['status'] = 'deleted'
volume_updates.append({'id': volume['id'],
'status': 'deleted'})
model_update = {'status': group['status']}
return model_update, volumes
return model_update, volume_updates
def update_consistencygroup(self, context, group,
add_volumes=None, remove_volumes=None):