How to detect completion of a paused VM migration on the destination?

Michal Privoznik mprivozn at redhat.com
Wed Jan 22 08:09:14 UTC 2020


On 1/21/20 3:28 PM, Milan Zamazal wrote:
> Hi,
> 
> when a normally running VM is migrated, libvirt sends
> VIR_DOMAIN_EVENT_RESUMED_MIGRATED event on the destination once the
> migration completes.  I can see that when a paused VM is migrated,
> libvirt sends VIR_DOMAIN_EVENT_SUSPENDED_PAUSED instead.
> 
> Since there seems to be nothing migration specific about
> VIR_DOMAIN_EVENT_SUSPENDED_PAUSED event, my question is: Is it safe to
> assume on the destination that this event signals completion of the
> incoming migration (unless VIR_DOMAIN_EVENT_RESUMED_MIGRATED is received
> before)?

Yes. This is the code that handles the finish phase of migration:

https://libvirt.org/git/?p=libvirt.git;a=blob;f=src/qemu/qemu_migration.c;h=29d228a8d9345ec8e2853571444614008a95e914;hb=HEAD#l5105

which can be read as the following pseudo code:

if (postCopy)
   sendEvent(VIR_DOMAIN_EVENT_RESUMED_MIGRATED);

if (domain.paused)
   sendEvent(VIR_DOMAIN_EVENT_SUSPENDED_PAUSED);


Michal




More information about the libvirt-users mailing list