From 611224db1821af08e4ec022cbe89d327c084382c Mon Sep 17 00:00:00 2001 From: Akihiro Motoki Date: Sun, 10 Feb 2019 08:31:08 +0900 Subject: [PATCH] Quote cinder qos-spec key name In "Manage Specs" table of "Volume Types" panel, when a key name of a QoS spec contains multiple spaces the QoS spec cannot be deleted because multiple spaces in the key name are reduced into a single space by the "minifyspace" templatetag. "minifyspace" itself is useful, so it looks better to escape a key name of a QoS spec to keep multiple spaces. This commit escapes a key name of a QoS spec by using urllib.parse.quote(). Change-Id: Id11080e2a4284d69b8afb5c554728a98e024289f Closes-Bug: #1811644 --- .../dashboards/admin/volume_types/qos_specs/tables.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/openstack_dashboard/dashboards/admin/volume_types/qos_specs/tables.py b/openstack_dashboard/dashboards/admin/volume_types/qos_specs/tables.py index cf687b1ae1..aaa8354334 100644 --- a/openstack_dashboard/dashboards/admin/volume_types/qos_specs/tables.py +++ b/openstack_dashboard/dashboards/admin/volume_types/qos_specs/tables.py @@ -13,6 +13,7 @@ from django.urls import reverse from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ungettext_lazy +from six.moves.urllib import parse from horizon import tables @@ -49,12 +50,13 @@ class SpecDeleteKeyValuePair(tables.DeleteAction): count ) - def delete(self, request, obj_ids): + def delete(self, request, obj_id): qos_spec_id = self.table.kwargs['qos_spec_id'] # use "unset" api to remove this key-value pair from QOS Spec + key = parse.unquote(obj_id) api.cinder.qos_spec_unset_keys(request, qos_spec_id, - [obj_ids]) + [key]) # redirect to non-modal page def get_success_url(self, request=None): @@ -83,7 +85,7 @@ class SpecsTable(tables.DataTable): row_actions = (SpecEditKeyValuePair, SpecDeleteKeyValuePair) def get_object_id(self, datum): - return datum.key + return parse.quote(datum.key) def get_object_display(self, datum): return datum.key