<div dir="ltr"><div>Greetings,<br><br>I am writing a code using libvirt API to migrate VM between two physical hosts <b>(QEMU/KVM) , </b>say some <b>n </b>number of times.<br><br><b>1)</b> I am using right now<b> virDomainPtr       virDomainMigrate        (.......) </b>and to calculate the total migration time I am using something like this:<br><br><b>clock_gettime(CLOCK_MONOTONIC_RAW,&begin);  </b>  <br> <b>migrate</b>(domainToMigrate,nodeToMigrate);<br><b>clock_gettime(CLOCK_MONOTONIC_RAW,&end);<br></b></div><b><br></b><div><b>Total Migration Time = end.tv_sec-begin.tv_sec<br><br></b></div><div><b><br></b></div><div>Is this correct way to calculate total migration time. And is there some way to calculate the downtime (not how to set it)?<br><br></div><div><b>2) </b>I am interested in identifying in particular other statistics of migration like :<br></div><div><b>Number of iterations in Pre Copy</b>, <b>Memory transferred in each iteration</b> etc.<br></div><div>I was going through the API and found<b> <a href="http://libvirt.org/html/libvirt-libvirt-domain.html#virDomainJobInfo">virDomainJobInfo</a> and <a href="http://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetJobStats">virDomainGetJobStats</a> </b>functions.But how to use them is not very clear. Can anyone point me to right place to achieve this objective?<br><br></div><div>Thanks in advance.<br></div><div>And sorry if that was too silly to ask.<br><br></div><div>Anubhav<br></div><div><br></div></div>