Openstack 宿主机电源管理


novaclient 有相关宿主机的管理接口,


hosts=nova.hosts.list()
for i in hosts:
    print(i._info)

输出:
{u'service': u'consoleauth', u'host_name': u'control-4811', u'zone': u'internal'}
{u'service': u'scheduler', u'host_name': u'control-4811', u'zone': u'internal'}
{u'service': u'conductor', u'host_name': u'control-4811', u'zone': u'internal'}
{u'service': u'cert', u'host_name': u'control-4811', u'zone': u'internal'}
{u'service': u'compute', u'host_name': u'compute-4812', u'zone': u'nova'}


print(nova.hosts.host_action("compute-4812","reboot"))

输出:Traceback (most recent call last):
  File "nova_client.py", line 34, in <module>
    print(nova.hosts.host_action("compute-4812","reboot"))
  File "/usr/lib/python2.6/site-packages/novaclient/v1_1/hosts.py", line 62, in host_action
    return self.api.client.get(url)
  File "/usr/lib/python2.6/site-packages/novaclient/client.py", line 254, in get
    return self._cs_request(url, 'GET', **kwargs)
  File "/usr/lib/python2.6/site-packages/novaclient/client.py", line 231, in _cs_request
    **kwargs)
  File "/usr/lib/python2.6/site-packages/novaclient/client.py", line 213, in _time_request
    resp, body = self.request(url, method, **kwargs)
  File "/usr/lib/python2.6/site-packages/novaclient/client.py", line 207, in request
    raise exceptions.from_response(resp, body, url, method)
novaclient.exceptions.HTTPNotImplemented: Virt driver does not implement host power management. (HTTP 501) (Request-ID: req-31bcc149-5ba0-4740-831d-956aa061e6f3)

回到控制结点上用命令行来操作:


[root@control-4811 openstack(keystone_admin)]# nova host-action --action reboot compute-4812
ERROR: Virt driver does not implement host power management. (HTTP 501) (Request-ID: req-8b31874d-6115-4754-bb54-8e2851fa5a44)


还没配置openstack的宿主机电源管理相关服务,所以用不了这个接口。

相关BUG和FIX,

Reviewed: https://review.openstack.org/17565
Committed: http://github.com/openstack/nova/commit/1dc6c806b32044420bf17d3076dd712185b7ac07


另外,可以考虑用IPMITOOL的命令行来进行宿主机电源管理了。








相关内容