<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Mar 24, 2017 at 1:29 PM, Ernest Beinrohr <span dir="ltr"><<a href="mailto:Ernest.Beinrohr@axonpro.sk" target="_blank">Ernest.Beinrohr@axonpro.sk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF"><span class="">
<div class="m_-834673744335957489moz-cite-prefix">On 24.03.2017 11:11, gflwqs gflwqs
wrote:<br>
</div>
<blockquote type="cite">
<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></span>
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 <a href="http://vm.name" target="_blank">vm.name</a></tt><tt><br>
</tt><tt> for disk in vm.disks.list( ):</tt></div></blockquote><div><br></div><div>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.</div><div>How many, depend on your storage bottlenecks usually, but few at a time makes sense to me.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div text="#000000" bgcolor="#FFFFFF"><tt><br>
</tt><tt> print " disk: " + <a href="http://disk.name" target="_blank">disk.name</a> + " " + disk.get_alias()</tt><tt><br>
</tt><tt> sd = api.storagedomains.get('<wbr>NEWSTORAGE')</tt><tt><br>
</tt><tt><br>
</tt><tt> try:</tt><tt><br>
</tt><tt> disk.move(params.Action(<wbr>storage_domain=sd))</tt><tt><br>
</tt><tt><br>
</tt><tt> disk_id = disk.get_id()</tt><tt><br>
</tt><tt> while True:</tt></div></blockquote><div><br></div><div>Not breaking for any kind of timeout or state other than 'ok' ? </div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div text="#000000" bgcolor="#FFFFFF"><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></div></blockquote><div><br></div><div>A bit more information here might help diagnosing what has failed.</div><div>Y.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div text="#000000" bgcolor="#FFFFFF"><tt><br>
</tt><tt><br>
</tt><tt>api.disconnect()</tt><span class="HOEnZb"><font color="#888888"><tt><br>
</tt><br>
<br>
<br>
<div class="m_-834673744335957489moz-signature">-- <br>
<div id="m_-834673744335957489oernii_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" target="_blank">Ing</a>, <a style="text-decoration:none;color:gray" href="http://www.beinrohr.sk/rhce.php" target="_blank">RHCE</a>, <a style="text-decoration:none;color:gray" href="http://www.beinrohr.sk/rhce.php" target="_blank">RHCVA</a>, <a style="text-decoration:none;color:gray" href="http://www.beinrohr.sk/lpic.php" target="_blank">LPIC</a>, <a style="text-decoration:none;color:gray" href="http://www.beinrohr.sk/vca.php" target="_blank">VCA</a>, <br>
<a href="tel:+421%202/624%20103%2060" value="+421262410360" target="_blank">+421-2-62410360</a> <a href="tel:+421%20903%20482%20603" value="+421903482603" target="_blank">+421-903-482603</a>
<br>
</span> </div>
<img src="http://nojsstats.appspot.com/UA-44497096-1/email.beinrohr.sk" width="1" border="0" height="1">
</div>
</font></span></div>
<br>______________________________<wbr>_________________<br>
Users mailing list<br>
<a href="mailto:Users@ovirt.org">Users@ovirt.org</a><br>
<a href="http://lists.ovirt.org/mailman/listinfo/users" rel="noreferrer" target="_blank">http://lists.ovirt.org/<wbr>mailman/listinfo/users</a><br>
<br></blockquote></div><br></div></div>