from ovirtsdk.api import API
from ovirtsdk.xml import params
try:
api = API(url="https://HOST",
username="USER@DOMAIN",
password="PASS",
ca_file="ca.crt")
h_list = api.hosts.list()
for h in h_list:
print "%s (%s)" % (h.get_name(), h.get_id())
api.disconnect()
except Exception as ex:
print "Unexpected error: %s" % ex
from ovirtsdk.api import API
from ovirtsdk.xml import params
try:
api = API(url="https://HOST",
username="USER@DOMAIN",
password="PASS",
ca_file="ca.crt")
h_list = api.hosts.list()
for h in h_list:
print "%s (%s)" % (h.get_name(), h.get_id())
api.disconnect()
except Exception as ex:
print "Unexpected error: %s" % ex
Copy to ClipboardCopied!Toggle word wrapToggle overflow
如果一个环境中只附加了一个名为 Atlantic 的主机,这个实例会输出以下信息:
Atlantic (5b333c18-f224-11e1-9bdd-00163e77e2ed)
Atlantic (5b333c18-f224-11e1-9bdd-00163e77e2ed)
Copy to ClipboardCopied!Toggle word wrapToggle overflow