[libvirt PATCH 6/7] virsh: Add support for VIR_MIGRATE_ZEROCOPY flag

Jiri Denemark jdenemar at redhat.com
Thu Jun 23 13:58:11 UTC 2022


Signed-off-by: Jiri Denemark <jdenemar at redhat.com>
---
 docs/manpages/virsh.rst | 7 ++++++-
 tools/virsh-domain.c    | 7 +++++++
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/docs/manpages/virsh.rst b/docs/manpages/virsh.rst
index 4701791b04..45469f2f35 100644
--- a/docs/manpages/virsh.rst
+++ b/docs/manpages/virsh.rst
@@ -3285,7 +3285,7 @@ migrate
       [--persistent] [--undefinesource] [--suspend] [--copy-storage-all]
       [--copy-storage-inc] [--change-protection] [--unsafe] [--verbose]
       [--rdma-pin-all] [--abort-on-error] [--postcopy]
-      [--postcopy-after-precopy] [--postcopy-resume]
+      [--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]
@@ -3362,6 +3362,11 @@ high (and thus allowing the domain to lock most of the host's memory). Doing so
 may be dangerous to both the domain and the host itself since the host's kernel
 may run out of memory.
 
+*--zerocopy* requests zero-copy mechanism to be used for migrating memory pages.
+For QEMU/KVM this means QEMU will be temporarily allowed to lock all guest
+pages in host's memory, although only those that are queued for transfer will
+be locked at the same time.
+
 ``Note``: Individual hypervisors usually do not support all possible types of
 migration. For example, QEMU does not support direct migration.
 
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 1d71ac5a67..43034f2f81 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -10890,6 +10890,10 @@ static const vshCmdOptDef opts_migrate[] = {
      .type = VSH_OT_BOOL,
      .help = N_("resume failed post-copy migration")
     },
+    {.name = "zerocopy",
+     .type = VSH_OT_BOOL,
+     .help = N_("use zero-copy mechanism for migrating memory pages")
+    },
     {.name = "migrateuri",
      .type = VSH_OT_STRING,
      .completer = virshCompleteEmpty,
@@ -11296,6 +11300,9 @@ doMigrate(void *opaque)
     if (vshCommandOptBool(cmd, "postcopy-resume"))
         flags |= VIR_MIGRATE_POSTCOPY_RESUME;
 
+    if (vshCommandOptBool(cmd, "zerocopy"))
+        flags |= VIR_MIGRATE_ZEROCOPY;
+
     if (vshCommandOptBool(cmd, "tls"))
         flags |= VIR_MIGRATE_TLS;
 
-- 
2.35.1



More information about the libvir-list mailing list