]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Change the exception type for Storwize/SVC driver
authorLi Min Liu <liminliu@cn.ibm.com>
Tue, 5 Aug 2014 03:39:09 +0000 (11:39 +0800)
committerLi Min Liu <liminliu@cn.ibm.com>
Tue, 5 Aug 2014 07:05:49 +0000 (15:05 +0800)
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

cinder/tests/test_storwize_svc.py
cinder/volume/drivers/ibm/storwize_svc/__init__.py

index 352d4c612c90e3f80a6425271ab0472067170526..0f44e73bf6e88d2064c255f430569d92dc710113 100644 (file)
@@ -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)
index cc0f3dd07f91b2be5b81f0839709a6563406859c..a9591bff9a26df1d4701af0e43dc53f9a039c983 100644 (file)
@@ -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'],