render / rpms / libvirt

Forked from rpms/libvirt 7 months ago
Clone
49d448
From 20c1c86f96dd7293734888ef6f8b75c11cda5fae Mon Sep 17 00:00:00 2001
49d448
Message-Id: <20c1c86f96dd7293734888ef6f8b75c11cda5fae@dist-git>
49d448
From: Jiri Denemark <jdenemar@redhat.com>
49d448
Date: Wed, 22 Jun 2022 16:36:53 +0200
49d448
Subject: [PATCH] virsh: Add support for VIR_MIGRATE_ZEROCOPY flag
49d448
MIME-Version: 1.0
49d448
Content-Type: text/plain; charset=UTF-8
49d448
Content-Transfer-Encoding: 8bit
49d448
49d448
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
49d448
Reviewed-by: Ján Tomko <jtomko@redhat.com>
49d448
(cherry picked from commit efa3baeae70fbdf4ab032ca485cb9272ee96bd50)
49d448
49d448
https://bugzilla.redhat.com/show_bug.cgi?id=2089433
49d448
49d448
Conflicts:
49d448
	docs/manpages/virsh.rst
49d448
	tools/virsh-domain.c
49d448
            - post-copy recovery not backported
49d448
49d448
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
49d448
---
49d448
 docs/manpages/virsh.rst | 8 +++++++-
49d448
 tools/virsh-domain.c    | 7 +++++++
49d448
 2 files changed, 14 insertions(+), 1 deletion(-)
49d448
49d448
diff --git a/docs/manpages/virsh.rst b/docs/manpages/virsh.rst
49d448
index dd534c10cb..d24e7774a6 100644
49d448
--- a/docs/manpages/virsh.rst
49d448
+++ b/docs/manpages/virsh.rst
49d448
@@ -3225,7 +3225,8 @@ migrate
49d448
    migrate [--live] [--offline] [--direct] [--p2p [--tunnelled]]
49d448
       [--persistent] [--undefinesource] [--suspend] [--copy-storage-all]
49d448
       [--copy-storage-inc] [--change-protection] [--unsafe] [--verbose]
49d448
-      [--rdma-pin-all] [--abort-on-error] [--postcopy] [--postcopy-after-precopy]
49d448
+      [--rdma-pin-all] [--abort-on-error] [--postcopy]
49d448
+      [--postcopy-after-precopy] [--zerocopy]
49d448
       domain desturi [migrateuri] [graphicsuri] [listen-address] [dname]
49d448
       [--timeout seconds [--timeout-suspend | --timeout-postcopy]]
49d448
       [--xml file] [--migrate-disks disk-list] [--disks-port port]
49d448
@@ -3298,6 +3299,11 @@ high (and thus allowing the domain to lock most of the host's memory). Doing so
49d448
 may be dangerous to both the domain and the host itself since the host's kernel
49d448
 may run out of memory.
49d448
 
49d448
+*--zerocopy* requests zero-copy mechanism to be used for migrating memory pages.
49d448
+For QEMU/KVM this means QEMU will be temporarily allowed to lock all guest
49d448
+pages in host's memory, although only those that are queued for transfer will
49d448
+be locked at the same time.
49d448
+
49d448
 ``Note``: Individual hypervisors usually do not support all possible types of
49d448
 migration. For example, QEMU does not support direct migration.
49d448
 
49d448
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
49d448
index b56f6a90f5..c5bade1dbf 100644
49d448
--- a/tools/virsh-domain.c
49d448
+++ b/tools/virsh-domain.c
49d448
@@ -10730,6 +10730,10 @@ static const vshCmdOptDef opts_migrate[] = {
49d448
      .type = VSH_OT_BOOL,
49d448
      .help = N_("automatically switch to post-copy migration after one pass of pre-copy")
49d448
     },
49d448
+    {.name = "zerocopy",
49d448
+     .type = VSH_OT_BOOL,
49d448
+     .help = N_("use zero-copy mechanism for migrating memory pages")
49d448
+    },
49d448
     {.name = "migrateuri",
49d448
      .type = VSH_OT_STRING,
49d448
      .completer = virshCompleteEmpty,
49d448
@@ -11133,6 +11137,9 @@ doMigrate(void *opaque)
49d448
     if (vshCommandOptBool(cmd, "postcopy"))
49d448
         flags |= VIR_MIGRATE_POSTCOPY;
49d448
 
49d448
+    if (vshCommandOptBool(cmd, "zerocopy"))
49d448
+        flags |= VIR_MIGRATE_ZEROCOPY;
49d448
+
49d448
     if (vshCommandOptBool(cmd, "tls"))
49d448
         flags |= VIR_MIGRATE_TLS;
49d448
 
49d448
-- 
49d448
2.35.1
49d448