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
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user