1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-12-03 16:25:09 +03:00

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 <walling@linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Acked-by: Thomas Huth <thuth@redhat.com>
This commit is contained in:
Collin Walling
2025-06-29 23:19:28 -04:00
committed by Jiri Denemark
parent 30335e5fc5
commit f279ea36b0

View File

@@ -6536,18 +6536,17 @@ qemuProcessUpdateGuestCPU(virDomainDef *def,
&def->os.arch) < 0) &def->os.arch) < 0)
return -1; 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) { if (def->cpu->deprecated_feats) {
virCPUFeaturePolicy policy = VIR_CPU_FEATURE_REQUIRE; virCPUFeaturePolicy policy = VIR_CPU_FEATURE_REQUIRE;
if (def->cpu->deprecated_feats == VIR_TRISTATE_SWITCH_OFF) if (def->cpu->deprecated_feats == VIR_TRISTATE_SWITCH_OFF)
policy = VIR_CPU_FEATURE_DISABLE; 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, virQEMUCapsUpdateCPUDeprecatedFeatures(qemuCaps, def->virtType,
def->cpu, policy); def->cpu, policy);
} }