3.5. 列出主机
此 Ruby 示例列出了主机。
# Get the reference to the root of the services tree:
system_service = connection.system_service
# Get the reference to the service that manages the
# collection of hosts:
host_service = system_service.hosts_service
# Retrieve the list of hosts and for each one
# print its name:
host = host_service.list
host.each do |host|
puts host.name
end
在一个只有一个附加主机的环境中(Atlantic)示例输出:
Atlantic
如需更多信息,请参阅 http://www.rubydoc.info/gems/ovirt-engine-sdk/OvirtSDK4/HostsService:list。