Omit `-no-acpi` command argument for targets that do not have the ACPI object class property
Software environment
- Operating system: Fedora 34 (Workstation Edition) 64-bit
- Architecture: x86_64
- Kernel version: 5.16.18
- libvirt version: 8.3.0
- Hypervisor and version: QEMU 5.2.0
Description of problem
I want to migrate a standalone QEMU instance of a Raspberry Pi 3 Model B to libvirt. Note that this target does not support ACPI. According to the documentation, if the <features>
element does not contain <acpi>
, then the flag -no-acpi
will be set. However, in the machine class initialization for the Raspberry Pi within qemu/hw/arm/raspi.c
, no ACPI object class property is added:
static void raspi3b_machine_class_init(ObjectClass *oc, void *data)
{
MachineClass *mc = MACHINE_CLASS(oc);
RaspiMachineClass *rmc = RASPI_MACHINE_CLASS(oc);
rmc->board_rev = 0xa02082;
raspi_machine_class_common_init(mc, rmc->board_rev);
};
This will lead to the following error when creating the domain from XML:
qemu-system-aarch64: Property 'raspi3b-machine.acpi' not found
I assume that checking if this object class property exists for the target at hand needs to be incorporated.
The relevant method appears to be static int qemuBuildPMCommandLine(virCommand *cmd, const virDomainDef *def, qemuDomainObjPrivate *priv)
within libvirt/src/qemu/qemu_command.c
.
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_NO_ACPI)) {
if (def->features[VIR_DOMAIN_FEATURE_ACPI] != VIR_TRISTATE_SWITCH_ON)
virCommandAddArg(cmd, "-no-acpi");
}
Additional information
This issue was already reported by Enoch Leung as a bug in the libvirt Ubuntu package (#1936831).