mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-10 23:07:44 +00:00
qemu: Use switch statement in qemuBuildCpuCommandLine()
Make sure we are taking all possible virDomainTimerNameType values into account. This will make upcoming changes easier. Signed-off-by: Andrea Bolognani <abologna@redhat.com> Reviewed-by: Masayoshi Mizuma <m.mizuma@jp.fujitsu.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
9b82e2c4b0
commit
f8e923c1ba
@ -6594,16 +6594,30 @@ qemuBuildCpuCommandLine(virCommandPtr cmd,
|
||||
for (i = 0; i < def->clock.ntimers; i++) {
|
||||
virDomainTimerDefPtr timer = def->clock.timers[i];
|
||||
|
||||
if (timer->name == VIR_DOMAIN_TIMER_NAME_KVMCLOCK &&
|
||||
timer->present != -1) {
|
||||
qemuBuildCpuFeature(qemuCaps, &buf, "kvmclock",
|
||||
!!timer->present);
|
||||
} else if (timer->name == VIR_DOMAIN_TIMER_NAME_HYPERVCLOCK &&
|
||||
timer->present == 1) {
|
||||
virBufferAddLit(&buf, ",hv-time");
|
||||
} else if (timer->name == VIR_DOMAIN_TIMER_NAME_TSC &&
|
||||
timer->frequency > 0) {
|
||||
virBufferAsprintf(&buf, ",tsc-frequency=%lu", timer->frequency);
|
||||
switch ((virDomainTimerNameType)timer->name) {
|
||||
case VIR_DOMAIN_TIMER_NAME_KVMCLOCK:
|
||||
if (timer->present != -1) {
|
||||
qemuBuildCpuFeature(qemuCaps, &buf, "kvmclock",
|
||||
!!timer->present);
|
||||
}
|
||||
break;
|
||||
case VIR_DOMAIN_TIMER_NAME_HYPERVCLOCK:
|
||||
if (timer->present == 1)
|
||||
virBufferAddLit(&buf, ",hv-time");
|
||||
break;
|
||||
case VIR_DOMAIN_TIMER_NAME_TSC:
|
||||
if (timer->frequency > 0)
|
||||
virBufferAsprintf(&buf, ",tsc-frequency=%lu", timer->frequency);
|
||||
break;
|
||||
case VIR_DOMAIN_TIMER_NAME_PLATFORM:
|
||||
case VIR_DOMAIN_TIMER_NAME_PIT:
|
||||
case VIR_DOMAIN_TIMER_NAME_RTC:
|
||||
case VIR_DOMAIN_TIMER_NAME_HPET:
|
||||
break;
|
||||
case VIR_DOMAIN_TIMER_NAME_LAST:
|
||||
default:
|
||||
virReportEnumRangeError(virDomainTimerNameType, timer->name);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user