Fix issue where qos delete action returns error message

Code was incorrectly removed from the final patchset where the delete
action was implemented for the qos panel. This results in an error
occurring when users try to delete a policy. This patch removed this
error and restores normal and expected functionality.

Change-Id: I7f4c221fd48e5fd5c268f5150ae6f3ed2bf1bacd
Closes-bug: #1785809
This commit is contained in:
Beth Elwell 2018-08-07 12:41:59 +01:00
parent 6dc9509d50
commit 5910b6b90d
3 changed files with 31 additions and 0 deletions

View File

@ -1967,6 +1967,12 @@ def policy_get(request, policy_id, **kwargs):
return QoSPolicy(policy)
@profiler.trace
def policy_delete(request, policy_id):
"""Delete QoS policy for a given policy id."""
neutronclient(request).delete_qos_policy(policy_id)
@profiler.trace
def list_availability_zones(request, resource=None, state=None):
az_list = neutronclient(request).list_availability_zones().get(

View File

@ -38,6 +38,7 @@
createNetwork: createNetwork,
createSubnet: createSubnet,
createTrunk: createTrunk,
deletePolicy: deletePolicy,
deleteTrunk: deleteTrunk,
getAgents: getAgents,
getDefaultQuotaSets: getDefaultQuotaSets,
@ -390,6 +391,21 @@
});
}
/**
* @name deletePolicy
* @description
* Delete a single neutron qos policy.
* @param {string} policyId
* Specifies the id of the policy to be deleted.
*/
function deletePolicy(policyId, suppressError) {
var promise = apiService.delete('/api/neutron/qos_policies/' + policyId + '/');
promise = suppressError ? promise : promise.error(function() {
var msg = gettext('Unable to delete qos policy %(id)s');
toastService.add('error', interpolate(msg, { id: policyId }, true));
});
return promise;
}
// Trunks
/**

View File

@ -310,6 +310,15 @@
{"project_id": 1}
],
"error": "Unable to retrieve the qos policies."
},
{
"func": "deletePolicy",
"method": "delete",
"path": "/api/neutron/qos_policies/63/",
"error": "Unable to delete qos policy 63",
"testInput": [
63
]
}
];