美文网首页
openstack中查看计算节点的方法

openstack中查看计算节点的方法

作者: jiaxiaolei | 来源:发表于2019-05-14 17:14 被阅读0次

对于一个 openstack 集群,有多种方式查看集群中计算节点的数量。

下面记录了四种方式:

openstack 版本为O版:
···
$ nova-manage version
15.0.6
···

(在Rocky版本中已经废弃)
$ nova host-list|grep compute

$ openstack host list |grep compu

down 或 disabled 的节点也会统计出来

$ openstack compute service list

down 或 disabled 的节点也会统计出来

$ nova hypervisor-list

在大多数情况下, 上面的输出结果是一致的。
但是如果遇到一些特殊情况,几种方式获取到的计算节点数目是不一样的...

具体使用如下:


root@node-1:~# nova host-list |grep compu|wc 
/usr/lib/python2.7/dist-packages/novaclient/client.py:278: UserWarning: The 'tenant_id' argument is deprecated in Ocata and its use may result in errors in future releases. As 'project_id' is provided, the 'tenant_id' argument will be ignored.
  warnings.warn(msg)
     48     336    2016

root@node-1:~# openstack host list |grep compu|wc 
     48     336    2016

root@node-1:~# openstack compute service  list |grep compu|wc 
     51     765    5151

细心的会发现,方法3 统计得到的计算节点的数目和前面2种方法得到的不一致。

比较之后发现三种方式的输出结果中的字段不完全一致;

方法1:

root@node-1:~# nova host-list |grep compu|head -n 3
/usr/lib/python2.7/dist-packages/novaclient/client.py:278: UserWarning: The 'tenant_id' argument is deprecated in Ocata and its use may result in errors in future releases. As 'project_id' is provided, the 'tenant_id' argument will be ignored.
  warnings.warn(msg)
| node-11   | compute     | Automation  |
| node-12   | compute     | Automation  |
| node-13   | compute     | nova        |


方法2:

root@node-1:~# openstack host list |grep compu|head -n 3 
| node-11   | compute     | Automation  |
| node-12   | compute     | Automation  |
| node-13   | compute     | nova        |

方法3:

root@node-1:~# openstack compute service  list |grep compu| head  -n 3
|  61 | nova-compute     | node-11   | Automation  | enabled  | up    | 2019-05-14T09:07:31.000000 |
|  65 | nova-compute     | node-12   | Automation  | enabled  | up    | 2019-05-14T09:07:31.000000 |
|  71 | nova-compute     | node-13   | nova        | enabled  | up    | 2019-05-14T09:07:31.000000 |

openstack 集群中存在3台disabled 的节点,如下:


root@node-1:~# openstack compute service  list |grep up|grep disabled
| 128 | nova-compute     | e-node-65 | ex-nova     | disabled | up    | 2019-05-14T09:10:31.000000 |
| 134 | nova-compute     | e-node-64 | ex-nova     | disabled | up    | 2019-05-14T09:10:31.000000 |
| 176 | nova-compute     | d-node-13 | dmz-nova    | disabled | up    | 2019-05-14T09:10:22.000000 |

方法3可以查到,但是方法和方法2查不到。

root@node-1:~# openstack host list |grep e-node-64 
root@node-1:~# 
root@node-1:~# 
root@node-1:~# openstack compute service  list |grep e-node-64 
| 134 | nova-compute     | e-node-64 | ex-nova     | disabled | up    | 2019-05-14T09:13:21.000000 |

相关文章

网友评论

      本文标题:openstack中查看计算节点的方法

      本文链接:https://www.haomeiwen.com/subject/vbleaqtx.html