]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Elevate context for delete volume with no host.
authorJohn Griffith <john.griffith@solidfire.com>
Thu, 28 Feb 2013 19:01:39 +0000 (19:01 +0000)
committerJohn Griffith <john.griffith@solidfire.com>
Thu, 28 Feb 2013 19:06:38 +0000 (19:06 +0000)
So in the case of a volume that is placed in error state
on create and never actually deployed, the cinder.volume.api delete
call does a short cut call to db.destroy_volume which is fine because
all we have is a DB entry (scheduler never deployed the volume).

Unfortunately, this requires admin context, so just add an elevate
context to the db.destroy_volume call.

Fixes bug: 1084273

Change-Id: I0ef8bf4356047c385bef703b8dce7d5edf537bf6

cinder/volume/api.py

index 47af1a706da790fbfc42ec67fc44e228a9658feb..2a7a61c8647d92be8197c5347559b799506af5fc 100644 (file)
@@ -287,8 +287,7 @@ class API(base.Base):
             except Exception:
                 reservations = None
                 LOG.exception(_("Failed to update quota for deleting volume"))
-
-            self.db.volume_destroy(context, volume_id)
+            self.db.volume_destroy(context.elevated(), volume_id)
 
             if reservations:
                 QUOTAS.commit(context, reservations)