From a81784ea3a7176dd12d60635da9f65e2a10460e5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Daniel=20P=2E=20Berrang=C3=A9?= Date: Thu, 7 Oct 2021 15:33:35 +0100 Subject: [PATCH] qemu: always use hyphens in hyperv feature names MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit QEMU switched from using underscores in x86 CPU features to hyphens in the 2.8.0 series with two commits commit fc7dfd205f3287893c436d932a167bffa30579c8 (HEAD, refs/bisect/bad) Author: Eduardo Habkost Date: Fri Sep 30 15:49:40 2016 -0300 target-i386: Remove underscores from feat_names arrays commit 54b8dc7c19cd781e96f1e9b001ca6001d804eb19 Author: Eduardo Habkost Date: Fri Sep 30 15:49:38 2016 -0300 target-i386: Register aliases for feature names with underscores Libvirt names use underscores so we conditionally tranlate the names when talking to new QEMU. Since the min QEMU was raised to version 2.11.0, all QEMU versions we talk to expect hypens, so the translation can be done unconditionally. Reviewed-by: Jiri Denemark Signed-off-by: Daniel P. Berrangé --- src/qemu/qemu_command.c | 8 +------- tests/qemuxml2argvdata/hyperv.x86_64-4.0.0.args | 2 +- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index dba877a740..9e670162c0 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -6813,11 +6813,6 @@ qemuBuildCpuCommandLine(virCommand *cmd, } if (def->features[VIR_DOMAIN_FEATURE_HYPERV] == VIR_TRISTATE_SWITCH_ON) { - const char *hvPrefix = "hv-"; - - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_CANONICAL_CPU_FEATURES)) - hvPrefix = "hv_"; - for (i = 0; i < VIR_DOMAIN_HYPERV_LAST; i++) { switch ((virDomainHyperv) i) { case VIR_DOMAIN_HYPERV_RELAXED: @@ -6833,8 +6828,7 @@ qemuBuildCpuCommandLine(virCommand *cmd, case VIR_DOMAIN_HYPERV_IPI: case VIR_DOMAIN_HYPERV_EVMCS: if (def->hyperv_features[i] == VIR_TRISTATE_SWITCH_ON) - virBufferAsprintf(&buf, ",%s%s", - hvPrefix, + virBufferAsprintf(&buf, ",hv-%s", virDomainHypervTypeToString(i)); if ((i == VIR_DOMAIN_HYPERV_STIMER) && (def->hyperv_stimer_direct == VIR_TRISTATE_SWITCH_ON)) diff --git a/tests/qemuxml2argvdata/hyperv.x86_64-4.0.0.args b/tests/qemuxml2argvdata/hyperv.x86_64-4.0.0.args index 100223b53a..32cc2fbff7 100644 --- a/tests/qemuxml2argvdata/hyperv.x86_64-4.0.0.args +++ b/tests/qemuxml2argvdata/hyperv.x86_64-4.0.0.args @@ -12,7 +12,7 @@ QEMU_AUDIO_DRV=none \ -S \ -object secret,id=masterKey0,format=raw,file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ -machine pc-i440fx-4.0,accel=tcg,usb=off,dump-guest-core=off \ --cpu 'qemu32,hv_relaxed,hv_vapic,hv-spinlocks=0x2fff,hv_vpindex,hv_runtime,hv_synic,hv_stimer,hv_reset,hv-vendor-id=KVM Hv,hv_frequencies,hv_reenlightenment,hv_tlbflush,hv_ipi,hv_evmcs' \ +-cpu 'qemu32,hv-relaxed,hv-vapic,hv-spinlocks=0x2fff,hv-vpindex,hv-runtime,hv-synic,hv-stimer,hv-reset,hv-vendor-id=KVM Hv,hv-frequencies,hv-reenlightenment,hv-tlbflush,hv-ipi,hv-evmcs' \ -m 214 \ -overcommit mem-lock=off \ -smp 6,sockets=6,cores=1,threads=1 \ -- 2.47.2