openstack中删除一个计算节点

来源:互联网 发布:vivian maire 知乎 编辑:程序博客网 时间:2024/06/06 07:40

题记:


在我们学习openstack知识过程中,经常会部署几台物理服务器,但是也有可能某些物理服务器另作他用,也就是物理服务器修改IP或者角色转换,但是可能这些物理服务器作为宿主机(计算节点)还包含了已经运行的虚拟机实例,类似这种情况,我们无法直接将计算节点暴力清除(也就是断开网络),这样操作会出现一个问题就是,实际的计算节点信息在数据库中并没有清除,导致我们在创建新的虚拟机服务器默认还会进行调度,但是实际这些计算节点是不存在的,所以我们需要有步骤的对这些进行操作。


1,删除实例

sm@controller:~$ nova list+--------------------------------------+--------------------------------------------+---------+------------+-------------+---------------------------+| ID                                   | Name                                       | Status  | Task State | Power State | Networks                  |+--------------------------------------+--------------------------------------------+---------+------------+-------------+---------------------------+| 0d9d319b-3387-4ee1-93db-d98f03c20621 | devstack_icehouse                          | SHUTOFF | -          | Shutdown    | sharednet1=192.168.12.105 || decf3b3b-2bc7-4bb3-af0e-ef12479778b6 | hadoop                                     | ACTIVE  | -          | Running     | sharednet1=192.168.12.125 || e0482e04-7c85-45cf-97a0-7ef0f0203871 | idesktop                                   | SHUTOFF | -          | Shutdown    | sharednet1=192.168.12.112 || 088844ae-c012-4d35-83d0-dc3a06a1ef8a | mq_ha-088844ae-c012-4d35-83d0-dc3a06a1ef8a | ACTIVE  | -          | Running     | sharednet1=192.168.12.129 || 0b095133-8c76-4a8c-acfd-a66948920089 | mq_ha-0b095133-8c76-4a8c-acfd-a66948920089 | ACTIVE  | -          | Running     | sharednet1=192.168.12.131 || 4b1c2010-3a9e-42b8-971d-86118c108f2d | mq_ha-4b1c2010-3a9e-42b8-971d-86118c108f2d | ACTIVE  | -          | Running     | sharednet1=192.168.12.130 || 582dddf4-5d33-4689-a946-d5958aa263d6 | ubuntu1404_server_LIWH                     | ACTIVE  | -          | Running     | sharednet1=192.168.12.143 || 6c16999c-e94a-4947-8489-1333d28862f8 | vm2                                        | ACTIVE  | -          | Running     | sharednet1=192.168.12.116 |+--------------------------------------+--------------------------------------------+---------+------------+-------------+---------------------------+sm@controller:~$ nova delete devstack_icehouse


2,移除nova-compute

查询所有nova 服务

sm@controller:~$ nova service-list+------------------+------------+----------+----------+-------+----------------------------+------------------------------------+| Binary           | Host       | Zone     | Status   | State | Updated_at                 | Disabled Reason                    |+------------------+------------+----------+----------+-------+----------------------------+------------------------------------+| nova-cert        | controller | internal | enabled  | up    | 2016-01-08T03:01:20.000000 | -                                  || nova-consoleauth | controller | internal | enabled  | up    | 2016-01-08T03:01:27.000000 | -                                  || nova-scheduler   | controller | internal | enabled  | up    | 2016-01-08T03:01:28.000000 | -                                  || nova-conductor   | controller | internal | enabled  | up    | 2016-01-08T03:01:24.000000 | -                                  || nova-compute     | compute    | nova     | enabled  | up    | 2016-01-08T03:01:20.000000 | None                               || nova-compute     | network    | nova     | enabled  | up    | 2016-01-08T03:01:29.000000 | None                               || nova-compute     | compute2   | nova     | disabled | down  | 2016-01-07T07:37:07.000000 | AUTO: Failed to connect to libvirt |+------------------+------------+----------+----------+-------+----------------------------+------------------------------------+

删除nova-compute

在J 版本以上有nova service-delete compute2 直接删除 

Juno之前版本可以用nova service-disable 

执行  nova service-disable compute2 nova-compute

root@controller:~# nova service-disable compute2 nova-compute+----------+--------------+----------+| Host     | Binary       | Status   |+----------+--------------+----------+| compute2 | nova-compute | disabled |+----------+--------------+----------+root@controller:~# nova service-list+------------------+------------+----------+----------+-------+----------------------------+-----------------+| Binary           | Host       | Zone     | Status   | State | Updated_at                 | Disabled Reason |+------------------+------------+----------+----------+-------+----------------------------+-----------------+| nova-cert        | controller | internal | enabled  | up    | 2016-01-13T03:17:46.000000 | -               || nova-consoleauth | controller | internal | enabled  | up    | 2016-01-13T03:17:39.000000 | -               || nova-scheduler   | controller | internal | enabled  | up    | 2016-01-13T03:17:42.000000 | -               || nova-conductor   | controller | internal | enabled  | up    | 2016-01-13T03:17:42.000000 | -               || nova-compute     | compute    | nova     | enabled  | up    | 2016-01-13T03:17:47.000000 | None            || nova-compute     | network    | nova     | enabled  | up    | 2016-01-13T03:17:39.000000 | None            || nova-compute     | compute2   | nova     | disabled | up    | 2016-01-13T03:17:41.000000 | -               |+------------------+------------+----------+----------+-------+----------------------------+-----------------+

3,登录nova数据库清理 如下数据

mysql -unovadbadmin -pnovapasswd

select * from nova.services;select * from compute_nodesdelete from nova.services where host="compute2";delete from compute_nodes where hypervisor_hostname="compute";

 4,关机移除compute2

0 0
原创粉丝点击