From 3b016538ca6843bdd8cb6b06fc5e86d254d045f2 Mon Sep 17 00:00:00 2001 From: John Griffith Date: Wed, 20 Dec 2017 11:25:54 -0700 Subject: [PATCH] Add admin ctxt to request qos_specs in SolidFire We used to be able to call qos_specs_get without admin context, however something has changed and this now fails at the object layer in base:get_by_id. This means that now if one uses QoS-Specs with SolidFire and attempts to retype to another QoS Spec type, the call will fail with no response data due to a policy/permissions error. It turns out that the qos_specs.py api call will let you either pass in a context or pass in None and it implicitly gets an admin context. I prefer explicit behaviors, so add an explicit get admin context in the SF driver for this call. Change-Id: Idf10bfb8f5e738d7698233b7bdeaf45bef8914e2 Closes-Bug: #1738800 --- cinder/volume/drivers/solidfire.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cinder/volume/drivers/solidfire.py b/cinder/volume/drivers/solidfire.py index 64836833807..7bb11ab2bff 100644 --- a/cinder/volume/drivers/solidfire.py +++ b/cinder/volume/drivers/solidfire.py @@ -769,7 +769,13 @@ class SolidFireDriver(san.SanISCSIDriver): # and over-ride any existing # extra-specs settings if present if qos_specs_id is not None: - kvs = qos_specs.get_qos_specs(ctxt, qos_specs_id)['specs'] + # Policy changes require admin context to get QoS specs + # at the object layer (base:get_by_id), we can either + # explicitly promote here, or pass in a context of None + # and let the qos_specs api get an admin context for us + # personally I prefer explicit, so here ya go. + admin_ctxt = context.get_admin_context() + kvs = qos_specs.get_qos_specs(admin_ctxt, qos_specs_id)['specs'] else: kvs = specs