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
This commit is contained in:
Eric Harney
2013-04-02 09:23:05 -04:00
parent 3aa947d763
commit a4833cbc56
2 changed files with 2 additions and 2 deletions

View File

@@ -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'])