From e2fd4f204897b10aae1c2d182eacfc5315b9881f Mon Sep 17 00:00:00 2001 From: KIYOHIRO ADACHI Date: Fri, 10 Jan 2014 18:22:36 +0900 Subject: [PATCH] Remove unused exceptions The following exceptions are not used. class MigrationNotFound(NotFound): class BadDriverResponseStatus(VolumeDriverException): class InstanceNotFound(NotFound): class VolumeRetypeFailed(CinderException): class DuplicateSolidFireVolumeNames(SolidFireDriverException): Change-Id: I891360f9c150eb8ea3f3968f12b9ad3da998981a --- cinder/exception.py | 20 ------------------- .../test_extended_snapshot_attributes.py | 12 ----------- 2 files changed, 32 deletions(-) diff --git a/cinder/exception.py b/cinder/exception.py index 68d564957..aa478cd8f 100644 --- a/cinder/exception.py +++ b/cinder/exception.py @@ -352,10 +352,6 @@ class OverQuota(CinderException): message = _("Quota exceeded for resources: %(overs)s") -class MigrationNotFound(NotFound): - message = _("Migration %(migration_id)s could not be found.") - - class FileNotFound(NotFound): message = _("File %(file_path)s could not be found.") @@ -435,18 +431,10 @@ class MalformedResponse(VolumeDriverException): message = _("Malformed response to command %(cmd)s: %(reason)s") -class BadDriverResponseStatus(VolumeDriverException): - message = _("Bad driver response status: %(status)s") - - class FailedCmdWithDump(VolumeDriverException): message = _("Operation failed with status=%(status)s. Full dump: %(data)s") -class InstanceNotFound(NotFound): - message = _("Instance %(instance_id)s could not be found.") - - class GlanceMetadataExists(Invalid): message = _("Glance metadata cannot be updated, key %(key)s" " exists for volume id %(volume_id)s") @@ -561,10 +549,6 @@ class KeyManagerError(CinderException): msg_fmt = _("key manager error: %(reason)s") -class VolumeRetypeFailed(CinderException): - message = _("Volume retype failed: %(reason)s") - - # Driver specific exceptions # Coraid class CoraidException(VolumeDriverException): @@ -642,10 +626,6 @@ class SolidFireAccountNotFound(SolidFireDriverException): "Solidfire device") -class DuplicateSolidFireVolumeNames(SolidFireDriverException): - message = _("Detected more than one volume with name %(vol_name)s") - - # HP 3Par class Invalid3PARDomain(VolumeDriverException): message = _("Invalid 3PAR Domain: %(err)s") diff --git a/cinder/tests/api/contrib/test_extended_snapshot_attributes.py b/cinder/tests/api/contrib/test_extended_snapshot_attributes.py index c1d0b1506..e90c29163 100644 --- a/cinder/tests/api/contrib/test_extended_snapshot_attributes.py +++ b/cinder/tests/api/contrib/test_extended_snapshot_attributes.py @@ -18,7 +18,6 @@ from lxml import etree import webob from cinder.api.contrib import extended_snapshot_attributes -from cinder import exception from cinder.openstack.common import jsonutils from cinder import test from cinder.tests.api import fakes @@ -97,17 +96,6 @@ class ExtendedSnapshotAttributesTest(test.TestCase): project_id='fake', progress='0%') - def test_no_instance_passthrough_404(self): - - def fake_snapshot_get(*args, **kwargs): - raise exception.InstanceNotFound(instance_id='fake') - - self.stubs.Set(volume.api.API, 'get_snapshot', fake_snapshot_get) - url = '/v2/fake/snapshots/70f6db34-de8d-4fbd-aafb-4065bdfa6115' - res = self._make_request(url) - - self.assertEqual(res.status_int, 404) - class ExtendedSnapshotAttributesXmlTest(ExtendedSnapshotAttributesTest): content_type = 'application/xml' -- 2.45.2