From: KIYOHIRO ADACHI Date: Thu, 19 Sep 2013 05:37:33 +0000 (+0900) Subject: remove VolumeNotFoundForInstance class X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=61135b6a5f1724888e92471b68f91e4a825bf4f0;p=openstack-build%2Fcinder-build.git remove VolumeNotFoundForInstance class 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 --- diff --git a/cinder/exception.py b/cinder/exception.py index 77c0e192a..d525cd0c4 100644 --- a/cinder/exception.py +++ b/cinder/exception.py @@ -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.") diff --git a/cinder/tests/test_xiv_ds8k.py b/cinder/tests/test_xiv_ds8k.py index ce9671720..2ef235efd 100644 --- a/cinder/tests/test_xiv_ds8k.py +++ b/cinder/tests/test_xiv_ds8k.py @@ -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)