On 05/11/2011 03:09 AM, Daniel P. Berrange wrote:
Implement the v3 migration protocol, which has two extra
steps, 'begin' on the source host and 'confirm' on the
source host. All other methods also gain both input and
output cookies to allow bi-directional data passing at
all stages.
The QEMU peer2peer migration method gains another impl
to provide the v3 migration. This finally allows migration
cookies to work with tunnelled migration, which is required
for Spice seemless migration & the lock manager transfer
s/seemless/seamless/
* src/qemu/qemu_driver.c: Wire up migrate v3 APIs
* src/qemu/qemu_migration.c, src/qemu/qemu_migration.h: Add
begin & confirm methods, and peer2peer impl of v3
---
src/qemu/qemu_driver.c | 318 +++++++++++++++++++++++++++++++++++++++-
src/qemu/qemu_migration.c | 353 +++++++++++++++++++++++++++++++++++++++++++--
src/qemu/qemu_migration.h | 17 ++-
3 files changed, 664 insertions(+), 24 deletions(-)
+static int
+qemuDomainMigrateConfirm3(virDomainPtr domain,
+ const char *cookiein,
+ int cookieinlen,
+ unsigned long flags,
+ int cancelled)
+{
+ struct qemud_driver *driver = domain->conn->privateData;
+ virDomainObjPtr vm;
+ int ret = -1;
+
+ virCheckFlags(VIR_MIGRATE_LIVE |
+ VIR_MIGRATE_PEER2PEER |
+ VIR_MIGRATE_TUNNELLED |
+ VIR_MIGRATE_PERSIST_DEST |
+ VIR_MIGRATE_UNDEFINE_SOURCE |
+ VIR_MIGRATE_PAUSED |
+ VIR_MIGRATE_NON_SHARED_DISK |
+ VIR_MIGRATE_NON_SHARED_INC, -1);
+
+ /* Migration failed. Save the current error so nothing squashes it */
Spurious comment.
@@ -1341,6 +1382,13 @@ static int doTunnelMigrate(struct qemud_driver
*driver,
goto cleanup;
}
+ if (!(mig = qemuMigrationEatCookie(vm, cookiein, cookieinlen,
+ QEMU_MIGRATION_COOKIE_GRAPHICS)))
+ goto cleanup;
+
+ if (qemuDomainMigrateGraphicsRelocate(driver, vm, mig) < 0)
+ VIR_WARN0("unable to provide data for graphics client relocation");
Rebase woes.
+/* This is essentially a re-impl of virDomainMigrateVersion3
+ * from libvirt.c, but running in source libvirtd context,
+ * instead of client app context & also adding in tunnel
+ * handling */
+static int doPeer2PeerMigrate3(struct qemud_driver *driver,
+ virConnectPtr sconn,
+ virConnectPtr dconn,
+ virDomainObjPtr vm,
+ const char *uri,
+ unsigned long flags,
+ const char *dname,
+ unsigned long resource)
+{
+ virDomainPtr ddomain = NULL;
+ if (flags & VIR_MIGRATE_TUNNELLED) {
+ /*
+ * Tunnelled Migrate Version 2 does not support cookies
+ * due to missing parameters in the prepareTunnel() API.
+ */
+
Too much copy-and-paste.
ACK with this squashed in:
diff --git i/src/qemu/qemu_driver.c w/src/qemu/qemu_driver.c
index 0650d44..eb50565 100644
--- i/src/qemu/qemu_driver.c
+++ w/src/qemu/qemu_driver.c
@@ -6107,8 +6107,6 @@ qemuDomainMigrateConfirm3(virDomainPtr domain,
VIR_MIGRATE_NON_SHARED_DISK |
VIR_MIGRATE_NON_SHARED_INC, -1);
- /* Migration failed. Save the current error so nothing squashes it */
-
qemuDriverLock(driver);
vm = virDomainFindByUUID(&driver->domains, domain->uuid);
if (!vm) {
diff --git i/src/qemu/qemu_migration.c w/src/qemu/qemu_migration.c
index ccb798f..ea30229 100644
--- i/src/qemu/qemu_migration.c
+++ w/src/qemu/qemu_migration.c
@@ -1387,7 +1387,7 @@ static int doTunnelMigrate(struct qemud_driver
*driver,
goto cleanup;
if (qemuDomainMigrateGraphicsRelocate(driver, vm, mig) < 0)
- VIR_WARN0("unable to provide data for graphics client relocation");
+ VIR_WARN("unable to provide data for graphics client relocation");
/* 3. start migration on source */
qemuDomainObjEnterMonitorWithDriver(driver, vm);
@@ -1456,8 +1456,8 @@ static int doTunnelMigrate(struct qemud_driver
*driver,
if (ret == 0 &&
qemuMigrationBakeCookie(mig, driver, vm, cookieout,
cookieoutlen, 0) < 0)
- VIR_WARN0("Unable to encode migration cookie");
-
+ VIR_WARN("Unable to encode migration cookie");
+y
cancel:
if (ret != 0 && virDomainObjIsActive(vm)) {
qemuDomainObjEnterMonitorWithDriver(driver, vm);
@@ -1652,11 +1652,6 @@ static int doPeer2PeerMigrate3(struct
qemud_driver *driver,
cookieout = NULL;
cookieoutlen = 0;
if (flags & VIR_MIGRATE_TUNNELLED) {
- /*
- * Tunnelled Migrate Version 2 does not support cookies
- * due to missing parameters in the prepareTunnel() API.
- */
-
if (!(st = virStreamNew(dconn, 0)))
goto cleanup;
--
Eric Blake eblake(a)redhat.com +1-801-349-2682
Libvirt virtualization library
http://libvirt.org