From: John Griffith Date: Thu, 28 Feb 2013 19:01:39 +0000 (+0000) Subject: Elevate context for delete volume with no host. X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=a2830e5417539980249e3ab12d8bf9538d8956c4;p=openstack-build%2Fcinder-build.git Elevate context for delete volume with no host. 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 --- diff --git a/cinder/volume/api.py b/cinder/volume/api.py index 47af1a706..2a7a61c86 100644 --- a/cinder/volume/api.py +++ b/cinder/volume/api.py @@ -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)