]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
remove VolumeNotFoundForInstance class
authorKIYOHIRO ADACHI <adachi@mxs.nes.nec.co.jp>
Thu, 19 Sep 2013 05:37:33 +0000 (14:37 +0900)
committerKIYOHIRO ADACHI <adachi@mxs.nes.nec.co.jp>
Thu, 19 Sep 2013 05:40:52 +0000 (14:40 +0900)
VolumeNotFoundForInstance class is used only in test_xiv_ds8k.py.  I
think the exception class that is used only in test code should not be
defined in cinder/exception.py.

Change-Id: I53512d9b06d48e1fb98ef63eac82c033cec37471
Closes-Bug: #1227477

cinder/exception.py
cinder/tests/test_xiv_ds8k.py

index 77c0e192a0bf7dc3506c566c1edfc35f9cb7c79d..d525cd0c460c5f312ec25ba551ba55aad593e765 100644 (file)
@@ -213,10 +213,6 @@ class SfAccountNotFound(NotFound):
                 "Solidfire device")
 
 
-class VolumeNotFoundForInstance(VolumeNotFound):
-    message = _("Volume not found for instance %(instance_id)s.")
-
-
 class VolumeMetadataNotFound(NotFound):
     message = _("Volume %(volume_id)s has no metadata with "
                 "key %(metadata_key)s.")
index ce9671720fb1941c733bc99556da61152d51da29..2ef235efd3158685e063c9fe64c003540bb11adb 100644 (file)
@@ -103,7 +103,9 @@ class XIVDS8KFakeProxyDriver(object):
         if not self.volume_exists(volume):
             raise self.exception.VolumeNotFound(volume_id=volume['id'])
         if not self.is_volume_attached(volume, connector):
-            raise self.exception.VolumeNotFoundForInstance(instance_id='fake')
+            raise self.exception.NotFound(_('Volume not found for '
+                                            'instance %(instance_id)s.')
+                                          % {'instance_id': 'fake'})
         del self.volumes[volume['name']]['attached']
 
     def is_volume_attached(self, volume, connector):
@@ -248,16 +250,3 @@ class XIVDS8KVolumeDriverTest(test.TestCase):
                           self.driver.terminate_connection,
                           VOLUME,
                           CONNECTOR)
-
-    def test_terminate_connection_should_fail_on_non_attached_volume(self):
-        """Test that terminate won't work for volumes that are not attached."""
-
-        self.driver.do_setup(None)
-        self.driver.create_volume(VOLUME)
-
-        self.assertRaises(exception.VolumeNotFoundForInstance,
-                          self.driver.terminate_connection,
-                          VOLUME,
-                          CONNECTOR)
-
-        self.driver.delete_volume(VOLUME)