From a2830e5417539980249e3ab12d8bf9538d8956c4 Mon Sep 17 00:00:00 2001 From: John Griffith Date: Thu, 28 Feb 2013 19:01:39 +0000 Subject: [PATCH] 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 --- cinder/volume/api.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) 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) -- 2.45.2