KVM "live migration finished" detection

Solution 1:

If you were doing guest vlan tagging you'd see that change and could script it that way. Alternatively you could use a highly-port-assigned DHCP server on both/all VLANs, with the same MAC listed in multiple scopes, you could then just trigger the refresh on vlan change.

Solution 2:

If I remember correctly, upon completing migration the VM should send a gratuitous packet announcing itself. Anyhow, until the arp tables update, there will always be a bit of lag, not VM -> network, but network -> VM

What you can do is catch an "arriving" VM by polling virsh dominfo A VM migrating to a host will appear as "paused" at first, and as soon as it is "running", you know it has finished migrating. on the target you should get domain started event with details saying it was migrated and on the source you should get stopped/migrated event

The better way would be to use something like http://libvirt.org/git/?p=libvirt.git;a=blob;f=examples/domain-events/events-python/event-test.py on the target you should get domain started event with details saying it was migrated and on the source you should get stopped/migrated event

This is your best bet for catching a libvirt migration event using the proper API.

Catching migrations from within a VM is not possible, because the entire idea of live-migration is that a VM is not aware of it, and shouldn't feel the migration