[libvirt] libvirt modification

Martin Kletzander mkletzan at redhat.com
Tue Jun 12 07:36:32 UTC 2012


On 06/11/2012 05:22 PM, Patrick Raad wrote:
> Hello,
> 
> I am not that expert in development, but I am working on a project for
> migrating VM between hosts and I need to add a function to libvirt in
> order to send a certain message.
> 

Hi,

I don't know what kind of message you want to send nor how specific it
should be (if it is for any guest, only for migration on one machine,
what information you need there (only guest name or something more), but
wouldn't hooks be enough to help you with that?

http://libvirt.org/hooks.html

> What I am using is KVM-qemu as a hypervisor. When a VM "live" migrates
> from a host A to a host B, I need that the host B sends a certain
> message through a socket, once the live migration has been successfully
> completed and the VM is running on host B. 

For this specific situation I'd probably use two hooks, one on the
/migration/ destination that notifies the starting migration and second
one on the /migration/ source that sends the notification when the
resources are released.

> Can you please tell me which file I must modify in order to add my
> function? What does libvirt uses to notify the destination that the
> migration is completed.
> I thought about modifying qemu_migration.c, but it didn't seem to work,
> so I was thinking about using virsh.c, but this way the destination host
> won't be notified so I don't think it can work...

I think it is easier to hook your special message the way I mentioned.
However in case you want to add support for this kind of hook (migration
end), src/qemu/qemu_migration.c could be the place to place the code in,
I guess.

Was this of any help to you?

> 
> Any ideas??
> Thank you 
> 
> -- 
> Patrick RAAD




More information about the libvir-list mailing list