[PATCH v2 9/9] virsh: Add support for --tpm-shared-storage flag for migration

Stefan Berger stefanb at linux.ibm.com
Wed Oct 5 14:02:07 UTC 2022


Add support for --tpm-shared-storage flag for migration across
hosts that have shared storage set up for storing the state.

Add documentation to the virsh man page.

Signed-off-by: Stefan Berger <stefanb at linux.ibm.com>
---
 docs/manpages/virsh.rst | 6 ++++++
 tools/virsh-domain.c    | 7 +++++++
 2 files changed, 13 insertions(+)

diff --git a/docs/manpages/virsh.rst b/docs/manpages/virsh.rst
index 5d11c48803..79626f2510 100644
--- a/docs/manpages/virsh.rst
+++ b/docs/manpages/virsh.rst
@@ -3297,6 +3297,7 @@ migrate
       [--parallel [--parallel-connections connections]]
       [--bandwidth bandwidth] [--tls-destination hostname]
       [--disks-uri URI] [--copy-storage-synchronous-writes]
+      [--tpm-shared-storage]
 
 Migrate domain to another host.  Add *--live* for live migration; <--p2p>
 for peer-2-peer migration; *--direct* for direct migration; or *--tunnelled*
@@ -3367,6 +3368,11 @@ 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.
 
+*--tpm-shared-storage* enables migration of a QEMU VM with TPM whose
+persistents state is saved on shared storage set up between the source
+and destination hosts. This option must be given when shared storage
+is used and must not be given otherwise.
+
 ``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 2d22547cc6..05c4a827c3 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -11041,6 +11041,10 @@ static const vshCmdOptDef opts_migrate[] = {
      .completer = virshCompleteEmpty,
      .help = N_("override the destination host name used for TLS verification")
     },
+    {.name = "tpm-shared-storage",
+     .type = VSH_OT_BOOL,
+     .help = N_("migrate TPM between hosts that have shared storage setup for the TPM's state")
+    },
     {.name = NULL}
 };
 
@@ -11345,6 +11349,9 @@ doMigrate(void *opaque)
     if (vshCommandOptBool(cmd, "parallel"))
         flags |= VIR_MIGRATE_PARALLEL;
 
+    if (vshCommandOptBool(cmd, "tpm-shared-storage"))
+        flags |= VIR_MIGRATE_TPM_SHARED_STORAGE;
+
     if (flags & VIR_MIGRATE_PEER2PEER || vshCommandOptBool(cmd, "direct")) {
         if (virDomainMigrateToURI3(dom, desturi, params, nparams, flags) == 0)
             data->ret = 0;
-- 
2.37.3



More information about the libvir-list mailing list