Bug 1914648

Summary: Q35: BIOS type changed to "Default" when creating new VM from template with Q35 chipset.
Product: [oVirt] ovirt-engine Reporter: Arik <ahadas>
Component: RestAPIAssignee: Arik <ahadas>
Status: CLOSED CURRENTRELEASE QA Contact: Nisim Simsolo <nsimsolo>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 4.4.4CC: ahadas, bugs, kevin.a.price, mavital, nsimsolo, rbarry, rik.theys, sgoodman, trvrmeyer
Target Milestone: ovirt-4.4.5Flags: pm-rhel: ovirt-4.4+
pm-rhel: planning_ack+
ahadas: devel_ack+
mavital: testing_ack+
Target Release: 4.4.5   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: ovirt-engine-4.4.5-0.11 Doc Type: Bug Fix
Doc Text:
Cause: Inserting a Virtual machine via the rest-api with an existing template that contained a custom Bios Type, did not clone the custom bios type to the Virtual Machine. Consequence: The new Virtual machine defaulted to the cluster's Bios Type. Fix: Added the fix to copy the Custom Bios Type of the Template to the Custom Bios Type of the Virtual Machine. Result: Adding a Virtual Machine with a Template that contains a Custom Bios Type will now obtain the Bios Type from the Template
Story Points: ---
Clone Of: 1678262 Environment:
Last Closed: 2021-03-18 15:13:37 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Virt RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Bios Set to Q35 custom after rest API insert none

Description Arik 2021-01-10 14:11:59 UTC
+++ This bug was initially created as a clone of Bug #1678262 +++

Description of problem:
- When creating new VM from template with Q35 chipset and UEFI BIOS, the BIOS type changed to "Default", which eventually cause to start VM failure with vdsm.log ERROR:
libvirtError: XML error: The PCI controller with index='0' must be model='pcie-root' for this machine type, but model='(null)' was found instead
- Observing the template, shows that BIOS type kept correctly, but when creating new VM from template, the BIOS type changed to default. 
- possible workaround is to change BIOS type when creating new VM from temp, or after the VM was created. 

Version-Release number of selected component (if applicable):
ovirt-engine-4.3.0.5-0.0.master.20190207124642.git415c7e8.el7.noarch
vdsm-4.30.8-58.git60c5a6d.el7.x86_64
qemu-kvm-ev-2.12.0-18.el7_6.3.1.x86_64
libvirt-client-4.5.0-10.el7_6.4.x86_64

How reproducible:
100%

Steps to Reproduce:
1. Make template from VM with Q35 chipset and UEFI BIOS.
2. Create new VM from template.
3.

Actual results:
BIOS type changed to "Default".

Expected results:
BIOS type should be UEFI BIOS.

Comment 1 Steven Rosenberg 2021-01-11 13:09:36 UTC
I tested this with the Rest Api using the following xml:

POST http://10.46.10.158:8080/ovirt-engine/api/vms

<vm>
  <name>myvm</name>
  <template>
    <name>Blank</name>
  </template>
  <cluster>
    <name>Default</name>
  </cluster>
  <bios>
      <type>q35_sea_bios</type>
  </bios>
</vm>

This does create the Virtual Machine with Bios Type "Q35 Chipset with BIOS" and not the default.

The code that updates the Bios Type for Rest API is already implemented [1]


[1] https://github.com/oVirt/ovirt-engine/blob/68721ead04cef0378937cd331fae3170b4c275ba/backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/VmBaseMapper.java#L192

Comment 2 Arik 2021-01-11 13:53:23 UTC
You need to set up a template with custom bios type (no matter which type) and then provision a VM based on that template as you did
Then in the edit-VM dialog, go to the 'system' tab and check the 'custom chipset/firmware type' - it shouldn't show 'Cluster default'

Comment 3 Steven Rosenberg 2021-01-12 12:59:28 UTC
Created attachment 1746625 [details]
Bios Set to Q35 custom after rest API insert

I created a Template with Q35 set as a Custom Bios and then preformed the insert specifying the VM1_temp template:

<vm>
  <name>myvm</name>
  <template>
    <name>VM1_temp</name>
  </template>
  <cluster>
    <name>Default</name>
  </cluster>
  <bios>
      <type>q35_sea_bios</type>
  </bios>
</vm>


As per the screen shot, the Bios Type was set to Q35 for the new Virtual machine. 

The return values for the rest api message also give the correct Bios Type returned:

<bios>
<boot_menu>
<enabled>false</enabled>
</boot_menu>
<type>q35_sea_bios</type>
 </bios>

Comment 4 Arik 2021-01-12 13:25:10 UTC
Ah I see, it was set because you specified a custom bios type in the request.
The request to add the VM should rather be:

<vm>
  <name>myvm</name>
  <template>
    <name>VM1_temp</name>
  </template>
  <cluster>
    <name>Default</name>
  </cluster>
</vm>

Comment 6 Nisim Simsolo 2021-02-09 08:27:18 UTC
Verified:
ovirt-engine-4.4.5.4-0.6.el8ev.noarch
qemu-kvm-5.1.0-19.module+el8.3.1+9795+4ce2a535.x86_64
libvirt-daemon-6.6.0-13.module+el8.3.1+9548+0a8fede5.x86_64
vdsm-4.40.50.4-1.el8ev.x86_64

Verification scenario:
1. Make template from VM with Q35 chipset and UEFI BIOS.
2. Create new VM from template.
3. Repeat steps 1-2 for VM with Q35 chipset and UEFI SecureBoot

Comment 7 Sandro Bonazzola 2021-03-18 15:13:37 UTC
This bugzilla is included in oVirt 4.4.5 release, published on March 18th 2021.

Since the problem described in this bug report should be resolved in oVirt 4.4.5 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.

Comment 8 Sandro Bonazzola 2021-03-22 12:55:36 UTC
This bugzilla is included in oVirt 4.4.5 release, published on March 18th 2021.

Since the problem described in this bug report should be resolved in oVirt 4.4.5 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.