On Fri, Mar 24, 2017 at 1:29 PM, Ernest Beinrohr <[email protected]
> wrote:

> On 24.03.2017 11:11, gflwqs gflwqs wrote:
>
> 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..
>
> This is my python program:
>
> # ... API init
>
> vms= api.vms.list(query = 'vmname')
>
> for vm in vms:
>   print vm.name
>   for disk in vm.disks.list( ):
>

I personally would not move it disk by disk, VM by VM. It'll take a lot of
time and you can usually move multiple disks at a time.
How many, depend on your storage bottlenecks usually, but few at a time
makes sense to me.


>
>     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:
>

Not breaking for any kind of timeout or state other than 'ok' ?


>
>           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."
>

A bit more information here might help diagnosing what has failed.
Y.


>
>
> api.disconnect()
>
>
>
> --
> Ernest Beinrohr, AXON PRO
> Ing <http://www.beinrohr.sk/ing.php>, RHCE
> <http://www.beinrohr.sk/rhce.php>, RHCVA <http://www.beinrohr.sk/rhce.php>,
> LPIC <http://www.beinrohr.sk/lpic.php>, VCA
> <http://www.beinrohr.sk/vca.php>,
> +421-2-62410360 <+421%202/624%20103%2060> +421-903-482603
> <+421%20903%20482%20603>
>
> _______________________________________________
> Users mailing list
> [email protected]
> http://lists.ovirt.org/mailman/listinfo/users
>
>
_______________________________________________
Users mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/users

Reply via email to