From: Eric Harney Date: Tue, 2 Apr 2013 13:23:05 +0000 (-0400) Subject: Throw InvalidSnapshot for failed snap delete X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=a4833cbc5657cc148d64ac10264f260a19969e1b;p=openstack-build%2Fcinder-build.git Throw InvalidSnapshot for failed snap delete When delete is called for a snapshot not in the "available" or "error" state, throw an InvalidSnapshot exception rather than InvalidVolume. Change-Id: I47f55b3357d75b5c0c9a704aaf693f4764fd112c --- diff --git a/cinder/tests/test_volume.py b/cinder/tests/test_volume.py index 47a238115..c6579f47e 100644 --- a/cinder/tests/test_volume.py +++ b/cinder/tests/test_volume.py @@ -520,7 +520,7 @@ class VolumeTestCase(test.TestCase): volume_api = cinder.volume.api.API() snapshot['status'] = 'badstatus' - self.assertRaises(exception.InvalidVolume, + self.assertRaises(exception.InvalidSnapshot, volume_api.delete_snapshot, self.context, snapshot) diff --git a/cinder/volume/api.py b/cinder/volume/api.py index 995276748..0dd0b3146 100644 --- a/cinder/volume/api.py +++ b/cinder/volume/api.py @@ -586,7 +586,7 @@ class API(base.Base): def delete_snapshot(self, context, snapshot, force=False): if not force and snapshot['status'] not in ["available", "error"]: msg = _("Volume Snapshot status must be available or error") - raise exception.InvalidVolume(reason=msg) + raise exception.InvalidSnapshot(reason=msg) self.db.snapshot_update(context, snapshot['id'], {'status': 'deleting'}) volume = self.db.volume_get(context, snapshot['volume_id'])