Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Be sure to migrate the instance before you remove the service.

The tricky part is to remove (decommission) a nova-compute service from the openstack hypervisor list. Not sure about Havana, but in Icehouse there's a freshly added API extension for that. It might also work in Havana, though. Sure, you could also just remove entries from the database, but that's gnarly.

As far as I know there's no novaclient python module support for that API call yet, so you might have to call it via raw HTTP call, as show below:

(code is a courtesy of a colleague of mine, thanks N.!)

1st, get the token from keystone:

(Use a tenant for which you have admin privileges.)

curl -d '{"auth":{"passwordCredentials":{"username": "admin","password": "42"},"tenantName": "myTenant"}}'  -H "Content-Type: application/json" http://openstack:5000/v2.0/tokens

2nd, identify the id of the compute service you want to remove

(do this one way, or the other. Here's what worked for us -- using novaclient python module)

import novaclient.v1_1.client as nvclient
nova = nvclient.Client(**creds)
services = nova.services.list()
for service in services:
   if service.host == "node-to-remove": print service.id

3rd, get the tenant-id (you will need it later)

keystone tenant-list | grep myTenant

4th, use token, tenant-id, and the service-id to gracefully remove service from nova

curl -i -H "Content-Type: application/json" -X DELETE http://openstack:8774/v2/{tenant-id}/os-services/{service-id} -H "User-Agent: python-keystoneclient" -H "X-Auth-Token: {token}"

You're done.

If everything worked fine, you should no longer see your nova-compute service in the output of the

nova service-list

nor in the hypervisor list in the dashboard.