Migration is another case of stranding metadata. And since
snapshot metadata is arbitrarily large, there's no way to
shoehorn it into the migration cookie of migration v3.
A future patch will make it possible to manually recreate the
snapshot metadata on the destination. But even that is limited,
since if we delete the snapshot metadata prior to migration,
then we won't know the name of the current snapshot to pass
along; and if we delete the snapshot metadata after migration
and use the v3 migration cookie to pass along the name of the
current snapshot, then we need a way to bypass the fact that
this patch refuses migration with snapshot metadata present.
So eventually, we may have to introduce migration protocol v4
that allows feature negotiation and an arbitrary number of
handshake exchanges, so as to pass as many rpc calls as needed
to transfer all the snapshot xml hierarchy.
But all of that is thoughts for the future; for now, the best
course of action is to quit early, rather than get into a
funky state of stale metadata.
* src/qemu/qemu_driver.c (qemudDomainMigratePerform)
(qemuDomainMigrateBegin3, qemuDomainMigratePerform3): Add
restriction.
---
src/qemu/qemu_driver.c | 24 ++++++++++++++++++++++++
1 files changed, 24 insertions(+), 0 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index bf82df4..7802e08 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -7659,6 +7659,7 @@ qemudDomainMigratePerform (virDomainPtr dom,
virDomainObjPtr vm;
int ret = -1;
const char *dconnuri = NULL;
+ int nsnapshots;
virCheckFlags(QEMU_MIGRATION_FLAGS, -1);
@@ -7679,6 +7680,13 @@ qemudDomainMigratePerform (virDomainPtr dom,
goto cleanup;
}
+ if ((nsnapshots = virDomainSnapshotObjListNum(&vm->snapshots))) {
+ qemuReportError(VIR_ERR_OPERATION_INVALID,
+ _("cannot migrate domain with %d snapshots"),
+ nsnapshots);
+ goto cleanup;
+ }
+
if (flags & VIR_MIGRATE_PEER2PEER) {
dconnuri = uri;
uri = NULL;
@@ -7755,6 +7763,7 @@ qemuDomainMigrateBegin3(virDomainPtr domain,
struct qemud_driver *driver = domain->conn->privateData;
virDomainObjPtr vm;
char *xml = NULL;
+ int nsnapshots;
virCheckFlags(QEMU_MIGRATION_FLAGS, NULL);
@@ -7768,6 +7777,13 @@ qemuDomainMigrateBegin3(virDomainPtr domain,
goto cleanup;
}
+ if ((nsnapshots = virDomainSnapshotObjListNum(&vm->snapshots))) {
+ qemuReportError(VIR_ERR_OPERATION_INVALID,
+ _("cannot migrate domain with %d snapshots"),
+ nsnapshots);
+ goto cleanup;
+ }
+
if ((flags & VIR_MIGRATE_CHANGE_PROTECTION)) {
if (qemuMigrationJobStart(driver, vm, QEMU_ASYNC_JOB_MIGRATION_OUT) < 0)
goto cleanup;
@@ -7929,6 +7945,7 @@ qemuDomainMigratePerform3(virDomainPtr dom,
struct qemud_driver *driver = dom->conn->privateData;
virDomainObjPtr vm;
int ret = -1;
+ int nsnapshots;
virCheckFlags(QEMU_MIGRATION_FLAGS, -1);
@@ -7942,6 +7959,13 @@ qemuDomainMigratePerform3(virDomainPtr dom,
goto cleanup;
}
+ if ((nsnapshots = virDomainSnapshotObjListNum(&vm->snapshots))) {
+ qemuReportError(VIR_ERR_OPERATION_INVALID,
+ _("cannot migrate domain with %d snapshots"),
+ nsnapshots);
+ goto cleanup;
+ }
+
ret = qemuMigrationPerform(driver, dom->conn, vm, xmlin,
dconnuri, uri, cookiein, cookieinlen,
cookieout, cookieoutlen,
--
1.7.4.4