3.6. ISO ストレージドメインでの ISO ファイルの一覧表示
この Ruby の例では、ISO ストレージドメイン myiso
内の ISO ファイルの一覧が表示されます。
# Get the reference to the root of the services tree: system_service = connection.system_service # Find the service that manages the collection of storage domains: sds_service = system_service.storage_domains_service # Find the ISO storage domain: sd = sds_service.list(search: 'name=myiso').first # Find the service that manages the ISO storage domain: sd_service = sds_service.storage_domain_service(sd.id) # Find the service that manages the collection of files available in the storage domain: files_service = sd_service.files_service # List the names of the files. Note that the name of the .iso file is contained # in the `id` attribute. files = files_service.list files.each do |file| puts file.id end
詳細については、FilesService:list を参照してください。
ISO ストレージドメインの名前がわからない場合、この Ruby の例ではすべての ISO ストレージドメインを取得します。
# Find the ISO storage domain: iso_sds = sds_service.list.select { |sd| sd.type == OvirtSDK4::StorageDomainType::ISO }
詳細については、StorageDomainsService:list を参照してください。