I need to decommission an old SAN so I have connected a new one into ovirt as a new storage domain. I would like to use a python script to move all disks/snapshots/everything over to the new storage domain but I am having some problems.

I am trying to search for all VMs using a particular storage domain but this is not working how I would like. The code I am using is:
vms = vms_service.list(search='Storage=team-data')
However this is returning VMs which are using storage domains 'team-data' and 'team-data2'. Is this a bug or is there another way to return vms from just 'team-data'?


My script so far is:

connection = sdk.Connection(
  url=ovaddress,
  username=username,
  password=password,
  insecure=True
)

system_service = connection.system_service()
vms_service = system_service.vms_service()
disks_service = connection.system_service().disks_service()

vms = vms_service.list(search='Storage=team-data')
sds_service = connection.system_service().storage_domains_service()

dest_sd = sds_service.list(search='name=team-data2')
if len(dest_sd)!=1:
    exit()
dest_sd=dest_sd[0]

for vm in vms:
   print (vm.name)
   vm_service = vms_service.vm_service(vm.id)
   disk_attachments = vm_service.disk_attachments_service().list()
   for disk_attachment in disk_attachments:
       disk = connection.follow_link(disk_attachment.disk)
       print (" disk: " + disk.name)
       disk_service = disks_service.disk_service(disk.id)
       disk_service.move(storage_domain=dest_sd)
       while True:
           print("Waiting for movement to complete ...")
           time.sleep(10)
           disk = disk_service.get()
           if disk.status == types.DiskStatus.OK:
               break

connection.close()