diff --git a/nova/api/openstack/placement/handlers/resource_class.py b/nova/api/openstack/placement/handlers/resource_class.py index affdd0f31b98..af0c8cd96c5f 100644 --- a/nova/api/openstack/placement/handlers/resource_class.py +++ b/nova/api/openstack/placement/handlers/resource_class.py @@ -183,7 +183,7 @@ def update_resource_class(req): except exception.ResourceClassExists: raise webob.exc.HTTPConflict( _('Resource class already exists: %(name)s') % - {'name': name}, + {'name': rc.name}, json_formatter=util.json_error_formatter) except exception.ResourceClassCannotUpdateStandard: raise webob.exc.HTTPBadRequest( diff --git a/nova/tests/functional/api/openstack/placement/gabbits/resource-classes.yaml b/nova/tests/functional/api/openstack/placement/gabbits/resource-classes.yaml index fda14a4860cd..6c3c37e9b368 100644 --- a/nova/tests/functional/api/openstack/placement/gabbits/resource-classes.yaml +++ b/nova/tests/functional/api/openstack/placement/gabbits/resource-classes.yaml @@ -151,6 +151,7 @@ tests: status: 409 response_strings: - Resource class already exists + - $ENVIRON['CUSTOM_RES_CLASS'] - name: update custom resource class PUT: /resource_classes/$ENVIRON['CUSTOM_RES_CLASS']