Bug 1041103

Summary: [RFE][nova]: Support remove a nova compute from nova compute
Product: Red Hat OpenStack Reporter: RHOS Integration <rhos-integ>
Component: openstack-novaAssignee: RHOS Maint <rhos-maint>
Status: CLOSED ERRATA QA Contact: Omri Hochman <ohochman>
Severity: medium Docs Contact:
Priority: high    
Version: unspecifiedCC: dshah, markmc, ndipanov, ohochman, rhos-maint, sgordon, slong, sputhenp, yeylon
Target Milestone: Upstream M3Keywords: FutureFeature, Triaged
Target Release: 5.0 (RHEL 7)   
Hardware: Unspecified   
OS: Unspecified   
URL: https://blueprints.launchpad.net/nova/+spec/remove-nova-compute
Whiteboard: upstream_milestone_icehouse-3 upstream_status_implemented upstream_definition_approved
Fixed In Version: Doc Type: Enhancement
Doc Text:
The Compute API now exposes a mechanism for permanently removing decommissioned compute nodes. Previously, decommissioned nodes would continue to be listed even if the compute service had been disabled and the system re-provisioned. The removal functionality is provided by the "ExtendedServicesDelete" API extension.
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-07-08 15:27:21 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description RHOS Integration 2013-12-12 13:38:41 UTC
Cloned from launchpad blueprint https://blueprints.launchpad.net/nova/+spec/remove-nova-compute.

Description:

Current in openstack, there is no command to remove a nova compute node from openstack cluster. So if customer do not want to use the nova compute, then once nova compute service was down on this node or this node was re-provisioned, "nova service-list" or "nova-manage service list" still show the node.

It is better that introduce a new REST API to remove nova compute.


Specification URL (additional information):

None

Comment 4 Xavier Queralt 2014-04-07 15:04:05 UTC
It looks like this feature has not been implemented in the nova CLI. It will be a bit harder to verify but it is not impossible:

1. With an AIO deployment, check the currently available services:

[stack@devstack1 devstack]$ nova service-list
+----+------------------+-----------+----------+---------+-------+----------------------------+-----------------+
| Id | Binary           | Host      | Zone     | Status  | State | Updated_at                 | Disabled Reason |
+----+------------------+-----------+----------+---------+-------+----------------------------+-----------------+
| 1  | nova-conductor   | devstack1 | internal | enabled | up    | 2014-04-07T14:09:41.000000 | -               |
| 2  | nova-cert        | devstack1 | internal | enabled | up    | 2014-04-07T14:09:43.000000 | -               |
| 3  | nova-network     | devstack1 | internal | enabled | up    | 2014-04-07T14:09:34.000000 | -               |
| 4  | nova-scheduler   | devstack1 | internal | enabled | up    | 2014-04-07T14:09:36.000000 | -               |
| 5  | nova-compute     | devstack1 | nova     | enabled | up    | 2014-04-07T14:09:41.000000 | -               |
| 6  | nova-consoleauth | devstack1 | internal | enabled | up    | 2014-04-07T14:09:41.000000 | -               |
+----+------------------+-----------+----------+---------+-------+----------------------------+-----------------+

2. Stop the compute service (it should work with any other service) and wait for a while until it changes to the "down" state:

[stack@devstack1 devstack]$ sudo service openstack-nova-compute stop
[stack@devstack1 devstack]$ nova service-list
+----+------------------+-----------+----------+---------+-------+----------------------------+-----------------+
| Id | Binary           | Host      | Zone     | Status  | State | Updated_at                 | Disabled Reason |
+----+------------------+-----------+----------+---------+-------+----------------------------+-----------------+
| 1  | nova-conductor   | devstack1 | internal | enabled | up    | 2014-04-07T14:12:11.000000 | -               |
| 2  | nova-cert        | devstack1 | internal | enabled | up    | 2014-04-07T14:12:03.000000 | -               |
| 3  | nova-network     | devstack1 | internal | enabled | up    | 2014-04-07T14:12:04.000000 | -               |
| 4  | nova-scheduler   | devstack1 | internal | enabled | up    | 2014-04-07T14:12:06.000000 | -               |
| 5  | nova-compute     | devstack1 | nova     | enabled | down  | 2014-04-07T14:11:11.000000 | -               |
| 6  | nova-consoleauth | devstack1 | internal | enabled | up    | 2014-04-07T14:12:11.000000 | -               |
+----+------------------+-----------+----------+---------+-------+----------------------------+-----------------+

3. Save the id of the service you want to delete:

[stack@devstack1 devstack1]$ SERVICE_ID=5

4. With the openstack-client (if not installed see [1]) get the endpoint and the auth token to be able to talk with the API:

[stack@devstack1 devstack1]$ COMPUTE_ENDPOINT=$(openstack endpoint show compute -f value)
[stack@devstack1 devstack1]$ AUTH_TOKEN=$(openstack token create -c id -f value)

5. Run the following command, which uses curl, to delete the service from the service list:

[stack@devstack1 devstack1]$ curl -i "$COMPUTE_ENDPOINT/os-services/$SERVICE_ID" -X DELETE -H "X-Auth-Project-Id: admin" -H "X-Auth-Token: $AUTH_TOKEN"

6. Check again the available services and notice that the nova-compute service is not listed any more:

[stack@devstack1 devstack]$ nova service-list
+----+------------------+-----------+----------+---------+-------+----------------------------+-----------------+
| Id | Binary           | Host      | Zone     | Status  | State | Updated_at                 | Disabled Reason |
+----+------------------+-----------+----------+---------+-------+----------------------------+-----------------+
| 1  | nova-conductor   | devstack1 | internal | enabled | up    | 2014-04-07T14:12:11.000000 | -               |
| 2  | nova-cert        | devstack1 | internal | enabled | up    | 2014-04-07T14:12:03.000000 | -               |
| 3  | nova-network     | devstack1 | internal | enabled | up    | 2014-04-07T14:12:04.000000 | -               |
| 4  | nova-scheduler   | devstack1 | internal | enabled | up    | 2014-04-07T14:12:06.000000 | -               |
| 6  | nova-consoleauth | devstack1 | internal | enabled | up    | 2014-04-07T14:12:11.000000 | -               |
+----+------------------+-----------+----------+---------+-------+----------------------------+-----------------+


[1] To install the openstack-client for your user, you'll need the python-pip package. Once installed, run "pip install --user python-openstackclient"

Comment 5 Omri Hochman 2014-04-08 13:21:32 UTC
Tested on RHEL7.0 with RDO Ice_House (openstack-nova-2014.1-0.13.b3) http://repos.fedorapeople.org/repos/openstack/openstack-icehouse/epel-7/



Before: 
--------
nova service-list
-+----------------------------+-----------------+
| Binary           | Host                          | Zone     | Status  | State | Updated_at                 | Disabled Reason |
+------------------+-------------------------------+----------+---------+-------+----------------------------+-----------------+
| nova-consoleauth | puma36.scl.lab.tlv.redhat.com | internal | enabled | up    | 2014-04-08T13:05:03.000000 | -               |
| nova-scheduler   | puma36.scl.lab.tlv.redhat.com | internal | enabled | up    | 2014-04-08T13:05:03.000000 | -               |
| nova-conductor   | puma36.scl.lab.tlv.redhat.com | internal | enabled | up    | 2014-04-08T13:05:02.000000 | -               |
| nova-cert        | puma36.scl.lab.tlv.redhat.com | internal | enabled | up    | 2014-04-08T13:05:04.000000 | -               |
| nova-compute     | puma36.scl.lab.tlv.redhat.com | nova     | enabled | down  | 2014-04-08T13:03:52.000000 | -               |
+------------------+-------------------------------+----------+---------+-------

[root@puma36 ~(keystone_admin)]# curl -i "$COMPUTE_ENDPOINT/os-services/$SERVICE_ID" -X DELETE -H "X-Auth-Project-Id: admin" -H "X-Auth-Token: $AUTH_TOKEN"
HTTP/1.1 204 No Content
Content-Length: 0
Content-Type: application/json
X-Compute-Request-Id: req-fdfbffa3-d89e-4207-8ff5-78183b6733e5
Date: Tue, 08 Apr 2014 13:15:22 GMT


After:
-------
[root@puma36 ~(keystone_admin)]# nova service-list
+------------------+-------------------------------+----------+---------+-------+----------------------------+-----------------+
| Binary           | Host                          | Zone     | Status  | State | Updated_at                 | Disabled Reason |
+------------------+-------------------------------+----------+---------+-------+----------------------------+-----------------+
| nova-consoleauth | puma36.scl.lab.tlv.redhat.com | internal | enabled | up    | 2014-04-08T13:15:44.000000 | -               |
| nova-scheduler   | puma36.scl.lab.tlv.redhat.com | internal | enabled | up    | 2014-04-08T13:15:43.000000 | -               |
| nova-conductor   | puma36.scl.lab.tlv.redhat.com | internal | enabled | up    | 2014-04-08T13:15:42.000000 | -               |
| nova-cert        | puma36.scl.lab.tlv.redhat.com | internal | enabled | up    | 2014-04-08T13:15:44.000000 | -               |
+------------------+-------------------------------+----------+---------+-------+----------------------------+-----------------+

Comment 6 Xavier Queralt 2014-04-09 13:45:49 UTC
The service-delete subcommand has been added in novaclient (See [1]) and it should be included in the next upstream release (probably 2.18.0). Once available, deleting a service from the database should be as easy as:

$ nova service-delete <service_id>

[1] https://blueprints.launchpad.net/python-novaclient/+spec/support-delete-service

Comment 9 errata-xmlrpc 2014-07-08 15:27:21 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHEA-2014-0853.html