3.12. 列出 ISO 存储域中的文件
storagedomains 集合包含一个文件集合,用于描述存储域中的文件。
例 3.10. 列出 ISO 存储域中的文件
这个示例打印每个 ISO 存储域中的 ISO 文件列表:
V4
import ovirtsdk4 as sdk
import ovirtsdk4.types as types
connection = sdk.Connection(
url='https://engine.example.com/ovirt-engine/api',
username='admin@internal',
password='password',
ca_file='ca.pem',
)
storage_domains_service = connection.system_service().storage_domains_service()
storage_domains = storage_domains_service.list()
for storage_domain in storage_domains:
if(storage_domain.type == types.StorageDomainType.ISO):
print(storage_domain.name + ":\n")
files = storage_domain.files_service().list()
for file in files:
print("%s" % file.name + "\n")
connection.close()
示例输出文本:
ISO_storage_domain:
file1
file2