[PATCH 13/13] virsh: Add support for VIR_MIGRATE_PARAM_MIGRATE_DISKS_DETECT_ZEROES migration parameter

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

 



Expose the new parameter as '--migrate-disks-detect-zeroes' option.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 docs/manpages/virsh.rst |  8 +++++++-
 tools/virsh-domain.c    | 26 ++++++++++++++++++++++++++
 2 files changed, 33 insertions(+), 1 deletion(-)

diff --git a/docs/manpages/virsh.rst b/docs/manpages/virsh.rst
index f02a28156d..6665d46497 100644
--- a/docs/manpages/virsh.rst
+++ b/docs/manpages/virsh.rst
@@ -3389,7 +3389,9 @@ migrate
       [--postcopy-after-precopy] [--postcopy-resume] [--zerocopy]
       domain desturi [migrateuri] [graphicsuri] [listen-address] [dname]
       [--timeout seconds [--timeout-suspend | --timeout-postcopy]]
-      [--xml file] [--migrate-disks disk-list] [--disks-port port]
+      [--xml file]
+      [--migrate-disks disk-list] [--migrate-disks-detect-zeroes disk-list]
+      [--disks-port port]
       [--compressed] [--comp-methods method-list]
       [--comp-mt-level] [--comp-mt-threads] [--comp-mt-dthreads]
       [--comp-xbzrle-cache] [--comp-zlib-level] [--comp-zstd-level]
@@ -3420,6 +3422,10 @@ images on source host to the images found at the same place on the destination
 host. By default only non-shared non-readonly images are transferred. Use
 *--migrate-disks* to explicitly specify a list of disk targets to
 transfer via the comma separated ``disk-list`` argument.
+The *--migrate-disks-detect-zeroes* option which takes a comma separated list of
+disk target names enables zeroed block detection for the listed migrated disks.
+These blocks are not transferred or allocated on destination, effectively
+sparsifying the disk at the cost of CPU overhead.
 With *--copy-storage-synchronous-writes* flag used the disk data migration will
 synchronously handle guest disk writes to both the original source and the
 destination to ensure that the disk migration converges at the price of possibly
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 50e80689a2..e4923284af 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -10691,6 +10691,11 @@ static const vshCmdOptDef opts_migrate[] = {
      .completer = virshDomainMigrateDisksCompleter,
      .help = N_("comma separated list of disks to be migrated")
     },
+    {.name = "migrate-disks-detect-zeroes",
+     .type = VSH_OT_STRING,
+     .completer = virshDomainMigrateDisksCompleter,
+     .help = N_("comma separated list of disks to be migrated with zero detection enabled")
+    },
     {.name = "disks-port",
      .type = VSH_OT_INT,
      .unwanted_positional = true,
@@ -10909,6 +10914,27 @@ doMigrate(void *opaque)
         }
     }

+    if (vshCommandOptString(ctl, cmd, "migrate-disks-detect-zeroes", &opt) < 0)
+        goto out;
+    if (opt) {
+        g_autofree char **val = NULL;
+
+        if (!(flags & (VIR_MIGRATE_NON_SHARED_DISK | VIR_MIGRATE_NON_SHARED_INC))) {
+            vshError(ctl, "'--migrate-disks-detect-zeroes' requires one of '--copy-storage-all', '--copy-storage-inc'");
+            goto out;
+        }
+
+        val = g_strsplit(opt, ",", 0);
+
+        if (virTypedParamsAddStringList(&params,
+                                        &nparams,
+                                        &maxparams,
+                                        VIR_MIGRATE_PARAM_MIGRATE_DISKS_DETECT_ZEROES,
+                                        (const char **)val) < 0) {
+            goto save_error;
+        }
+    }
+
     if (vshCommandOptString(ctl, cmd, "comp-methods", &opt) < 0)
         goto out;
     if (opt) {
-- 
2.46.0




[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]

  Powered by Linux