Questo contenuto non è disponibile nella lingua selezionata.
2.7. Example: Listing the ISO Files in an ISO Storage Domain
The
API class provides access to a storage domain collection, named storagedomains. This collection in turn contains a files collection that describes the files in a storage domain.
Example 2.6. Listing the ISO Files in an ISO Storage Domain
This Python example prints a list of the ISO files in each ISO storage domain in the Red Hat Virtualization environment:
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