From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 04DAD71AAD for ; Tue, 5 Oct 2021 07:31:57 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id E4F0123451 for ; Tue, 5 Oct 2021 07:31:26 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id 6820123443 for ; Tue, 5 Oct 2021 07:31:26 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 3AB0D4561D for ; Tue, 5 Oct 2021 07:31:26 +0200 (CEST) Message-ID: <9c2ffaf4-48b5-8af5-7682-66175ddbe2f0@proxmox.com> Date: Tue, 5 Oct 2021 07:30:16 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:93.0) Gecko/20100101 Thunderbird/93.0 Content-Language: en-US To: Proxmox VE development discussion , Stefan Reiter References: <20211004152921.2839809-1-s.reiter@proxmox.com> <20211004152921.2839809-3-s.reiter@proxmox.com> From: Thomas Lamprecht In-Reply-To: <20211004152921.2839809-3-s.reiter@proxmox.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.226 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [qemuserver.pm, qemumigrate.pm, drive.pm, qemu.pm] Subject: [pve-devel] applied: [PATCH v3 qemu-server 2/3] fix #3075: add TPM v1.2 and v2.0 support via swtpm X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Oct 2021 05:31:57 -0000 On 04.10.21 17:29, Stefan Reiter wrote: > 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 > --- > PVE/API2/Qemu.pm | 5 ++ > PVE/QemuMigrate.pm | 14 +++- > PVE/QemuServer.pm | 137 +++++++++++++++++++++++++++++++++++++-- > PVE/QemuServer/Drive.pm | 63 ++++++++++++++---- > PVE/VZDump/QemuServer.pm | 43 ++++++++++-- > 5 files changed, 238 insertions(+), 24 deletions(-) > > applied, with a few trivial whitespace related cleanups, thanks!