Conflict occurred attempting to store project.

Bug #1288514 reported by Steve Baker
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Heat
Fix Released
High
Steve Baker

Bug Description

This happens the second time I launch a stack with the same name "a".

Possibly the deleting of the first project didn't happen, which left a project in place with an exclusive name.

It might be more appropriate to use the stack ID instead of the stack name to ensure this never happens, otherwise if there is an existing project then maybe it should be reused.

2014-03-06 15:12:15.407 ERROR heat.engine.resource [-] CREATE : Server "server" Stack "a" [fe38dd34-1814-4a4f-b936-5ca8c5b4956b]
2014-03-06 15:12:15.407 TRACE heat.engine.resource Traceback (most recent call last):
2014-03-06 15:12:15.407 TRACE heat.engine.resource File "/home/steveb/dev/localstack/heat/heat/engine/resource.py", line 417, in _do_action
2014-03-06 15:12:15.407 TRACE heat.engine.resource handle())
2014-03-06 15:12:15.407 TRACE heat.engine.resource File "/home/steveb/dev/localstack/heat/heat/engine/resources/server.py", line 469, in handle_create
2014-03-06 15:12:15.407 TRACE heat.engine.resource self._create_transport_credentials()
2014-03-06 15:12:15.407 TRACE heat.engine.resource File "/home/steveb/dev/localstack/heat/heat/engine/resources/server.py", line 386, in _create_transport_credentials
2014-03-06 15:12:15.407 TRACE heat.engine.resource self._create_user()
2014-03-06 15:12:15.407 TRACE heat.engine.resource File "/home/steveb/dev/localstack/heat/heat/engine/stack_user.py", line 44, in _create_user
2014-03-06 15:12:15.407 TRACE heat.engine.resource stack_name=self.stack.name)
2014-03-06 15:12:15.407 TRACE heat.engine.resource File "/home/steveb/dev/localstack/heat/heat/common/heat_keystoneclient.py", line 387, in create_stack_domain_project
2014-03-06 15:12:15.407 TRACE heat.engine.resource description=desc)
2014-03-06 15:12:15.407 TRACE heat.engine.resource File "/home/steveb/dev/localstack/python-keystoneclient/keystoneclient/v3/projects.py", line 60, in create
2014-03-06 15:12:15.407 TRACE heat.engine.resource **kwargs)
2014-03-06 15:12:15.407 TRACE heat.engine.resource File "/home/steveb/dev/localstack/python-keystoneclient/keystoneclient/base.py", line 66, in func
2014-03-06 15:12:15.407 TRACE heat.engine.resource return f(*args, **new_kwargs)
2014-03-06 15:12:15.407 TRACE heat.engine.resource File "/home/steveb/dev/localstack/python-keystoneclient/keystoneclient/base.py", line 314, in create
2014-03-06 15:12:15.407 TRACE heat.engine.resource self.key)
2014-03-06 15:12:15.407 TRACE heat.engine.resource File "/home/steveb/dev/localstack/python-keystoneclient/keystoneclient/base.py", line 142, in _create
2014-03-06 15:12:15.407 TRACE heat.engine.resource return self._post(url, body, response_key, return_raw)
2014-03-06 15:12:15.407 TRACE heat.engine.resource File "/home/steveb/dev/localstack/python-keystoneclient/keystoneclient/base.py", line 155, in _post
2014-03-06 15:12:15.407 TRACE heat.engine.resource resp, body = self.client.post(url, body=body)
2014-03-06 15:12:15.407 TRACE heat.engine.resource File "/home/steveb/dev/localstack/python-keystoneclient/keystoneclient/httpclient.py", line 584, in post
2014-03-06 15:12:15.407 TRACE heat.engine.resource return self._cs_request(url, 'POST', **kwargs)
2014-03-06 15:12:15.407 TRACE heat.engine.resource File "/home/steveb/dev/localstack/python-keystoneclient/keystoneclient/httpclient.py", line 575, in _cs_request
2014-03-06 15:12:15.407 TRACE heat.engine.resource **kwargs)
2014-03-06 15:12:15.407 TRACE heat.engine.resource File "/home/steveb/dev/localstack/python-keystoneclient/keystoneclient/httpclient.py", line 554, in request
2014-03-06 15:12:15.407 TRACE heat.engine.resource resp = super(HTTPClient, self).request(url, method, **kwargs)
2014-03-06 15:12:15.407 TRACE heat.engine.resource File "/home/steveb/dev/localstack/python-keystoneclient/keystoneclient/baseclient.py", line 21, in request
2014-03-06 15:12:15.407 TRACE heat.engine.resource return self.session.request(url, method, **kwargs)
2014-03-06 15:12:15.407 TRACE heat.engine.resource File "/home/steveb/dev/localstack/python-keystoneclient/keystoneclient/session.py", line 209, in request
2014-03-06 15:12:15.407 TRACE heat.engine.resource raise exceptions.from_response(resp, method, url)
2014-03-06 15:12:15.407 TRACE heat.engine.resource Conflict: Conflict occurred attempting to store project. (IntegrityError) (1062, "Duplicate entry '0f630bf3108d4d7486631790ef01fe2b-6b14579e2514449c82439c043afacc3' for key 'domain_id'") 'INSERT INTO project (id, name, domain_id, description, enabled, extra) VALUES (%s, %s, %s, %s, %s, %s)' ('34f7e4c7d2d14bbc87acd5233ed57913', '6b14579e2514449c82439c043afacc3b-a', '0f630bf3108d4d7486631790ef01fe2b', 'Heat stack user project', 1, '{}') (HTTP 409)

Changed in heat:
status: New → Triaged
importance: Undecided → High
milestone: none → icehouse-rc1
lvdongbing (dbcocle)
Changed in heat:
assignee: nobody → lvdongbing (dbcocle)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to heat (master)

Fix proposed to branch: master
Review: https://review.openstack.org/78503

Changed in heat:
assignee: lvdongbing (dbcocle) → Steve Baker (steve-stevebaker)
status: Triaged → In Progress
Revision history for this message
Steven Hardy (shardy) wrote :

Is this happening repeatably?

I'd like to know why the delete isn't working, as we really don't want to routinely leak projects ...

Revision history for this message
Steve Baker (steve-stevebaker) wrote :

What openstackclient command can be run to list the projects in the domain? I'll run it periodically to see if they are leaking

Revision history for this message
Steven Hardy (shardy) wrote :

@stevebaker: This works for me:

openstack --os-token foobar --os-url=http://127.0.0.1:5000/v3 --os-identity-api-version=3 project list

That lists projects from all domains. There currently doesn't seem to be the option in openstackclient to filter by domain, although the option does exist in the underlying keystoneclient python API

Revision history for this message
Steven Hardy (shardy) wrote :

Patch adding --domain filtering to openstack project list

https://review.openstack.org/79040

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to heat (master)

Reviewed: https://review.openstack.org/78503
Committed: https://git.openstack.org/cgit/openstack/heat/commit/?id=d44273bfcd1612b843b0c084e4aa2927ba8abd1c
Submitter: Jenkins
Branch: master

commit d44273bfcd1612b843b0c084e4aa2927ba8abd1c
Author: Steve Baker <email address hidden>
Date: Thu Mar 6 15:44:42 2014 +1300

    Use stack ID to create domain project name

    If the project for a given stack didn't get deleted for any reason then
    launching a stack with the same name will fail as project names
    are enforced to be unique.

    By using the stack ID instead this issue is avoided if the project delete
    didn't occur.

    The resulting project name is truncated to the limit of 64.

    Change-Id: Iba09cf94bdaa6a92d9520ed1743805862dc1b14d
    Closes-Bug: #1288514

Changed in heat:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in heat:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in heat:
milestone: icehouse-rc1 → 2014.1
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.