Bug 1855367

Summary: [RFE] Support for TPM in memory snapshots
Product: Red Hat Enterprise Linux 9 Reporter: Milan Zamazal <mzamazal>
Component: libvirtAssignee: Virtualization Maintenance <virt-maint>
libvirt sub component: General QA Contact: Yanqiu Zhang <yanqzhan>
Status: CLOSED WONTFIX Docs Contact:
Severity: medium    
Priority: medium CC: ahadas, chhu, dyuan, fjin, jsuchane, juzhou, lmen, marcandre.lureau, mprivozn, pkrempa, virt-maint, xuzhang, yanqzhan
Version: 9.1Keywords: FutureFeature, Reopened, Triaged
Target Milestone: pre-dev-freeze   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-02-23 07:27:41 UTC Type: Feature Request
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1956115    

Description Milan Zamazal 2020-07-09 16:47:06 UTC
Emulated TPM devices, including TPM data storage, are handled with the external help of swtpm. When a memory snapshot is created, TPM state and data from swtpm must be stored as well and then provided when the VM is restored from the snapshot. To my knowledge, libvirt currently doesn't handle TPM data in memory snapshots and it doesn't provide a mechanism to copy swtpm data manually while ensuring their consistency with the snapshot.

In order to be able to make memory snapshots of VMs containing emulated TPM devices without risking errors, mismatches or data loss, libvirt support for TPM data in snapshots is needed.

Comment 1 Jaroslav Suchanek 2020-07-10 09:05:17 UTC
*** Bug 1855364 has been marked as a duplicate of this bug. ***

Comment 3 John Ferlan 2021-09-08 13:19:40 UTC
Bulk update - Move RHEL-AV bugs to RHEL

Comment 6 RHEL Program Management 2022-01-09 07:26:57 UTC
After evaluating this issue, there are no plans to address it further or fix it in an upcoming release.  Therefore, it is being closed.  If plans change such that this issue will be fixed in an upcoming release, then the bug can be reopened.

Comment 7 zhoujunqin 2022-08-19 08:11:21 UTC
The bug issue still exists.

Steps:
Red Hat Virtualization Manager Web Administration
Software Version:4.5.2.1-0.1.el8ev

RHV node:
vdsm-4.50.1.4-1.el8ev.x86_64
libvirt-8.0.0-10.module+el8.7.0+16047+746a126c.x86_64
kernel-4.18.0-416.el8.x86_64
qemu-kvm-6.2.0-18.module+el8.7.0+15999+d24f860e.x86_64

1. Prepare a running VM with TPM device enabled.
2. Left-click the VM and then right-click and select 'Create Snapshot'
3. Keep the default setting in the popup 'Create Snapshot' window, and fill the name into the 'Description', then click 'OK'.

Test result: Failed to create snapshot with checking 'Saving memory'.
"""
Operation Canceled
Error while executing action:

test-tpm:
Cannot create Snapshot. VM has a TPM device attached.
"""


And I have noticed that this bug has been closed automatically, and do you plan to fix it, thanks.

Comment 8 Milan Zamazal 2022-08-19 08:24:45 UTC
As this RFE hasn't been implemented by the platform, RHV won't support this feature.

Comment 9 zhoujunqin 2022-08-19 09:53:32 UTC
Hi Peter, 
Could you help have a look at the previous comments, thanks?

BR,
juzhou.

Comment 10 Yanqiu Zhang 2022-08-22 08:50:11 UTC
Hi junqin,
I asked Jaroslav and Michal for helping evaluating.
RHV won't use it, CNV might not be interested in memory snapshots yet. And for migration: live-migration is about having the swtpm state on a shared disk and there are some issues with locking the state files.

So no need to fix it currently.
Please just regard the error you encountered as expected. Thank you!

Comment 11 Arik 2022-08-22 09:41:51 UTC
(In reply to yanqzhan from comment #10)
> And for migration: live-migration is about having the swtpm state on a shared
> disk and there are some issues with locking the state files.

Milan, we migrate VMs with TPM while the swtpm state is not placed on a shared disk, no?

Comment 13 Milan Zamazal 2022-08-31 07:34:54 UTC
(In reply to Arik from comment #11)
> (In reply to yanqzhan from comment #10)
> > And for migration: live-migration is about having the swtpm state on a shared
> > disk and there are some issues with locking the state files.
> 
> Milan, we migrate VMs with TPM while the swtpm state is not placed on a
> shared disk, no?

Yes, swtpm data is stored on a local file system and the transfer is handled transparently by libvirt.

Comment 17 RHEL Program Management 2023-02-23 07:27:41 UTC
After evaluating this issue, there are no plans to address it further or fix it in an upcoming release.  Therefore, it is being closed.  If plans change such that this issue will be fixed in an upcoming release, then the bug can be reopened.