API/SDK: List files in ISO domain

Latest response

I recently started messing with the Python SDK and was wondering if someone could help me figure out how to list the files in the ISO domain.  Using cURL I can achieve the desired result with the following command:

curl --cacert rhevm.crt -u "$credentials" -H "Content-Type: application/xml" -X GET https://$host/api/storagedomains/$domain_id/files

What is the equivalent to this in the Python SDK?


Hey Anthony, this is literally my second attempt at doing anything with python .. and it doesn't do what you need, but it might point you in the right direction... (I'm hoping that I will be able to figure this out and update the thread).

UPDATE: Found it..


The only thing I am not happy with in this script is having to hard code the ISO_DOMAIN value in

if SD.name == "ISO_DOMAIN":

I'd like it if I was able to do a case-insensitve compare and search for 'iso' - which is rather assuming as not everyone would name their ISOS storage domain with ISO in the name.  Either way.. I think this should get you what you need.


#!/usr/bin/env python

# You should "import" cert from your RHEV Manager
# wget -O /etc/pki/ovirt-engine/ca.pem --no-check-certificate https://rhevmgr.company.com/ca.crt

import os

from ovirtsdk.api import API


myapi = API ( url=URL,

print "List of Storage Domains"
for sd in myapi.storagedomains.list():
    print sd.name


print "List of Files in"
for SD in myapi.storagedomains.list():
  if SD.name == "ISO_DOMAIN":
    FILES = myapi.storagedomains.get(name = SD.name)
    FILENAME = SD.files.list()
    for i in FILENAME:
      print "%s" % i.get_name()

That is exactly what I was looking for, Thanks James.