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")
vm = api.vms.get(name="vm1")
try:
vm.start()
print "Started '%s'." % vm.get_name()
except Exception as ex:
print "Unable to start '%s': %s" % (vm.get_name(), ex)
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")
vm = api.vms.get(name="vm1")
try:
vm.start()
print "Started '%s'." % vm.get_name()
except Exception as ex:
print "Unable to start '%s': %s" % (vm.get_name(), ex)
api.disconnect()
except Exception as ex:
print "Unexpected error: %s" % ex
Copy to ClipboardCopied!Toggle word wrapToggle overflow
開始 要求に成功すると、スクリプトにより以下が出力されます。
Started 'vm1'.
Started 'vm1'.
Copy to ClipboardCopied!Toggle word wrapToggle overflow