
This is version 4 of the virDomainMigrate patch. It includes remote support, but no qemu, virsh or python yet. And it needs lots more testing which I intend to do more of tomorrow. Interface --------- The interface is now this: virDomainPtr virDomainMigrate (virDomainPtr domain, virConnectPtr dconn, unsigned long flags, const char *dname, const char *uri, unsigned long resource); The caller may set dname, uri and resource to 0/NULL and forget about them. Or else the caller may set, in particular, uri to allow for more complicated migration strategies (especially for qemu). https://www.redhat.com/archives/libvir-list/2007-July/msg00249.html Driver support -------------- As outlined in the diagram in this email: https://www.redhat.com/archives/libvir-list/2007-July/msg00264.html migration happens in two stages. Firstly we send a "prepare" message to the destination host. The destination host may reply with a cookie. It may also suggest a URI (in the current Xen implementation it just returns gethostname). Secondly we send a "perform" message to the source host. Correspondingly, there are two new driver API functions: typedef int (*virDrvDomainMigratePrepare) (virConnectPtr dconn, char **cookie, int *cookielen, const char *uri_in, char **uri_out, unsigned long flags, const char *dname, unsigned long resource); typedef int (*virDrvDomainMigratePerform) (virDomainPtr domain, const char *cookie, int cookielen, const char *uri, unsigned long flags, const char *dname, unsigned long resource); Remote support -------------- To make this work in the remote case I have had to export two private functions from the API which only remote should call: __virDomainMigratePrepare __virDomainMigratePerform The reason for this is that libvirtd is just linked to the regular libvirt.so, so can only make calls into libvirt through exported symbols in the dynamic symbol table. There are two corresponding wire messages (REMOTE_PROC_DOMAIN_MIGRATE_PREPARE and REMOTE_PROC_DOMAIN_MIGRATE_PERFORM) but they just do dumb argument shuffling, albeit rather complicated because of the number of arguments passed in and out. The complete list of messages which go across the wire during a migration is: client -- prepare --> destination host client <-- prepare reply -- destination host client -- perform --> source host client <-- perform reply -- source host client -- lookupbyname --> destination host client <-- lookupbyname reply -- destination host Xen URIs -------- Xen recognises the following forms of URI: hostname hostname:port tcp://hostname/ tcp://hostname:port/ Capabilities ------------ I have extended capabilities with <migration_features>. For Xen this is: <capabilities> <host> <migration_features> <live/> <uri_transports> <uri_transport>tcp</uri_transport> </uri_transports> </migration_features> Rich. -- Emerging Technologies, Red Hat - http://et.redhat.com/~rjones/ Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SL4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 03798903