[PATCHv2 19/26] snapshot: prevent migration from stranding snapshot data

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 027fdee..70fe607 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -7723,6 +7723,7 @@ qemudDomainMigratePerform (virDomainPtr dom,
     virDomainObjPtr vm;
     int ret = -1;
     const char *dconnuri = NULL;
+    int nsnapshots;

     virCheckFlags(QEMU_MIGRATION_FLAGS, -1);

@@ -7743,6 +7744,13 @@ qemudDomainMigratePerform (virDomainPtr dom,
         goto cleanup;
     }

+    if ((nsnapshots = virDomainSnapshotObjListNum(&vm->snapshots, 0))) {
+        qemuReportError(VIR_ERR_OPERATION_INVALID,
+                        _("cannot migrate domain with %d snapshots"),
+                        nsnapshots);
+        goto cleanup;
+    }
+
     if (flags & VIR_MIGRATE_PEER2PEER) {
         dconnuri = uri;
         uri = NULL;
@@ -7819,6 +7827,7 @@ qemuDomainMigrateBegin3(virDomainPtr domain,
     struct qemud_driver *driver = domain->conn->privateData;
     virDomainObjPtr vm;
     char *xml = NULL;
+    int nsnapshots;

     virCheckFlags(QEMU_MIGRATION_FLAGS, NULL);

@@ -7832,6 +7841,13 @@ qemuDomainMigrateBegin3(virDomainPtr domain,
         goto cleanup;
     }

+    if ((nsnapshots = virDomainSnapshotObjListNum(&vm->snapshots, 0))) {
+        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;
@@ -7993,6 +8009,7 @@ qemuDomainMigratePerform3(virDomainPtr dom,
     struct qemud_driver *driver = dom->conn->privateData;
     virDomainObjPtr vm;
     int ret = -1;
+    int nsnapshots;

     virCheckFlags(QEMU_MIGRATION_FLAGS, -1);

@@ -8006,6 +8023,13 @@ qemuDomainMigratePerform3(virDomainPtr dom,
         goto cleanup;
     }

+    if ((nsnapshots = virDomainSnapshotObjListNum(&vm->snapshots, 0))) {
+        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

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]