Bug 1683301

Summary: [RFE] [machines] Provide the option to use host CPU model when creating/editing VM
Product: Red Hat Enterprise Linux 8 Reporter: Javier Coscia <jcoscia>
Component: cockpit-appstreamAssignee: Katerina Koukiou <kkoukiou>
Status: CLOSED ERRATA QA Contact: YunmingYang <yunyang>
Severity: low Docs Contact:
Priority: unspecified    
Version: 8.1CC: fedoraproject, kkoukiou, qiyuan, sirao, xchen, yunyang
Target Milestone: rcKeywords: FutureFeature, Triaged
Target Release: 8.4   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 234 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-05-18 15:53:08 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:

Description Javier Coscia 2019-02-26 14:47:27 UTC
Description of problem:

There are some cases where we need to emulate / copy CPU host into the 
guest when creating it (-cpu flag in qemu), such as when using nested 
virtualization to run labs / PoC/ demos. 



This is already present in virt-manager:

With the VM down: Select the VM > Open > Details > CPUs > Configuration 

With virsh, define or edit xml `cpu mode` section

Version-Release number of selected component (if applicable):


kernel-4.18.0-67.el8.x86_64
cockpit-machines-184.1-1.el8.noarch


How reproducible:

100% 

Actual results:

There is no option to configure CPU model on the guest when creating or 
once VM is created.

Expected results:

Expose this option for users to be able to copy Host CPU 
configuration.

Comment 3 Katerina Koukiou 2020-11-27 11:46:06 UTC
*** Bug 1680297 has been marked as a duplicate of this bug. ***

Comment 4 Katerina Koukiou 2020-11-30 14:35:40 UTC
PR sent upstream: https://github.com/cockpit-project/cockpit/pull/14969

Comment 7 Xianghua Chen 2021-01-05 12:30:58 UTC
Verified with packages:
cockpit-machines-234-1.el8.noarch
libvirt-dbus-1.3.0-2.module+el8.3.0+6423+e4cb6418.x86_64

Steps:
1. Prepare a bare mental env, click Import VM 
2. Choose an existing vm image, click Import and wait until the vm start successfully, then check the CPU type
The CPU type is same to the generation of the host CPUs in use, e.g.: custom (Haswell-noTSX-IBRS)
Refer to: https://www.qemu.org/docs/master/system/qemu-cpu-models.html 
3. Check the cpu mode by dumping the xml:
# virsh dumpxml vm-name
<cpu mode='custom' match='exact' check='full'>
    <model fallback='forbid'>Haswell-noTSX-IBRS</model>
    <vendor>Intel</vendor>
    <feature policy='require' name='vme'/>
    <feature policy='require' name='ss'/>
    <feature policy='require' name='vmx'/>
    <feature policy='require' name='pdcm'/>
    <feature policy='require' name='f16c'/>
    <feature policy='require' name='rdrand'/>
... ...
4. Shutdown the vm, the CPU type will not change and match the host CPU
5. Check the cpu mode by dumping xml again
The cpu mode should be the same as before
6. Run the vm again, click edit after the CPU type, choose a different mode, but click cancel
The dialog can be closed, and the no changes to the CPU type
7. Click edit after the CPU type again, choose a different mode, click Apply
There will be an icon showing "Changes will take effect after shutting down the VM"
8. Dump the xml again and check the cpu type
The cpu mode should be the same as changes before, same as shown on the page 
9. Close the VM , check the CPU type on the page and dump the xml again to check the cpu type
The CPU type on the page is changed to the new one in step 7.
The CPU type in the xml should be the same as step 7, same as shown on the page.
10. Click edit again and change to a different mode, check the CPU type on the page and the xml
The CPU type on the page will change immediately per the step.
The CPU type in the xml should changed too, same as shown on the page.
11. Change the CPU type to "host-model" and "host-passthrough"
Check the CPU type and the xml again, and check again after running.

So verified.

Comment 9 errata-xmlrpc 2021-05-18 15:53:08 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (cockpit-appstream bug fix and enhancement update), and where to find the updated
files, follow the link below.

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

https://access.redhat.com/errata/RHBA-2021:1875