Merge "HPE: Fix error during retype of volume without comment"
This commit is contained in:
commit
265d813dc9
@ -1979,6 +1979,45 @@ class TestHPE3PARDriverBase(HPE3PARBaseDriver):
|
|||||||
]
|
]
|
||||||
mock_client.assert_has_calls(expected + self.standard_logout)
|
mock_client.assert_has_calls(expected + self.standard_logout)
|
||||||
|
|
||||||
|
@mock.patch.object(volume_types, 'get_volume_type')
|
||||||
|
def test_retype_volume_without_comment(self, _mock_volume_types):
|
||||||
|
_mock_volume_types.return_value = self.RETYPE_VOLUME_TYPE_1
|
||||||
|
mock_client = self.setup_driver(mock_conf=self.RETYPE_CONF)
|
||||||
|
|
||||||
|
volume = {'id': HPE3PARBaseDriver.CLONE_ID}
|
||||||
|
|
||||||
|
VOLUME_INFO_0 = self.RETYPE_VOLUME_INFO_0.copy()
|
||||||
|
|
||||||
|
# volume without comment
|
||||||
|
del(VOLUME_INFO_0['comment'])
|
||||||
|
mock_client.getVolume.return_value = VOLUME_INFO_0
|
||||||
|
|
||||||
|
with mock.patch.object(hpecommon.HPE3PARCommon,
|
||||||
|
'_create_client') as mock_create_client:
|
||||||
|
mock_create_client.return_value = mock_client
|
||||||
|
|
||||||
|
retyped = self.driver.retype(
|
||||||
|
self.ctxt, volume, self.RETYPE_VOLUME_TYPE_1, None,
|
||||||
|
self.RETYPE_HOST)
|
||||||
|
self.assertTrue(retyped[0])
|
||||||
|
|
||||||
|
expected = [
|
||||||
|
mock.call.modifyVolume('osv-0DM4qZEVSKON-AAAAAAAAA',
|
||||||
|
{'comment': mock.ANY,
|
||||||
|
'snapCPG': 'OpenStackCPGSnap'}),
|
||||||
|
mock.call.deleteVolumeSet('vvs-0DM4qZEVSKON-AAAAAAAAA'),
|
||||||
|
mock.call.addVolumeToVolumeSet('myvvs',
|
||||||
|
'osv-0DM4qZEVSKON-AAAAAAAAA'),
|
||||||
|
mock.call.modifyVolume('osv-0DM4qZEVSKON-AAAAAAAAA',
|
||||||
|
{'action': 6,
|
||||||
|
'userCPG': 'OpenStackCPG',
|
||||||
|
'conversionOperation': 1,
|
||||||
|
'compression': False,
|
||||||
|
'tuneOperation': 1}),
|
||||||
|
mock.call.getTask(1),
|
||||||
|
]
|
||||||
|
mock_client.assert_has_calls(expected + self.standard_logout)
|
||||||
|
|
||||||
@mock.patch.object(volume_types, 'get_volume_type')
|
@mock.patch.object(volume_types, 'get_volume_type')
|
||||||
def test_retype_non_rep_type_to_rep_type(self, _mock_volume_types):
|
def test_retype_non_rep_type_to_rep_type(self, _mock_volume_types):
|
||||||
|
|
||||||
|
@ -3687,7 +3687,7 @@ class HPE3PARCommon(object):
|
|||||||
old_tpvv = old_volume_info['provisioningType'] == self.THIN
|
old_tpvv = old_volume_info['provisioningType'] == self.THIN
|
||||||
old_tdvv = old_volume_info['provisioningType'] == self.DEDUP
|
old_tdvv = old_volume_info['provisioningType'] == self.DEDUP
|
||||||
old_cpg = old_volume_info['userCPG']
|
old_cpg = old_volume_info['userCPG']
|
||||||
old_comment = old_volume_info['comment']
|
old_comment = old_volume_info.get('comment')
|
||||||
old_snap_cpg = None
|
old_snap_cpg = None
|
||||||
if 'snapCPG' in old_volume_info:
|
if 'snapCPG' in old_volume_info:
|
||||||
old_snap_cpg = old_volume_info['snapCPG']
|
old_snap_cpg = old_volume_info['snapCPG']
|
||||||
@ -5314,6 +5314,9 @@ class ModifyVolumeTask(flow_utils.CinderTask):
|
|||||||
new_type_name, new_type_id):
|
new_type_name, new_type_id):
|
||||||
|
|
||||||
# Modify the comment during ModifyVolume
|
# Modify the comment during ModifyVolume
|
||||||
|
if not old_comment:
|
||||||
|
comment_dict = {}
|
||||||
|
else:
|
||||||
comment_dict = dict(ast.literal_eval(old_comment))
|
comment_dict = dict(ast.literal_eval(old_comment))
|
||||||
if 'vvs' in comment_dict:
|
if 'vvs' in comment_dict:
|
||||||
del comment_dict['vvs']
|
del comment_dict['vvs']
|
||||||
|
@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
fixes:
|
||||||
|
- |
|
||||||
|
HPE 3PAR driver `Bug #2023253 <https://bugs.launchpad.net/cinder/+bug/2023253>`_:
|
||||||
|
Fixed: Handle error during retype of volume without comment
|
||||||
|
|
Loading…
Reference in New Issue
Block a user