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
This commit is contained in:
KIYOHIRO ADACHI 2013-09-19 14:37:33 +09:00
parent 26044e7ccd
commit 61135b6a5f
2 changed files with 3 additions and 18 deletions

View 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.")

View 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)