diff --git a/cinder/tests/unit/volume/drivers/hpe/test_hpe3par.py b/cinder/tests/unit/volume/drivers/hpe/test_hpe3par.py index 7630960f2dd..be03b5f2510 100644 --- a/cinder/tests/unit/volume/drivers/hpe/test_hpe3par.py +++ b/cinder/tests/unit/volume/drivers/hpe/test_hpe3par.py @@ -14,9 +14,9 @@ # under the License. """Unit tests for OpenStack Cinder volume drivers.""" -import mock - import ast +import copy +import mock from oslo_utils import units @@ -3509,9 +3509,7 @@ class TestHPE3PARDriverBase(HPE3PARBaseDriver): # setup_mock_client drive with default configuration # and return the mock HTTP 3PAR client mock_client = self.setup_driver() - volume_type_hos = self.volume_type_hos - volume_type_hos['extra_specs']['convert_to_base'] = False - _mock_volume_types.return_value = volume_type_hos + _mock_volume_types.return_value = self.volume_type_hos with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: @@ -3553,7 +3551,7 @@ class TestHPE3PARDriverBase(HPE3PARBaseDriver): 'getVolume.return_value': {} } mock_client = self.setup_driver(mock_conf=conf) - volume_type_hos = self.volume_type_hos + volume_type_hos = copy.deepcopy(self.volume_type_hos) volume_type_hos['extra_specs']['convert_to_base'] = True _mock_volume_types.return_value = volume_type_hos with mock.patch.object(hpecommon.HPE3PARCommon, @@ -3606,9 +3604,7 @@ class TestHPE3PARDriverBase(HPE3PARBaseDriver): 'getVolume.return_value': {} } mock_client = self.setup_driver(mock_conf=conf) - volume_type_hos = self.volume_type_hos - volume_type_hos['extra_specs']['convert_to_base'] = False - _mock_volume_types.return_value = volume_type_hos + _mock_volume_types.return_value = self.volume_type_hos with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client @@ -3661,7 +3657,7 @@ class TestHPE3PARDriverBase(HPE3PARBaseDriver): 'getVolume.return_value': {} } mock_client = self.setup_driver(mock_conf=conf) - volume_type_hos = self.volume_type_hos + volume_type_hos = copy.deepcopy(self.volume_type_hos) volume_type_hos['extra_specs']['convert_to_base'] = True _mock_volume_types.return_value = volume_type_hos with mock.patch.object(hpecommon.HPE3PARCommon, diff --git a/cinder/volume/drivers/hpe/hpe_3par_common.py b/cinder/volume/drivers/hpe/hpe_3par_common.py index 23bd5f1c40b..4d5cf068ff3 100644 --- a/cinder/volume/drivers/hpe/hpe_3par_common.py +++ b/cinder/volume/drivers/hpe/hpe_3par_common.py @@ -2100,7 +2100,7 @@ class HPE3PARCommon(object): # by default, set convert_to_base to False convert_to_base = self._get_boolean_key_value( - hpe3par_keys, 'convert_to_base', False) + hpe3par_keys, 'convert_to_base') # if provisioning is not set use thin default_prov = self.valid_prov_values[0] @@ -2643,7 +2643,7 @@ class HPE3PARCommon(object): # by default, set convert_to_base to False convert_to_base = self._get_boolean_key_value( - hpe3par_keys, 'convert_to_base', False) + hpe3par_keys, 'convert_to_base') LOG.debug("convert_to_base: %(convert)s", {'convert': convert_to_base}) @@ -2971,9 +2971,9 @@ class HPE3PARCommon(object): # Update v2 object as required for # _convert_to_base function - v2['volume_type_id'] = \ + v2['volume_type_id'] = ( self._get_3par_vol_comment_value( - v1['comment'], 'volume_type_id') + v1['comment'], 'volume_type_id')) v2['id'] = self._get_3par_vol_comment_value( v2['comment'], 'volume_id')