MOD_OUTPUT = {'status': 'available'}
-DATA_IN_GROUP = {'id': 'group123',
+DATA_IN_GROUP = {'id': 'fe2dbc51-5810-451d-ab2f-8c8a48d15bee',
'name': 'group123',
'description': 'des123',
'status': ''}
'display_name': 'abc123',
'display_description': '',
'size': 1,
- 'consistencygroup_id': 'group123',
+ 'consistencygroup_id':
+ 'fe2dbc51-5810-451d-ab2f-8c8a48d15bee',
'status': 'available'}
DATA_IN_VOLUME1 = {'id': 'abc456',
'display_description': '',
'size': 1}
-DATA_IN_CG_SNAPSHOT = {'consistencygroup_id': 'group123',
- 'id': 'cgsnapshot1',
- 'name': 'cgsnapshot1',
- 'description': 'cgsnapshot1',
- 'status': ''}
+DATA_IN_CG_SNAPSHOT = {
+ 'consistencygroup_id': 'fe2dbc51-5810-451d-ab2f-8c8a48d15bee',
+ 'id': 'cgsnapshot1',
+ 'name': 'cgsnapshot1',
+ 'description': 'cgsnapshot1',
+ 'status': ''}
DATA_IN_SNAPSHOT = {'id': 'snapshot1',
'volume_id': 'abc123',
'display_name': 'snapshot1',
'display_description': ''}
-DATA_OUT_SNAPSHOT_CG = {'id': 'snapshot1',
- 'volume_id': 'abc123',
- 'display_name': 'snapshot1',
- 'display_description': '',
- 'cgsnapshot_id': 'cgsnapshot1'}
+DATA_OUT_SNAPSHOT_CG = {
+ 'id': 'snapshot1',
+ 'volume_id': 'abc123',
+ 'display_name': 'snapshot1',
+ 'display_description': '',
+ 'cgsnapshot_id': 'fe2dbc51-5810-451d-ab2f-8c8a48d15bee'}
class TestProphetStorDPLVolume(test.TestCase):
self.DPL_MOCK.delete_vdev.assert_called_once_with(
self._conver_uuid2hex(DATA_IN_VOLUME['id']))
+ def test_delete_volume_of_group(self):
+ self.DPL_MOCK.delete_vdev.return_value = DATA_OUTPUT
+ self.DPL_MOCK.leave_vg.return_volume = DATA_OUTPUT
+ self.dpldriver.delete_volume(DATA_IN_VOLUME_VG)
+ self.DPL_MOCK.leave_vg.assert_called_once_with(
+ self._conver_uuid2hex(DATA_IN_VOLUME_VG['id']),
+ self._conver_uuid2hex(DATA_IN_GROUP['id'])
+ )
+ self.DPL_MOCK.delete_vdev.assert_called_once_with(
+ self._conver_uuid2hex(DATA_IN_VOLUME['id']))
+
def test_create_volume_from_snapshot(self):
self.DPL_MOCK.create_vdev_from_snapshot.return_value = DATA_OUTPUT
self.dpldriver.create_volume_from_snapshot(DATA_IN_VOLUME,
model_update = self.dpldriver.create_consistencygroup(self.context,
DATA_IN_GROUP)
self.DPL_MOCK.create_vg.assert_called_once_with(
- DATA_IN_GROUP['id'], DATA_IN_GROUP['name'],
+ self._conver_uuid2hex(DATA_IN_GROUP['id']), DATA_IN_GROUP['name'],
DATA_IN_GROUP['description'])
self.assertDictMatch({'status': 'available'}, model_update)
metadata = {}
params = {}
url = '/%s/%s/' % (DPL_OBJ_VOLUMEGROUP, groupID)
- metadata['volume_group_operation'] = 'level'
+ metadata['volume_group_operation'] = 'leave'
metadata['volume'] = []
metadata['volume'].append(volumeID)
params['metadata'] = metadata
{'group_name': group['name'], 'id': group['id']})
model_update = {'status': 'available'}
try:
- ret, output = self.dpl.create_vg(group['id'], group['name'],
- group['description'])
+ ret, output = self.dpl.create_vg(
+ self._conver_uuid2hex(group['id']),
+ group['name'],
+ group['description'])
if ret:
msg = _('Failed to create consistency group '
'%(id)s:%(ret)s.') % {'id': group['id'],
def delete_volume(self, volume):
"""Deletes a volume."""
+ ret = 0
if volume.get('consistencygroup_id', None):
msg = ''
try: