← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 2122296] [NEW] Firmware selection for stateless firmware is inconsistent with libvirt

 

Public bug reported:

Description
===========

While implementing support for stateless firmware, I overlooked the fact that libvirt requires that the firmware being used explicitly declare stateless mode.
(The validation is seen when creating/modifying xml via virsh command)
This validation is somehow workarounded when nova manipulates libvirt xml.

Although I've not seen any actual issue with using the normal firmware
file with stateless mode, we should follow what was implemented in
libvirt.


https://gitlab.com/libvirt/libvirt/-/commit/ef53798ab645496002aa8da2b3650dde19832f3d#ea6f893202cbbea3379bdf2907a651743e5e586a_1117_1114

Steps to reproduce
==================
- Create an image with the following properties
   - hw_machine_type='q35'
   - hw_firmware_type='uefi'
   - hw_firmware_stateless='true'
- Create an instance with the image
- Check domain xml and the loader file

Expected result
===============
The domain uses loader with explicit stateless mode

Actual result
=============
The domain uses loader without explicit stateless mode


Logs
====
Example snippet from xml generated by nova.

---
  <os>
    <type arch='x86_64' machine='pc-q35-rhel9.6.0'>hvm</type>
    <loader readonly='yes' secure='no' type='pflash' stateless='yes' format='raw'>/usr/share/edk2/ovmf/OVMF_CODE.fd</loader>
    <boot dev='hd'/>
    <smbios mode='sysinfo'/>
  </os>
---

The loader file is defined with mode: split

---
[vagrant@localhost ~]$ grep -r /usr/share/edk2/ovmf/OVMF_CODE.fd /usr/share/qemu/firmware/
/usr/share/qemu/firmware/50-edk2-ovmf-x64-nosb.json:            "filename": "/usr/share/edk2/ovmf/OVMF_CODE.fd",
[vagrant@localhost ~]$ cat /usr/share/qemu/firmware/50-edk2-ovmf-x64-nosb.json
{
    "description": "OVMF without SB+SMM, empty varstore",
    "interface-types": [
        "uefi"
    ],
    "mapping": {
        "device": "flash",
        "mode": "split",
        "executable": {
            "filename": "/usr/share/edk2/ovmf/OVMF_CODE.fd",
            "format": "raw"
        },
        "nvram-template": {
            "filename": "/usr/share/edk2/ovmf/OVMF_VARS.fd",
            "format": "raw"
        }
    },
    "targets": [
        {
            "architecture": "x86_64",
            "machines": [
                "pc-q35-*"
            ]
        }
    ],
    "features": [
        "acpi-s3",
        "amd-sev",
        "amd-sev-es",
        "verbose-dynamic"
    ],
    "tags": [

    ]
}
---

** Affects: nova
     Importance: Undecided
         Status: In Progress

** Description changed:

  Description
  ===========
  
  While implementing support for stateless firmware, I overlooked the fact that libvirt requires that the firmware being used explicitly declare stateless mode.
  (The validation is seen when creating/modifying xml via virsh command)
+ This validation is somehow workarounded when nova manipulates libvirt xml.
  
- Although this validation is somehow workarounded when nova manipulates
- libvirt xml, we should follow what was implemented in libvirt.
+ Although I've not seen any actual issue with using the normal firmware
+ file with stateless mode, we should follow what was implemented in
+ libvirt.
+ 
  
  https://gitlab.com/libvirt/libvirt/-/commit/ef53798ab645496002aa8da2b3650dde19832f3d#ea6f893202cbbea3379bdf2907a651743e5e586a_1117_1114
  
  Steps to reproduce
  ==================
  - Create an image with the following properties
-    - hw_machine_type='q35'
-    - hw_firmware_type='uefi'
-    - hw_firmware_stateless='true'
+    - hw_machine_type='q35'
+    - hw_firmware_type='uefi'
+    - hw_firmware_stateless='true'
  - Create an instance with the image
  - Check domain xml and the loader file
  
  Expected result
  ===============
  The domain uses loader with explicit stateless mode
  
  Actual result
  =============
  The domain uses loader without explicit stateless mode
+ 
+ 
+ Logs
+ ====
+ Example snippet from xml generated by nova.
+ 
+ ---
+   <os>
+     <type arch='x86_64' machine='pc-q35-rhel9.6.0'>hvm</type>
+     <loader readonly='yes' secure='no' type='pflash' stateless='yes' format='raw'>/usr/share/edk2/ovmf/OVMF_CODE.fd</loader>
+     <boot dev='hd'/>
+     <smbios mode='sysinfo'/>
+   </os>
+ ---
+ 
+ The loader file is defined with mode: split
+ 
+ ---
+ [vagrant@localhost ~]$ grep -r /usr/share/edk2/ovmf/OVMF_CODE.fd /usr/share/qemu/firmware/
+ /usr/share/qemu/firmware/50-edk2-ovmf-x64-nosb.json:            "filename": "/usr/share/edk2/ovmf/OVMF_CODE.fd",
+ [vagrant@localhost ~]$ cat /usr/share/qemu/firmware/50-edk2-ovmf-x64-nosb.json
+ {
+     "description": "OVMF without SB+SMM, empty varstore",
+     "interface-types": [
+         "uefi"
+     ],
+     "mapping": {
+         "device": "flash",
+         "mode": "split",
+         "executable": {
+             "filename": "/usr/share/edk2/ovmf/OVMF_CODE.fd",
+             "format": "raw"
+         },
+         "nvram-template": {
+             "filename": "/usr/share/edk2/ovmf/OVMF_VARS.fd",
+             "format": "raw"
+         }
+     },
+     "targets": [
+         {
+             "architecture": "x86_64",
+             "machines": [
+                 "pc-q35-*"
+             ]
+         }
+     ],
+     "features": [
+         "acpi-s3",
+         "amd-sev",
+         "amd-sev-es",
+         "verbose-dynamic"
+     ],
+     "tags": [
+ 
+     ]
+ }
+ ---

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/2122296

Title:
  Firmware selection for stateless firmware is inconsistent with libvirt

Status in OpenStack Compute (nova):
  In Progress

Bug description:
  Description
  ===========

  While implementing support for stateless firmware, I overlooked the fact that libvirt requires that the firmware being used explicitly declare stateless mode.
  (The validation is seen when creating/modifying xml via virsh command)
  This validation is somehow workarounded when nova manipulates libvirt xml.

  Although I've not seen any actual issue with using the normal firmware
  file with stateless mode, we should follow what was implemented in
  libvirt.

  
  https://gitlab.com/libvirt/libvirt/-/commit/ef53798ab645496002aa8da2b3650dde19832f3d#ea6f893202cbbea3379bdf2907a651743e5e586a_1117_1114

  Steps to reproduce
  ==================
  - Create an image with the following properties
     - hw_machine_type='q35'
     - hw_firmware_type='uefi'
     - hw_firmware_stateless='true'
  - Create an instance with the image
  - Check domain xml and the loader file

  Expected result
  ===============
  The domain uses loader with explicit stateless mode

  Actual result
  =============
  The domain uses loader without explicit stateless mode

  
  Logs
  ====
  Example snippet from xml generated by nova.

  ---
    <os>
      <type arch='x86_64' machine='pc-q35-rhel9.6.0'>hvm</type>
      <loader readonly='yes' secure='no' type='pflash' stateless='yes' format='raw'>/usr/share/edk2/ovmf/OVMF_CODE.fd</loader>
      <boot dev='hd'/>
      <smbios mode='sysinfo'/>
    </os>
  ---

  The loader file is defined with mode: split

  ---
  [vagrant@localhost ~]$ grep -r /usr/share/edk2/ovmf/OVMF_CODE.fd /usr/share/qemu/firmware/
  /usr/share/qemu/firmware/50-edk2-ovmf-x64-nosb.json:            "filename": "/usr/share/edk2/ovmf/OVMF_CODE.fd",
  [vagrant@localhost ~]$ cat /usr/share/qemu/firmware/50-edk2-ovmf-x64-nosb.json
  {
      "description": "OVMF without SB+SMM, empty varstore",
      "interface-types": [
          "uefi"
      ],
      "mapping": {
          "device": "flash",
          "mode": "split",
          "executable": {
              "filename": "/usr/share/edk2/ovmf/OVMF_CODE.fd",
              "format": "raw"
          },
          "nvram-template": {
              "filename": "/usr/share/edk2/ovmf/OVMF_VARS.fd",
              "format": "raw"
          }
      },
      "targets": [
          {
              "architecture": "x86_64",
              "machines": [
                  "pc-q35-*"
              ]
          }
      ],
      "features": [
          "acpi-s3",
          "amd-sev",
          "amd-sev-es",
          "verbose-dynamic"
      ],
      "tags": [

      ]
  }
  ---

To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/2122296/+subscriptions