From 1f546af6ffc8f51f7ac2546fb9456cdac86082b1 Mon Sep 17 00:00:00 2001 From: Masaki Kanno Date: Sun, 4 Oct 2015 15:57:22 +0900 Subject: [PATCH] Delete a temporary volume in DB with admin context Non-disruptive backup creates a temporary volume. Information of the volume will be deleted from DB if the volume cannot be created by drivers. volume_destroy method is used in order to delete the information. We must elevate the context to admin context because the method requests admin context. Change-Id: Ie5cd935cdd9e13c261708e504fa6fb2622a8aebb Closes-Bug: 1502460 --- cinder/volume/driver.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cinder/volume/driver.py b/cinder/volume/driver.py index fe45be1a2..901f9450c 100644 --- a/cinder/volume/driver.py +++ b/cinder/volume/driver.py @@ -1234,7 +1234,8 @@ class BaseVD(object): self.create_cloned_volume(temp_vol_ref, volume) except Exception: with excutils.save_and_reraise_exception(): - self.db.volume_destroy(context, temp_vol_ref['id']) + self.db.volume_destroy(context.elevated(), + temp_vol_ref['id']) self.db.volume_update(context, temp_vol_ref['id'], {'status': 'available'}) -- 2.45.2