Ask Your Question

Revision history [back]

I don't have a definite answer, but a lot to write, so I am using the answer field.

It would appear that the Placement service has already an entry with the name of your compute host, openstack. This is strange; I speculate that you installed Packstack once, perhaps incompletely. This filled the Placement database, then you performed another installation on top of that.

Below are my suggestions for repairing your current situation. I think it's a useful exercise with a learning effect, but you may also opt for simply doing a reinstallation from scratch (i.e., reinstall the OS to ensure everything is wiped out, then Packstack).

The Placement service has a CLI, but I didn't get it to work on my Queens-based devstack. The command to list the resource providers is openstack resource providers list. If that doesn't work, use the API:

$ openstack catalog list
$ PLACEMENT_ENDPOINT=placement-endpoint-returned-by-previous-command
$ openstack token issue -f value -c id
$ TOKEN=the-token-returned-by-the-previous-command
$ curl ${PLACEMENT_ENDPOINT}/resource_providers -H "x-auth-token: $TOKEN" | python -m json.tool

This returns the resource provider's UUID. Under normal circumstances, it should be the same as the UUID returned by nova hypervisor-list. My guess is that it is not so in your case.

Armed with this UUID, you can remove the resource provider, then restart nova-compute. My hope is that it can register with the Placement service at this point.

The API to delete a resource provider:

$ UUID=uuid-of-resource-provider-named-openstack
$ curl ${PLACEMENT_ENDPOINT}/resource_providers/$UUID -H "x-auth-token: $TOKEN" -X DELETE

In case this doesn't work because there are allocations, list those allocations:

$ curl ${PLACEMENT_ENDPOINT}/resource_providers/${UUID}/allocations -H "x-auth-token: $TOKEN"

This returns a list of the instance(s) that use(s) this resource provider. Delete those instances. If they don't exist (likely), delete the allocations:

$ CONSUMER=uuid-of-allocation-consumer-from-previous-API
$ curl ${PLACEMENT_ENDPOINT}/allocations/$CONSUMER -H "x-auth-token: $TOKEN" -X DELETE

I have successfully tested these steps on the above-mentioned Devstack, except for the last one.

I don't have a definite answer, but a lot to write, so I am using the answer field.

It would appear that the Placement service has already an entry with the name of your compute host, openstack. This is strange; I speculate that you installed Packstack once, perhaps incompletely. This filled the Placement database, then you performed another installation on top of that.

Below are my suggestions for repairing your current situation. I think it's a useful exercise with a learning effect, but you may also opt for simply doing a reinstallation from scratch (i.e., reinstall the OS to ensure everything is wiped out, then Packstack).

The Placement service has a CLI, but I didn't get it to work on my Queens-based devstack. The command to list the resource providers is openstack resource providers list. If that doesn't work, use the API:

$ openstack catalog list
$ PLACEMENT_ENDPOINT=placement-endpoint-returned-by-previous-command
$ openstack token issue -f value -c id
$ TOKEN=the-token-returned-by-the-previous-command
$ curl ${PLACEMENT_ENDPOINT}/resource_providers -H "x-auth-token: $TOKEN" | python -m json.tool

This returns the resource provider's UUID. Under normal circumstances, it should be the same as the UUID returned by nova hypervisor-list. My guess is that it is not so in your case.

Armed with this UUID, you can remove the resource provider, then restart nova-compute. My hope is that it can register with the Placement service at this point.

The API to delete a resource provider:

$ UUID=uuid-of-resource-provider-named-openstack
$ curl ${PLACEMENT_ENDPOINT}/resource_providers/$UUID -H "x-auth-token: $TOKEN" -X DELETE

In case this doesn't work because there are allocations, list those allocations:

$ curl ${PLACEMENT_ENDPOINT}/resource_providers/${UUID}/allocations -H "x-auth-token: $TOKEN"

This returns a list of the instance(s) that use(s) this resource provider. Delete those instances. If they don't exist (likely), delete the allocations:

$ CONSUMER=uuid-of-allocation-consumer-from-previous-API
$ curl ${PLACEMENT_ENDPOINT}/allocations/$CONSUMER -H "x-auth-token: $TOKEN" -X DELETE

I have successfully tested these steps on the above-mentioned Devstack, except for the last one.

EDIT:

Your scenario fits my speculation. You installed Packstack once, creating a Placement service record for openstack. Then you installed it again without resetting the database. When your host tries to register with the Placement service, this fails because of the pre-existing resource provider record.

Now, you fixed the Placement problem, but I fear you will run into other problems caused by installing Packstack on an existing database.

How I learned all that? Thanks for flattering me. I started learning OpenStack about 4.5 years ago in order to teach training courses. Apart from curiosity, expanding my business was a great motivator:) The learning curve was steep but fun. OpenStack continues to be a hobby and also brings in some revenue. Hire me :)

I also learn a lot by answering questions on ask.openstack.org. Thanks to your problem, for example, I know now that there is a Placement CLI, even though it doesn't work on my cloud. Perhaps it needs Rocky, or it's requires additional work for setting up.

docs.openstack.org contains 80% of what I know (the rest is thanks to my genius). It's not well organized, has gaps and is sometimes outdated, so you require a lot of searching and some experience to find information there. The Placement service was released at Newton if I remember well, and I had to research it because I created a presentation about new features in Newton. It's fairly well documented at https://docs.openstack.org/nova/latest/user/placement.html. There are many tutorials out there how to use OpenStack APIs directly with curl, for example https://developer.openstack.org/api-guide/compute/index.html.

Other learning resources: Some summit videos are pure art and very helpful. Many OpenStack developers have blogs with interesting information. Examples: I learned a lot about Networking from Assaf Muller, and about Identity from Adam Young. The main problem is overload - finding the good stuff in a sea of average to mediocre information.