From: Collin Walling Date: Mon, 30 Jun 2025 03:19:28 +0000 (-0400) Subject: qemu: process: refactor deprecated features code X-Git-Tag: v11.6.0-rc1~10 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f279ea36b0715889b666113f645e928c88590c4f;p=thirdparty%2Flibvirt.git qemu: process: refactor deprecated features code Group up the deprecated features code into a single block to keep things clean; only check if the deprecated_features attribute is present once and then do relevent work. Signed-off-by: Collin Walling Reviewed-by: Boris Fiuczynski Acked-by: Thomas Huth --- diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index da87ae609b..623d75e15a 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -6536,18 +6536,17 @@ qemuProcessUpdateGuestCPU(virDomainDef *def, &def->os.arch) < 0) return -1; - if (def->cpu->deprecated_feats && - !virQEMUCapsGet(qemuCaps, QEMU_CAPS_QUERY_CPU_MODEL_EXPANSION_DEPRECATED_PROPS)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("toggling deprecated features for CPU model is unsupported")); - return -1; - } - if (def->cpu->deprecated_feats) { virCPUFeaturePolicy policy = VIR_CPU_FEATURE_REQUIRE; if (def->cpu->deprecated_feats == VIR_TRISTATE_SWITCH_OFF) policy = VIR_CPU_FEATURE_DISABLE; + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_QUERY_CPU_MODEL_EXPANSION_DEPRECATED_PROPS)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("toggling deprecated features for CPU model is unsupported")); + return -1; + } + virQEMUCapsUpdateCPUDeprecatedFeatures(qemuCaps, def->virtType, def->cpu, policy); }