mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-20 07:59:00 +00:00
qemu: Do not hardcode Hyper-V feature names on command line
When constructing the command line for QEMU, some Hyper-V features were hardcoded, probably due to the fact that they could not have been automatically translated from the libvirt feature name to QEMU CPU feature name. Well now they can be, thanks to their additions to the virQEMUCapsCPUFeaturesX86 translation table. Translate all such features the same way when constructing the command line. This way any future feature that is not translated will be caught by tests (if a test is added for it) which was not the case when it was just hardcoded. Hopefully this avoids at least some possible future issues. Signed-off-by: Martin Kletzander <mkletzan@redhat.com> Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
parent
ca8c0862ac
commit
f7c89763b1
@ -6315,9 +6315,15 @@ qemuBuildCpuCommandLine(virCommand *cmd,
|
||||
case VIR_DOMAIN_HYPERV_IPI:
|
||||
case VIR_DOMAIN_HYPERV_EVMCS:
|
||||
case VIR_DOMAIN_HYPERV_AVIC:
|
||||
if (def->hyperv_features[i] == VIR_TRISTATE_SWITCH_ON)
|
||||
virBufferAsprintf(&buf, ",hv-%s=on",
|
||||
virDomainHypervTypeToString(i));
|
||||
case VIR_DOMAIN_HYPERV_EMSR_BITMAP:
|
||||
case VIR_DOMAIN_HYPERV_XMM_INPUT:
|
||||
if (def->hyperv_features[i] == VIR_TRISTATE_SWITCH_ON) {
|
||||
const char *name = virDomainHypervTypeToString(i);
|
||||
g_autofree char *full_name = g_strdup_printf("hv-%s", name);
|
||||
const char *qemu_name = virQEMUCapsCPUFeatureToQEMU(def->os.arch,
|
||||
full_name);
|
||||
virBufferAsprintf(&buf, ",%s=on", qemu_name);
|
||||
}
|
||||
if ((i == VIR_DOMAIN_HYPERV_STIMER) &&
|
||||
(def->hyperv_stimer_direct == VIR_TRISTATE_SWITCH_ON))
|
||||
virBufferAsprintf(&buf, ",%s=on", VIR_CPU_x86_HV_STIMER_DIRECT);
|
||||
@ -6336,16 +6342,6 @@ qemuBuildCpuCommandLine(virCommand *cmd,
|
||||
def->hyperv_vendor_id);
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_HYPERV_EMSR_BITMAP:
|
||||
if (def->hyperv_features[i] == VIR_TRISTATE_SWITCH_ON)
|
||||
virBufferAsprintf(&buf, ",%s=on", "hv-emsr-bitmap");
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_HYPERV_XMM_INPUT:
|
||||
if (def->hyperv_features[i] == VIR_TRISTATE_SWITCH_ON)
|
||||
virBufferAsprintf(&buf, ",%s=on", "hv-xmm-input");
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_HYPERV_LAST:
|
||||
break;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user