From 8d733f4ef1997fbd30390b43221e92f911c3c5f0 Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Thu, 14 Jul 2011 15:46:49 -0600 Subject: [PATCH] flags: fix qemu migration regression Commit f548480b broke migration v3 on qemu, because the driver passed flags on through to qemu_migration even though qemu_migration wasn't using those flags. * src/qemu/qemu_migration.h (QEMU_MIGRATION_FLAGS): New define. * src/qemu/qemu_driver.c: Simplify all migration callbacks. * src/qemu/qemu_migration.c (qemuMigrationConfirm): Fix regression. --- src/qemu/qemu_driver.c | 90 +++++---------------------------------- src/qemu/qemu_migration.c | 2 +- src/qemu/qemu_migration.h | 10 +++++ 3 files changed, 21 insertions(+), 81 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 0a73a59701..8d146aa8f9 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -6635,14 +6635,7 @@ qemudDomainMigratePrepareTunnel(virConnectPtr dconn, struct qemud_driver *driver = dconn->privateData; 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); + virCheckFlags(QEMU_MIGRATION_FLAGS, -1); qemuDriverLock(driver); @@ -6696,14 +6689,7 @@ qemudDomainMigratePrepare2 (virConnectPtr dconn, struct qemud_driver *driver = dconn->privateData; 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); + virCheckFlags(QEMU_MIGRATION_FLAGS, -1); *uri_out = NULL; @@ -6761,14 +6747,7 @@ qemudDomainMigratePerform (virDomainPtr dom, int ret = -1; const char *dconnuri = NULL; - 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); + virCheckFlags(QEMU_MIGRATION_FLAGS, -1); qemuDriverLock(driver); if (virLockManagerPluginUsesState(driver->lockManager)) { @@ -6823,14 +6802,7 @@ qemudDomainMigrateFinish2 (virConnectPtr dconn, virDomainObjPtr vm; virDomainPtr dom = NULL; - 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, NULL); + virCheckFlags(QEMU_MIGRATION_FLAGS, NULL); qemuDriverLock(driver); vm = virDomainFindByName(&driver->domains, dname); @@ -6871,14 +6843,7 @@ qemuDomainMigrateBegin3(virDomainPtr domain, virDomainObjPtr vm; char *xml = NULL; - 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, NULL); + virCheckFlags(QEMU_MIGRATION_FLAGS, NULL); qemuDriverLock(driver); vm = virDomainFindByUUID(&driver->domains, domain->uuid); @@ -6914,14 +6879,7 @@ qemuDomainMigratePrepare3(virConnectPtr dconn, struct qemud_driver *driver = dconn->privateData; 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); + virCheckFlags(QEMU_MIGRATION_FLAGS, -1); *uri_out = NULL; @@ -6968,14 +6926,7 @@ qemuDomainMigratePrepareTunnel3(virConnectPtr dconn, struct qemud_driver *driver = dconn->privateData; 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); + virCheckFlags(QEMU_MIGRATION_FLAGS, -1); if (!dom_xml) { qemuReportError(VIR_ERR_INTERNAL_ERROR, @@ -7022,14 +6973,7 @@ qemuDomainMigratePerform3(virDomainPtr dom, 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); + virCheckFlags(QEMU_MIGRATION_FLAGS, -1); qemuDriverLock(driver); vm = virDomainFindByUUID(&driver->domains, dom->uuid); @@ -7068,14 +7012,7 @@ qemuDomainMigrateFinish3(virConnectPtr dconn, virDomainObjPtr vm; virDomainPtr dom = NULL; - 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, NULL); + virCheckFlags(QEMU_MIGRATION_FLAGS, NULL); qemuDriverLock(driver); vm = virDomainFindByName(&driver->domains, dname); @@ -7106,14 +7043,7 @@ qemuDomainMigrateConfirm3(virDomainPtr domain, 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); + virCheckFlags(QEMU_MIGRATION_FLAGS, -1); qemuDriverLock(driver); vm = virDomainFindByUUID(&driver->domains, domain->uuid); diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index b8f563be93..dfa80e35b2 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -2575,7 +2575,7 @@ int qemuMigrationConfirm(struct qemud_driver *driver, driver, conn, vm, NULLSTR(cookiein), cookieinlen, flags, retcode); - virCheckFlags(0, -1); + virCheckFlags(QEMU_MIGRATION_FLAGS, -1); if (!(mig = qemuMigrationEatCookie(driver, vm, cookiein, cookieinlen, 0))) return -1; diff --git a/src/qemu/qemu_migration.h b/src/qemu/qemu_migration.h index d3a3743cfc..3a9b94ee81 100644 --- a/src/qemu/qemu_migration.h +++ b/src/qemu/qemu_migration.h @@ -24,6 +24,16 @@ # include "qemu_conf.h" +/* All supported qemu migration flags. */ +# define QEMU_MIGRATION_FLAGS \ + (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) bool qemuMigrationIsAllowed(virDomainDefPtr def) ATTRIBUTE_NONNULL(1); -- GitLab