3.5. 示例:列出主机
本例检索主机列表,并显示使用虚拟化环境注册的名为 myhost 的主机:
GET /ovirt-engine/api/hosts HTTP/1.1
Accept: application/xml
相同的请求,使用 curl 命令:
# curl \
--cacert '/etc/pki/ovirt-engine/ca.pem' \
--request GET \
--header 'Version: 4' \
--header 'Accept: application/xml' \
--user 'admin@internal:mypassword' \
https://myengine.example.com/ovirt-engine/api/hosts
结果将是 Host 类型的对象列表:
<hosts>
<host href="/ovirt-engine/api/hosts/004" id="004">
<name>myhost</name>
<link href="/ovirt-engine/api/hosts/004/nics" rel="nics"/>
...
<address>node40.example.com</address>
<cpu>
<name>Intel Core Processor (Haswell, no TSX)</name>
<speed>3600</speed>
<topology>
<cores>1</cores>
<sockets>2</sockets>
<threads>1</threads>
</topology>
</cpu>
<memory>8371830784</memory>
<os>
<type>RHEL</type>
<version>
<full_version>7 - 2.1511.el7.centos.2.10</full_version>
<major>7</major>
</version>
</os>
<port>54321</port>
<status>up</status>
<cluster href="/ovirt-engine/api/clusters/002" id="002"/>
</host>
...
</hosts>
记录您的主机的 id。它标识此主机与虚拟环境的其他资源相关。
此主机是 Default 集群的成员,访问 nics 子集合显示此主机与 ovirtmgmt 网络的连接。