Show Table of Contents
2.18. 例: Python を使用した仮想マシンの起動
仮想マシンを起動します。
例2.19 Python を使用した仮想マシンの起動
以下の例では、
start メソッドを使用して仮想マシンを起動します。
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" % exstart 要求が成功した場合は、スクリプトによって以下のような出力が表示されます。
Started 'vm1'.
status には、仮想マシンが起動して up の状態となったことが表示される点に注意してください。

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.