
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.. Regards Christian

This is a multi-part message in MIME format. --------------B3601D9689C9597A00A92DE4 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit 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( ): 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() -- 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-903-482603 --------------B3601D9689C9597A00A92DE4 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> </head> <body text="#000000" bgcolor="#FFFFFF"> <div class="moz-cite-prefix">On 24.03.2017 11:11, gflwqs gflwqs wrote:<br> </div> <blockquote type="cite" cite="mid:CAFYgF=qZidGx=2xB3bNTPQkaE9UZ8bmLp8uYAq23N0ojorT-EQ@mail.gmail.com"> <div dir="ltr">Hi list, <div>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.</div> <div><br> </div> <div>I there any way i can bulk move those vm disks?</div> <div>By the way, I can't stop the vms they have to be online during the migration..</div> <div><br> </div> </div> </blockquote> This is my python program:<br> <br> <tt># ... API init</tt><tt><br> </tt><tt><br> </tt><tt>vms= api.vms.list(query = 'vmname')</tt><tt><br> </tt><tt><br> </tt><tt>for vm in vms:</tt><tt><br> </tt><tt> print vm.name</tt><tt><br> </tt><tt> for disk in vm.disks.list( ):</tt><tt><br> </tt><tt> print " disk: " + disk.name + " " + disk.get_alias()</tt><tt><br> </tt><tt> sd = api.storagedomains.get('NEWSTORAGE')</tt><tt><br> </tt><tt><br> </tt><tt> try:</tt><tt><br> </tt><tt> disk.move(params.Action(storage_domain=sd))</tt><tt><br> </tt><tt><br> </tt><tt> disk_id = disk.get_id()</tt><tt><br> </tt><tt> while True:</tt><tt><br> </tt><tt> print("Waiting for movement to complete ...")</tt><tt><br> </tt><tt> time.sleep(10)</tt><tt><br> </tt><tt> disk = vm.disks.get(id=disk_id)</tt><tt><br> </tt><tt> if disk.get_status().get_state() == "ok":</tt><tt><br> </tt><tt> break</tt><tt><br> </tt><tt><br> </tt><tt> except:</tt><tt><br> </tt><tt> print "Cannot move."</tt><tt><br> </tt><tt><br> </tt><tt>api.disconnect()</tt><tt><br> </tt><br> <br> <br> <div class="moz-signature">-- <br> <div id="oernii_footer" style="color: gray;"> <span style="font-family: Lucida Console, Luxi Mono, Courier, monospace; font-size: 90%;"> Ernest Beinrohr, AXON PRO<br> <a style="text-decoration: none; color: gray;" href="http://www.beinrohr.sk/ing.php">Ing</a>, <a style="text-decoration: none; color: gray;" href="http://www.beinrohr.sk/rhce.php">RHCE</a>, <a style="text-decoration: none; color: gray;" href="http://www.beinrohr.sk/rhce.php">RHCVA</a>, <a style="text-decoration: none; color: gray;" href="http://www.beinrohr.sk/lpic.php">LPIC</a>, <a style="text-decoration: none; color: gray;" href="http://www.beinrohr.sk/vca.php">VCA</a>, <br> +421-2-62410360 +421-903-482603 <br> </span> </div> <img src="http://nojsstats.appspot.com/UA-44497096-1/email.beinrohr.sk" moz-do-not-send="true" width="1" border="0" height="1"> </div> </body> </html> --------------B3601D9689C9597A00A92DE4--

El 2017-03-24 10:29, Ernest Beinrohr escribió:
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')
If you're planning to do it that way, make sure you install version 3.x of ovirt-engine-sdk-python. Newer versions (4.x) differ too much in syntax. Also, if you want to move a whole Storage Domain, you might be interested in listing VMs by the storage domain name, i.e.: api.vms.list(query='Storage=myoldstoragedomain') That will return a list of all machines in that storage domain.
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()
--
Ernest Beinrohr, AXON PRO Ing [1], RHCE [2], RHCVA [2], LPIC [3], VCA [4], +421-2-62410360 +421-903-482603
Links: ------ [1] http://www.beinrohr.sk/ing.php [2] http://www.beinrohr.sk/rhce.php [3] http://www.beinrohr.sk/lpic.php [4] http://www.beinrohr.sk/vca.php
_______________________________________________ Users mailing list Users@ovirt.org http://lists.ovirt.org/mailman/listinfo/users

On Fri, Mar 24, 2017 at 1:29 PM, Ernest Beinrohr <Ernest.Beinrohr@axonpro.sk
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 Users@ovirt.org http://lists.ovirt.org/mailman/listinfo/users
participants (4)
-
Ernest Beinrohr
-
gflwqs gflwqs
-
nicolas@devels.es
-
Yaniv Kaul