qemu: Change signature for virQEMUCapsSupportsI8042Toggle()

We will soon need to use it in a context where we don't have
a virDomainDef handy.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Andrea Bolognani 2024-08-28 14:43:49 +02:00
parent d292c5ba17
commit e0e496d90c
3 changed files with 9 additions and 7 deletions

View File

@ -6032,15 +6032,16 @@ virQEMUCapsSupportsI8042(virQEMUCaps *qemuCaps,
bool
virQEMUCapsSupportsI8042Toggle(virQEMUCaps *qemuCaps,
const virDomainDef *def)
const char *machine,
const virArch arch)
{
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_MACHINE_I8042_OPT))
return false;
return qemuDomainIsI440FX(def) ||
qemuDomainIsQ35(def) ||
qemuDomainIsXenFV(def) ||
STREQ(def->os.machine, "isapc");
return qemuDomainMachineIsI440FX(machine, arch) ||
qemuDomainMachineIsQ35(machine, arch) ||
qemuDomainMachineIsXenFV(machine, arch) ||
STREQ(machine, "isapc");
}

View File

@ -723,7 +723,8 @@ bool virQEMUCapsSupportsI8042(virQEMUCaps *qemuCaps,
const virDomainDef *def);
bool virQEMUCapsSupportsI8042Toggle(virQEMUCaps *qemuCaps,
const virDomainDef *def);
const char *machine,
const virArch arch);
const char *virQEMUCapsGetBinary(virQEMUCaps *qemuCaps);
virArch virQEMUCapsGetArch(virQEMUCaps *qemuCaps);

View File

@ -258,7 +258,7 @@ qemuValidateDomainDefFeatures(const virDomainDef *def,
}
if (def->features[i] != VIR_TRISTATE_SWITCH_ABSENT &&
!virQEMUCapsSupportsI8042Toggle(qemuCaps, def)) {
!virQEMUCapsSupportsI8042Toggle(qemuCaps, def->os.machine, def->os.arch)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("ps2 feature state cannot be controlled with this QEMU binary"));
return -1;