On Wed, Mar 04, 2015 at 10:54:21 +0100, Martin Klepáč
wrote:> Hi,
>
> I am using qemu hook script to track status of VM live migration - libvirt
> 1.2.9 as included in Debian Wheezy backports.
>
> I would like to be informed of the fact that VM migration has successfully
> finished as soon as possible. Based on the steps below, when would that be
> possible?
>
> Sample VM migration as detected by qemu hook script:
> 1.) Destination hypervisor:
> [10:27:42.224] Args: one-16 migrate begin
> 2.) Destination hypervisor:
> [10:27:42.253] Args: one-16 prepare begin
> 3.) Destination hypervisor:
> [10:27:42.472] Args: one-16 start begin
> 4.) Destination hypervisor:
> [10:27:42.890] Args: one-16 started begin
> 5.) Actual VM migration...takes approximately 10 seconds in this case.
> 6.) Source hypervisor:
> [10:27:51.847] Args: one-16 stopped end
> 7.) Source hypervisor:
> [10:27:51.882] Args: one-16 release end
>
> Based on the website, "Unless an error occurs during the migration
process,
> the *qemu* hook script on the *source* host is then executed with the
> "stopped" and "release" operations to indicate it is no
longer running on
> this host."
>
> So the source hypervisor in steps no. 6 and 7 knows that it is no longer
> running a VM, right? Does that mean that the destination hypervisor is
> already running the VM at the moment corresponding to step no. 6? If so, is
> there any hook on the destination hypervisor, which would inform of the
> fact that the hypervisor has copied the last portions of VM memory and has
> become responsible for the VM in question?
Hooks are not really designed for this kind of stuff, they were designed
for creating scripts that can setup the environment for the new domain.
That is, there's nothing that would need to be done on a destination
host once a domain finished migrating there. Therefore, there's no hook
called at that time.
You want to listen for domain life cycle events instead.
Jirka