On 24.03.2017 11:11, gflwqs gflwqs wrote:
This is my python program:Hi list,I need to move 600+ vms:from one data domain to another, however from what i can see in the GUI i can only move one vm disk at the time which would be very time consuming.
I there any way i can bulk move those vm disks?By the way, I can't stop the vms they have to be online during the migration..
# ... API init
vms= api.vms.list(query = 'vmname')
for vm in vms:
print vm.name
for disk in vm.disks.list( ):
print " disk: " + disk.name + " " + disk.get_alias()
sd = api.storagedomains.get('NEWSTORAGE')
try:
disk.move(params.Action(storage_domain=sd))
disk_id = disk.get_id()
while True:
print("Waiting for movement to complete ...")
time.sleep(10)
disk = vm.disks.get(id=disk_id)
if disk.get_status().get_state() == "ok":
break
except:
print "Cannot move."
api.disconnect()
--
_______________________________________________
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users