From 2ae0647920842e4c16137262dd7b140eed87a667 Mon Sep 17 00:00:00 2001 From: jichenjc Date: Mon, 25 Sep 2017 18:09:26 +0800 Subject: [PATCH] Remove duplicate error info when delete a standard resource class, we can meet with error: Unable to delete resource class VCPU: Unable to delete resource class VCPU which is duplicate. Trivial Fix Change-Id: Ib5a4bbb75affbb44eb28719b135a73903ce1a3de --- nova/api/openstack/placement/handlers/resource_class.py | 6 ++---- .../openstack/placement/gabbits/resource-class-in-use.yaml | 6 +++--- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/nova/api/openstack/placement/handlers/resource_class.py b/nova/api/openstack/placement/handlers/resource_class.py index d62ea16095e5..99a0dc0536c8 100644 --- a/nova/api/openstack/placement/handlers/resource_class.py +++ b/nova/api/openstack/placement/handlers/resource_class.py @@ -111,12 +111,10 @@ def delete_resource_class(req): rc.destroy() except exception.ResourceClassCannotDeleteStandard as exc: raise webob.exc.HTTPBadRequest( - _('Cannot delete standard resource class %(rp_name)s: %(error)s') % - {'rp_name': name, 'error': exc}) + _('Error in delete resource class: %(error)s') % {'error': exc}) except exception.ResourceClassInUse as exc: raise webob.exc.HTTPConflict( - _('Unable to delete resource class %(rp_name)s: %(error)s') % - {'rp_name': name, 'error': exc}) + _('Error in delete resource class: %(error)s') % {'error': exc}) req.response.status = 204 req.response.content_type = None return req.response diff --git a/nova/tests/functional/api/openstack/placement/gabbits/resource-class-in-use.yaml b/nova/tests/functional/api/openstack/placement/gabbits/resource-class-in-use.yaml index e96d0896e559..a641eb05d726 100644 --- a/nova/tests/functional/api/openstack/placement/gabbits/resource-class-in-use.yaml +++ b/nova/tests/functional/api/openstack/placement/gabbits/resource-class-in-use.yaml @@ -55,7 +55,7 @@ tests: DELETE: /resource_classes/CUSTOM_GOLD status: 409 response_strings: - - Unable to delete resource class + - Error in delete resource class - Class is in use in inventory - name: delete the allocation @@ -66,7 +66,7 @@ tests: DELETE: /resource_classes/CUSTOM_GOLD status: 409 response_strings: - - Unable to delete resource class + - Error in delete resource class - Class is in use in inventory - name: delete the inventory @@ -75,4 +75,4 @@ tests: - name: delete resource class DELETE: /resource_classes/CUSTOM_GOLD - status: 204 \ No newline at end of file + status: 204