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")
c_list = api.clusters.list()
for c in c_list:
print "%s (%s)" % (c.get_name(), c.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")
c_list = api.clusters.list()
for c in c_list:
print "%s (%s)" % (c.get_name(), c.get_id())
api.disconnect()
except Exception as ex:
print "Unexpected error: %s" % ex
Copy to ClipboardCopied!Toggle word wrapToggle overflow
如果环境中只包括 Default 集群,这个实例会输出以下信息:
Default (99408929-82cf-4dc7-a532-9d998063fa95)
Default (99408929-82cf-4dc7-a532-9d998063fa95)
Copy to ClipboardCopied!Toggle word wrapToggle overflow