mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-21 22:53:37 +00:00
lib/qemu.c: Add -cpu max when testing for KVM via QMP
On RHEL 10.2 aarch64 (only) we see:
$ echo '{ "execute": "qmp_capabilities" }' '{ "execute": "query-kvm" }' '{ "execute": "quit" }' | QEMU_AUDIO_DRV=none "/usr/libexec/qemu-kvm" -display none -machine "virt,accel=kvm:hvf:tcg" -qmp stdio
qemu-kvm: invalid accelerator hvf
qemu-kvm: falling back to KVM
{"QMP": {"version": {"qemu": {"micro": 0, "minor": 1, "major": 9}, "package": "qemu-kvm-9.1.0-15.el10_0.4"}, "capabilities": ["oob"]}}
qemu-kvm: warning: CPU model cortex-a57-arm-cpu is deprecated -- use 'host' / 'max'
qemu-kvm: kvm_init_vcpu: kvm_arch_init_vcpu failed (0): Invalid argument
Unfortunately we cannot use guestfs_int_get_cpu_model (as that
requires us to already know if KVM is supported), so we just have to
guess that -cpu max will work, at least enough for QMP to work.
Fixes: https://issues.redhat.com/browse/RHEL-121076
Reported-by: Xiang Hua Chen
This commit is contained in:
@@ -80,6 +80,7 @@ generic_qmp_test (guestfs_h *g, const char *qmp_command, char **outp)
|
||||
guestfs_int_cmd_add_string_unquoted (cmd, "QEMU_AUDIO_DRV=none ");
|
||||
guestfs_int_cmd_add_string_quoted (cmd, g->hv);
|
||||
guestfs_int_cmd_add_string_unquoted (cmd, " -display none");
|
||||
guestfs_int_cmd_add_string_unquoted (cmd, " -cpu max");
|
||||
guestfs_int_cmd_add_string_unquoted (cmd, " -machine ");
|
||||
guestfs_int_cmd_add_string_quoted (cmd,
|
||||
#ifdef MACHINE_TYPE
|
||||
|
||||
Reference in New Issue
Block a user