diff --git a/cinder/tests/unit/test_dellsc.py b/cinder/tests/unit/test_dellsc.py index 2d4c55244ba..e23ae71dfb0 100644 --- a/cinder/tests/unit/test_dellsc.py +++ b/cinder/tests/unit/test_dellsc.py @@ -1652,6 +1652,16 @@ class DellSCSanISCSIDriverTestCase(test.TestCase): None, None, None, {'extra_specs': {'something': 'else'}}, None) self.assertFalse(res) + def test_retype_same(self, + mock_close_connection, + mock_open_connection, + mock_init): + res = self.driver.retype( + None, None, None, + {'extra_specs': {'storagetype:storageprofile': ['A', 'A']}}, + None) + self.assertTrue(res) + def test_retype_malformed(self, mock_close_connection, mock_open_connection, diff --git a/cinder/volume/drivers/dell/dell_storagecenter_common.py b/cinder/volume/drivers/dell/dell_storagecenter_common.py index 67c0ce22072..4de4e123e5b 100644 --- a/cinder/volume/drivers/dell/dell_storagecenter_common.py +++ b/cinder/volume/drivers/dell/dell_storagecenter_common.py @@ -664,16 +664,25 @@ class DellCommonDriver(driver.ConsistencyGroupVD, driver.ManageableVD, storage_profiles) return False + current = storage_profiles[0] requested = storage_profiles[1] - volume_name = volume.get('id') - LOG.debug('Retyping volume %(vol)s to use storage ' - 'profile %(profile)s', - {'vol': volume_name, - 'profile': requested}) - with self._client.open_connection() as api: - if api.find_sc(): - scvolume = api.find_volume(volume_name) - return api.update_storage_profile( - scvolume, requested) + + if current != requested: + volume_name = volume.get('id') + LOG.debug('Retyping volume %(vol)s to use storage ' + 'profile %(profile)s.', + {'vol': volume_name, + 'profile': requested}) + with self._client.open_connection() as api: + if api.find_sc(): + scvolume = api.find_volume(volume_name) + return api.update_storage_profile( + scvolume, requested) + else: + # We only support retype of Storage Profile and they are + # the same, so just return True to avoid unnecessary data + # migration. + LOG.info(_LI('Retype was to same Storage Profile.')) + return True return False