when using shared storage pass the --migration option to swtpm, if swptm
supports it (staring with v0.8). Always apply the 'release-lock-outgoing'
parameter with this option and apply the 'incoming' parameter for
incoming migration so that swtpm releases the file lock on the source side
when the state is migrated and locks the file on the destination side when
the state is received.
Signed-off-by: Stefan Berger <stefanb(a)linux.ibm.com>
---
src/qemu/qemu_tpm.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/src/qemu/qemu_tpm.c b/src/qemu/qemu_tpm.c
index 280307a14e..8b3ef4e34e 100644
--- a/src/qemu/qemu_tpm.c
+++ b/src/qemu/qemu_tpm.c
@@ -650,6 +650,19 @@ qemuTPMEmulatorBuildCommand(virDomainTPMDef *tpm,
virCommandAddArgFormat(cmd, "pwdfd=%d,mode=aes-256-cbc",
migpwdfile_fd);
}
+ if (tpm->data.emulator.shared_storage) {
+ if (!virTPMSwtpmCapsGet(VIR_TPM_SWTPM_FEATURE_CMDARG_MIGRATION)) {
+ virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED,
+ _("%s does not support the --migration option needed for shared
storage"),
+ swtpm);
+ goto error;
+ }
+
+ virCommandAddArg(cmd, "--migration");
+ virCommandAddArgFormat(cmd, "release-lock-outgoing%s",
+ incomingMigration ? ",incoming": "");
+ }
+
return g_steal_pointer(&cmd);
error:
--
2.37.1