
On 05/11/2011 03:09 AM, Daniel P. Berrange wrote:
The migration protocol has support for a 'cookie' parameter which is an opaque array of bytes as far as libvirt is concerned. Drivers may use this for passing around arbitrary extra data they might need during migration. The QEMU driver needs todo a few things:
s/todo/to do/
- Pass hostname/uuid to allow strict protection against localhost migration attempts - Pass SPICE/VNC server port from the target back to the source to allow seemless relocation of client sessions
s/seemless/seamless/
- Pass lock driver state from source to destination
This patch introduces the basic glue for handling cookies but only includes the host/guest UUID & name.
* src/libvirt_private.syms: Export virXMLParseStrHelper * src/qemu/qemu_migration.c, src/qemu/qemu_migration.h: Parsing and formatting of migration cookies * src/qemu/qemu_driver.c: Pass in cookie parameters where possible * src/remote/remote_protocol.h, src/remote/remote_protocol.x: Change cookie max length to 16384 bytes --- cfg.mk | 1 + src/libvirt_private.syms | 1 + src/qemu/qemu_driver.c | 20 ++- src/qemu/qemu_migration.c | 351 +++++++++++++++++++++++++++++++++++++++++- src/qemu/qemu_migration.h | 16 ++ src/remote/remote_protocol.x | 2 +- 6 files changed, 377 insertions(+), 14 deletions(-)
@@ -342,6 +612,15 @@ qemuMigrationPrepareTunnel(struct qemud_driver *driver, event = virDomainEventNewFromObj(vm, VIR_DOMAIN_EVENT_STARTED, VIR_DOMAIN_EVENT_STARTED_MIGRATED); + + if (qemuMigrationBakeCookie(mig, driver, vm, cookieout, cookieoutlen, 0) < 0) { + /* We could tear down the whole guest here, but + * cookie data is (so far) non-critical, so that + * seems a little harsh. We'll just warn for now..
Double .
+ */ + VIR_WARN0("Unable to encode migration cookie");
and more rebase fun. ACK with this squashed in: diff --git i/src/qemu/qemu_migration.c w/src/qemu/qemu_migration.c index 79a8204..0ffdadd 100644 --- i/src/qemu/qemu_migration.c +++ w/src/qemu/qemu_migration.c @@ -145,7 +145,7 @@ qemuMigrationCookieXMLParse(qemuMigrationCookiePtr mig, char *tmp; /* We don't store the uuid, name, hostname, or hostuuid - * values. We just compare them to local data todo some + * values. We just compare them to local data to do some * sanity checking on migration operation */ @@ -616,9 +616,9 @@ qemuMigrationPrepareTunnel(struct qemud_driver *driver, if (qemuMigrationBakeCookie(mig, driver, vm, cookieout, cookieoutlen, 0) < 0) { /* We could tear down the whole guest here, but * cookie data is (so far) non-critical, so that - * seems a little harsh. We'll just warn for now.. + * seems a little harsh. We'll just warn for now. */ - VIR_WARN0("Unable to encode migration cookie"); + VIR_WARN("Unable to encode migration cookie"); } ret = 0; @@ -818,9 +818,9 @@ qemuMigrationPrepareDirect(struct qemud_driver *driver, if (qemuMigrationBakeCookie(mig, driver, vm, cookieout, cookieoutlen, 0) < 0) { /* We could tear down the whole guest here, but * cookie data is (so far) non-critical, so that - * seems a little harsh. We'll just warn for now.. + * seems a little harsh. We'll just warn for now. */ - VIR_WARN0("Unable to encode migration cookie"); + VIR_WARN("Unable to encode migration cookie"); } qemuAuditDomainStart(vm, "migrated", true); @@ -926,7 +926,7 @@ static int doNativeMigrate(struct qemud_driver *driver, goto cleanup; if (qemuMigrationBakeCookie(mig, driver, vm, cookieout, cookieoutlen, 0) < 0) - VIR_WARN0("Unable to encode migration cookie"); + VIR_WARN("Unable to encode migration cookie"); ret = 0; @@ -1590,7 +1590,7 @@ qemuMigrationFinish(struct qemud_driver *driver, } if (qemuMigrationBakeCookie(mig, driver, vm, cookieout, cookieoutlen, 0) < 0) - VIR_WARN0("Unable to encode migration cookie"); + VIR_WARN("Unable to encode migration cookie"); endjob: if (vm && -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org