Show Table of Contents
2.7. 例: ISO ストレージドメインの ISO ファイルの表示
API クラスは storagedomains という名前のストレージドメインコレクションへのアクセスを提供します。同様に、このコレクションには、ストレージドメイン内のファイルを記述する files コレクションが含まれています。
例2.6 ISO ストレージドメインの ISO ファイルの表示
この Python の例は、Red Hat Virtualization 環境内の各 ISO ストレージドメイン内にある ISO ファイルを一覧で出力します。
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")
storage_domains = api.storagedomains.list()
for storage_domain in storage_domains:
if(storage_domain.get_type() == "iso"):
print(storage_domain.get_name() + ":\n")
files = storage_domain.files.list()
for file in files:
print(" %s" % file.get_name())
print()
api.disconnect()
except Exception as ex:
print "Unexpected error: %s" % ex
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.