qemu-server/PVE/QemuServer
Stefan Reiter f9dde219f2 fix #3075: add TPM v1.2 and v2.0 support via swtpm
Starts an instance of swtpm per VM in it's systemd scope, it will
terminate by itself if the VM exits, or be terminated manually if
startup fails.

Before first use, a TPM state is created via swtpm_setup. State is
stored in a 'tpmstate0' volume, treated much the same way as an efidisk.

It is migrated 'offline', the important part here is the creation of the
target volume, the actual data transfer happens via the QEMU device
state migration process.

Move-disk can only work offline, as the disk is not registered with
QEMU, so 'drive-mirror' wouldn't work. swtpm itself has no method of
moving a backing storage at runtime.

For backups, a bit of a workaround is necessary (this may later be
replaced by NBD support in swtpm): During the backup, we attach the
backing file of the TPM as a read-only drive to QEMU, so our backup
code can detect it as a block device and back it up as such, while
ensuring consistency with the rest of disk state ("snapshot" semantic).

The name for the ephemeral drive is specifically chosen as
'drive-tpmstate0-backup', diverging from our usual naming scheme with
the '-backup' suffix, to avoid it ever being treated as a regular drive
from the rest of the stack in case it gets left over after a backup for
some reason (shouldn't happen).

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2021-10-05 06:51:02 +02:00
..
Agent.pm tree wide cleanup of s/return undef/return/ 2020-10-16 16:20:05 +02:00
CGroup.pm add PVE::QemuServer::Cgroup 2020-11-24 12:00:33 +01:00
Cloudinit.pm fix #2670: cloudinit enable SLAAC 2021-03-30 18:25:06 +02:00
CPUConfig.pm anchor CPU flag regex to avoid arbitrary flag suffixes 2021-01-26 19:27:05 +01:00
Drive.pm fix #3075: add TPM v1.2 and v2.0 support via swtpm 2021-10-05 06:51:02 +02:00
Helpers.pm tree wide cleanup of s/return undef/return/ 2020-10-16 16:20:05 +02:00
ImportDisk.pm qm importdisk: tell user to what VM disk we actually imported 2019-10-29 19:11:21 +01:00
Machine.pm cfg2cmd: fix +pveN machine types with pxe 2021-04-18 17:58:56 +02:00
Makefile add PVE::QemuServer::Cgroup 2020-11-24 12:00:33 +01:00
Memory.pm fix #3581: pass size via argument for memory-backend-ram qmp call 2021-08-18 10:41:04 +02:00
Monitor.pm mon_cmd: add explicit return 2019-11-30 17:24:55 +01:00
OVF.pm Fix #3371: parse ovf: Allow dots in VM name 2021-07-29 17:17:39 +02:00
PCI.pm PCI: use warnings/strict and fix setting $vga from config2command 2020-10-16 18:03:32 +02:00
USB.pm tree wide cleanup of s/return undef/return/ 2020-10-16 16:20:05 +02:00