Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1999028

Summary: TPM device can't be marked in added status when VM is running
Product: [oVirt] ovirt-engine Reporter: zhoujunqin <juzhou>
Component: BLL.VirtAssignee: Milan Zamazal <mzamazal>
Status: CLOSED CURRENTRELEASE QA Contact: Tamir <tamir>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 4.4.8.5CC: ahadas, bugs, chhu, tamir, tyan, tzheng
Target Milestone: ovirt-4.5.0Flags: ahadas: ovirt-4.5?
Target Release: 4.5.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: libvirt_RHV_INT
Fixed In Version: ovirt-engine-4.5.0 Doc Type: Bug Fix
Doc Text:
When TPM was enabled or disabled while the VM was running, the change wasn't applied once the VM got down or restarted. It has been fixed and the change is applied when the VM stops.
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-04-20 06:33:59 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Virt RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description zhoujunqin 2021-08-30 09:34:12 UTC
Description of problem:
TPM device can't be marked in added status when VM is running

Version-Release number of selected component (if applicable):
Server info:
Red Hat Virtualization Manager Web Administration
Software Version:4.4.8.4-0.7.el8ev
ovirt-engine-4.4.8.4-0.7.el8ev.noarch

Registered rhv node info:
libvirt-7.6.0-2.module+el8.5.0+12219+a5ea13d2.x86_64
qemu-kvm-6.0.0-28.module+el8.5.0+12271+fffa967b.x86_64
vdsm-4.40.80.5-1.el8ev.x86_64

How reproducible:
100%

Steps to Reproduce:
1. Create a 4.6 data center and a 4.6 cluster.
2. Install the host and create a new NFS or ISCSI storage domain.
3. Create a VM with disk and bios type UEFI and without TPM enabled.
4. Run the VM.
5. Open the "Edit Virtual Machine" modal.
6. Enable the TPM checkbox in the "Resource Allocation" tab and press "OK"
7. Check that the TPM checkbox in the "Resource Allocation" tab again in the "Edit Virtual Machine" modal.

Actual results:
After step7, the TPM checkbox wasn't checked in the "Resource Allocation" tab in the "Edit Virtual Machine" modal. Even though, I reset the vm.

Expected results:
Fix it.

Additional info:
1. It looks like the TPM device wasn't added at all at this point (the dump xml didn't contain this section).
# virsh dumpxml vm_tpm |grep tpm
juzhou

  <name>vm_tpm</name>

2. Tamir can also reproduce it on RHV 4.4.8-5, so I set the version to 4.4.8.5.

Comment 1 Tamir 2022-03-20 12:17:44 UTC
Verified on RHV 4.5 nightly (Close to 4.5.0-4).

Env:
    - Engine instance with RHV 4.5 nightly (ovirt-engine-4.5.0.1-601.f26e9ea8cac5.3.el8ev) and RHEL 8.6 installed.
    - 3 hosts with RHV 4.5 nightly and RHEL 8.6 and with vdsm-4.50.0.10-1.el8ev

Steps:

In Admin Portal:
1. Create a 4.7 data center and a 4.7 cluster.
2. Install the hosts and create a new NFS storage domain.
3. Create a RHEL 8.6 VM with Chipset/Firmware Type: Q35 Chipset with UEFI and without TPM enabled.
4. Run the VM.
5. Open the "Edit Virtual Machine" modal.
6. Enable the TPM checkbox in the "Resource Allocation" tab and press "OK".
7. Open the "Edit Virtual Machine" modal.
8. Check that the TPM checkbox in the "Resource Allocation" tab is checked and press "OK".
9. Reboot the VM using the Reboot button and wait for the VM's UP status.
10. Enter the VM's details page (By clicking on its name) and navigate to the "Vm Devices" tab.
11. The TPM device is displayed in the VM devices tab.
12. Enter the VM's console.
13. Run the command "ls tpm*" and check that the TPM device is displayed in the command's results (tpm0 and tpmrm0).

Results (As Expected):
1. The 4.7 data center and the 4.7 cluster were created.
2. The host was installed and the NFS storage domain was created.
3. The VM was created.
4. The VM was running.
5. The "Edit Virtual Machine" modal has opened.
6. The TPM checkbox was checked and the VM changes were saved.
7. The "Edit Virtual Machine" modal has opened.
8. The TPM checkbox was checked.
9. The VM was rebooted.
10. The VM's Devices tab is open.
11. The TPM device is displayed in the "Vm Devices" tab.
12. The VM's console has opened.
13. The TPM device is displayed in the command's results (tpm0 and tpmrm0).

Comment 2 Tamir 2022-03-20 14:23:29 UTC
The RHV version I checked on was: rhv-4.5.0.1-601.f26e9ea8cac5.3-DS-nightly.

The TPM device was added to the domain XML after the restart:
    <tpm model='tpm-crb'>
      <backend type='emulator' version='2.0'/>
      <alias name='ua-XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXX'/>
    </tpm>

Comment 3 Sandro Bonazzola 2022-04-20 06:33:59 UTC
This bugzilla is included in oVirt 4.5.0 release, published on April 20th 2022.

Since the problem described in this bug report should be resolved in oVirt 4.5.0 release, it has been closed with a resolution of CURRENT RELEASE.

If the solution does not work for you, please open a new bug report.