Creating metadef namespace with resource type raises 500 when called twice

Bug #1463036 reported by Kamil Rykowski on 2015-06-08
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Kamil Rykowski

Bug Description

When you are trying to create a namespace with associated resource type and you send the request to the API twice you will get 500 response on the second call. Interesting behavior, because if you just want to create a namespace without any associated resource type it will pass on every call.

Tested on the latest master branch.

URL: http://localhost:9292/v2/metadefs/namespaces
Method: POST
            "namespace": "MyNamespace",
            "display_name": "DisplayName",
            "resource_type_associations": [
                    "name": "MyResourceType"

File "/opt/stack/glance/glance/api/v2/", line 130, in create
  File "/opt/stack/glance/glance/domain/", line 378, in add
  File "/opt/stack/glance/glance/", line 744, in add
  File "/opt/stack/glance/glance/domain/", line 378, in add
  File "/opt/stack/glance/glance/api/", line 553, in add
    return super(MetadefResourceTypeRepoProxy, self).add(resource_type)
  File "/opt/stack/glance/glance/domain/", line 378, in add
  File "/opt/stack/glance/glance/db/", line 641, in add
  File "/opt/stack/glance/glance/db/sqlalchemy/", line 1623, in metadef_resource_type_association_create
    context, namespace_name, values, session)
  File "/opt/stack/glance/glance/db/sqlalchemy/metadef_api/", line 168, in create
    context, namespace_name, session)
  File "/opt/stack/glance/glance/db/sqlalchemy/metadef_api/", line 219, in get
    namespace_rec = _get_by_name(context, name, session)
  File "/opt/stack/glance/glance/db/sqlalchemy/metadef_api/", line 113, in _get_by_name
    namespace_rec =
  File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/", line 2407, in one
    "Multiple rows were found for one()")
MultipleResultsFound: Multiple rows were found for one()

Changed in glance:
status: New → In Progress

Change abandoned by Glance Bot (<email address hidden>) on branch: master

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers