From 678b9de0f43fa666946a064edc32f38514dfd593 Mon Sep 17 00:00:00 2001 From: Felipe Monteiro Date: Wed, 3 Jan 2018 04:18:02 +0000 Subject: [PATCH] Fix reserve volume enforcing the wrong policy action This PS fixes `reserve_volume` enforcing the wrong policy action: retype policy. It has been corrected to reserve volume policy. This is consistent with the policy in code documentation as well for both policies: retype is only enforced by os-retype and reserve is only enforced by os-reserve [0][1] [0] https://github.com/openstack/cinder/blob/94460b64fb06814e18a4459e365cf207b730210b/cinder/policies/volume_actions.py#L91 [1] https://github.com/openstack/cinder/blob/94460b64fb06814e18a4459e365cf207b730210b/cinder/policies/volume_actions.py#L197 Change-Id: I14b8288cdb066f30b66068dcaaf66e1277aa122f --- cinder/volume/api.py | 2 +- .../notes/fix-reserve-volume-policy-31790a8d865ee0a1.yaml | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 releasenotes/notes/fix-reserve-volume-policy-31790a8d865ee0a1.yaml diff --git a/cinder/volume/api.py b/cinder/volume/api.py index be35e3a340d..7d829ee5aef 100644 --- a/cinder/volume/api.py +++ b/cinder/volume/api.py @@ -670,7 +670,7 @@ class API(base.Base): return snapshots def reserve_volume(self, context, volume): - context.authorize(vol_action_policy.RETYPE_POLICY, target_obj=volume) + context.authorize(vol_action_policy.RESERVE_POLICY, target_obj=volume) expected = {'multiattach': volume.multiattach, 'status': (('available', 'in-use') if volume.multiattach else 'available')} diff --git a/releasenotes/notes/fix-reserve-volume-policy-31790a8d865ee0a1.yaml b/releasenotes/notes/fix-reserve-volume-policy-31790a8d865ee0a1.yaml new file mode 100644 index 00000000000..cb9bad9d87e --- /dev/null +++ b/releasenotes/notes/fix-reserve-volume-policy-31790a8d865ee0a1.yaml @@ -0,0 +1,5 @@ +--- +fixes: + - | + The reserve volume API was incorrectly enforcing "volume:retype" policy + action. It has been corrected to "volume_extension:volume_actions:reserve".