[libvirt] [PATCH 10/10] conf: snapshot: make disk aligns same on redefinition

Nikolay Shirokovskiy nshirokovskiy at virtuozzo.com
Thu Dec 27 10:20:52 UTC 2018

This patch is similar to [1] but reason is different. At time [1] was written
there is a check in virDomainSnapshotAlignDisks (it is removed in [2]) that
won't allow external disks of external snapshot because of wrong align_location

In case of disk snapshot and external snapshots we always dumped disks (see [3]
were at that time libvirt only makes active disk only snapshots, active
internal snaphots and inactive internal snapshots. Then after the patch we
start to dump disks snapshot section for all snapshots and before we do only
active disk only snapshots). So if user's edits to dumped snapshots before
redefine is limited then we don't need actually to call align for external
cases. But's lets leave it for the case and then make disk align same whether
snapshot is redefined first time or not.

[1] 731a5a4 - snapshot: qemu: Allow redefinition of external snapshots
[2] --- *   - conf: snapshot: remove snapshot mode checking from disk align
[3] 4201a7e - snapshot: new XML for external system checkpoint

* not yet pushed upstream (part of current patch series)

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy at virtuozzo.com>
 src/conf/snapshot_conf.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/conf/snapshot_conf.c b/src/conf/snapshot_conf.c
index 172dff8..3033827 100644
--- a/src/conf/snapshot_conf.c
+++ b/src/conf/snapshot_conf.c
@@ -1307,6 +1307,8 @@ virDomainSnapshotRedefinePrep(virDomainPtr domain,
         if (def->dom) {
+            /* we can skip align in this cases as well as we always
+             * dumped disks for these cases */
             if (def->state == VIR_DOMAIN_DISK_SNAPSHOT ||
                 align_location = VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL;
@@ -1335,8 +1337,10 @@ virDomainSnapshotRedefinePrep(virDomainPtr domain,
         *snap = other;
     } else {
         if (def->dom) {
+            /* we can skip align in this cases as well as we always
+             * dumped disks for these cases */
             if (def->state == VIR_DOMAIN_DISK_SNAPSHOT ||
-                def->memory == VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL)
+                virDomainSnapshotDefIsExternal(def))
                 align_location = VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL;
             if (virDomainSnapshotAlignDisks(def, align_location) < 0)

More information about the libvir-list mailing list