From: Li Min Liu Date: Tue, 5 Aug 2014 03:39:09 +0000 (+0800) Subject: Change the exception type for Storwize/SVC driver X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=30f399eced8b34b09c088dd180a4a1f9a72acbfc;p=openstack-build%2Fcinder-build.git Change the exception type for Storwize/SVC driver When create a volume from snapshot or clone a volume, Storwize/SVC require the same size for the source volume and target, if not, will raise VolumeDriverException. For this case, InvalidInput is more appropriate. Change-Id: I4383c2eb8758077b3029b862dd8b6f982e1850a7 --- diff --git a/cinder/tests/test_storwize_svc.py b/cinder/tests/test_storwize_svc.py index 352d4c612..0f44e73bf 100644 --- a/cinder/tests/test_storwize_svc.py +++ b/cinder/tests/test_storwize_svc.py @@ -1712,7 +1712,7 @@ class StorwizeSVCDriverTestCase(test.TestCase): # Try to create where source size != target size vol2['size'] += 1 - self.assertRaises(exception.VolumeDriverException, + self.assertRaises(exception.InvalidInput, self.driver.create_volume_from_snapshot, vol2, snap1) self._assert_vol_exists(vol2['name'], False) @@ -1726,7 +1726,7 @@ class StorwizeSVCDriverTestCase(test.TestCase): # Try to clone where source size != target size vol3['size'] += 1 - self.assertRaises(exception.VolumeDriverException, + self.assertRaises(exception.InvalidInput, self.driver.create_cloned_volume, vol3, vol2) self._assert_vol_exists(vol3['name'], False) diff --git a/cinder/volume/drivers/ibm/storwize_svc/__init__.py b/cinder/volume/drivers/ibm/storwize_svc/__init__.py index cc0f3dd07..a9591bff9 100644 --- a/cinder/volume/drivers/ibm/storwize_svc/__init__.py +++ b/cinder/volume/drivers/ibm/storwize_svc/__init__.py @@ -575,7 +575,7 @@ class StorwizeSVCDriver(san.SanDriver): msg = (_('create_volume_from_snapshot: Source and destination ' 'size differ.')) LOG.error(msg) - raise exception.VolumeDriverException(message=msg) + raise exception.InvalidInput(message=msg) opts = self._get_vdisk_params(volume['volume_type_id']) self._helpers.create_copy(snapshot['name'], volume['name'], @@ -587,7 +587,7 @@ class StorwizeSVCDriver(san.SanDriver): msg = (_('create_cloned_volume: Source and destination ' 'size differ.')) LOG.error(msg) - raise exception.VolumeDriverException(message=msg) + raise exception.InvalidInput(message=msg) opts = self._get_vdisk_params(tgt_volume['volume_type_id']) self._helpers.create_copy(src_volume['name'], tgt_volume['name'],