GitHub user rkozello created a discussion: Windows VM does not get proper BIOS 
parameters from KVM libvirt domain

### problem

With default settings of ACS 4.22 libvirt domain is defined with pc-i440fx-8.2 
machine type and there is no way to change this from API/UI. However, with this 
machine type Windows Server 2022 VM reports BIOS without serial number like
```
PS C:\Users\Administrator> gwmi Win32_BIOS

SMBIOSBIOSVersion :
Manufacturer      :
Name              : Default System BIOS
SerialNumber      :
Version           : BOCHS  - 1
```

If you change machine type to pc-i440fx-6.2 Windows Server 2022 reports version 
and serial OK

```
PS C:\Users\Administrator> gwmi Win32_BIOS

SMBIOSBIOSVersion : 1.16.3-debian-1.16.3-2
Manufacturer      : SeaBIOS
Name              : Default System BIOS
SerialNumber      : 2ccd054e-24aa-47f5-b2fc-37b4605fccf2
Version           : BOCHS  - 1
```
Seems like a bug in SeaBIOS, not ACS, however, some software does not work 
properly, or can't be licensed, or refuses to install without BIOS servial 
number.
Linux VM handles BIOS entries from  pc-i440fx-8.2 machine properly
```
$ sudo dmidecode
# dmidecode 3.5
Getting SMBIOS data from sysfs.
SMBIOS 3.0.0 present.
Table at 0xD54FFD60.

Handle 0x0000, DMI type 0, 24 bytes
BIOS Information
        Vendor: SeaBIOS
        Version: 1.16.3-debian-1.16.3-2
        Release Date: 04/01/2014
        Address: 0xE8000
        Runtime Size: 96 kB
        ROM Size: 64 kB
        Characteristics:
                BIOS characteristics not supported
                Targeted content distribution is supported
        BIOS Revision: 0.0

Handle 0x0100, DMI type 1, 27 bytes
System Information
        Manufacturer: Apache Software Foundation
        Product Name: CloudStack KVM Hypervisor
        Version: pc-i440fx-8.2
        Serial Number: adca5d5b-acde-484b-b456-9b305abd8b21
        UUID: adca5d5b-acde-484b-b456-9b305abd8b21
        Wake-up Type: Power Switch
        SKU Number: Not Specified
        Family: Not Specified
```

### versions

ACS 4.22 on Ubuntu 24.04.3 LTS
libvirtd (libvirt) 10.0.0


### The steps to reproduce the bug

1. Deploy Windows Server VM from template or via ISO install
2. In PowerShell, run commang
`gwmi Win32_BIOS` or `Get-WmiObject -Class Win32_BIOS`
3. Check output


### What to do about it?

This change fixes problem, however, would be better implement conditional logic 
to set `_machine = 'pc-i440fx-6.2'` for Windows VMs only.
```
~/cloudstack$ git diff 
plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java
diff --git 
a/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java
 
b/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java
index bf002b37f3..e78bc7bd65 100644
--- 
a/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java
+++ 
b/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java
@@ -211,6 +211,7 @@ public class LibvirtVMDef {
                 guestDef.append("<entry name='product'>" + getProduct() + 
"</entry>\n");
                 guestDef.append("<entry name='uuid'>" + _uuid + "</entry>\n");
                 guestDef.append("<entry name='serial'>" + _uuid + 
"</entry>\n");
+                guestDef.append("<entry name='family'>Virtual 
Machine</entry>\n");
                 guestDef.append("</system>\n");
                 guestDef.append("</sysinfo>\n");

@@ -219,9 +220,7 @@ public class LibvirtVMDef {
                 if (_arch != null) {
                     guestDef.append(" arch='" + _arch + "'");
                 }
-                if (_machine != null) {
-                    guestDef.append(" machine='" + _machine + "'");
-                }
+                guestDef.append(" machine='pc-i440fx-6.2'");
                 guestDef.append(">hvm</type>\n");
                 if (_arch != null && _arch.equals("aarch64")) {
                     guestDef.append("<loader readonly='yes' 
type='pflash'>/usr/share/AAVMF/AAVMF_CODE.fd</loader>\n");
```


GitHub link: https://github.com/apache/cloudstack/discussions/12861

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: [email protected]

Reply via email to