Reuse "kvm-pit-device" test case for testing it.
Signed-off-by: Maxim Nestratov <mnestratov(a)virtuozzo.com>
---
src/qemu/qemu_command.c | 8 +++++++-
tests/qemuxml2argvdata/qemuxml2argv-kvm-pit-device.xml | 2 +-
tests/qemuxml2argvtest.c | 1 +
3 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index cd243e4..7f10d75 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -6158,8 +6158,14 @@ qemuBuildClockCommandLine(virCommandPtr cmd,
return -1;
}
break;
- case VIR_DOMAIN_TIMER_TICKPOLICY_MERGE:
case VIR_DOMAIN_TIMER_TICKPOLICY_DISCARD:
+ if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM_PIT_TICK_POLICY))
+ virCommandAddArgList(cmd, "-global",
+ "kvm-pit.lost_tick_policy=discard",
NULL);
+ else if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_NO_KVM_PIT))
+ virCommandAddArg(cmd, "-no-kvm-pit-reinjection");
+ break;
+ case VIR_DOMAIN_TIMER_TICKPOLICY_MERGE:
/* no way to support these modes for pit in qemu */
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("unsupported pit tickpolicy '%s'"),
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-kvm-pit-device.xml
b/tests/qemuxml2argvdata/qemuxml2argv-kvm-pit-device.xml
index 7835a1b..d8ddcba 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-kvm-pit-device.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-kvm-pit-device.xml
@@ -9,7 +9,7 @@
<boot dev='hd'/>
</os>
<clock offset='utc'>
- <timer name='pit' tickpolicy='delay'/>
+ <timer name='pit' tickpolicy='discard'/>
</clock>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index b8619dd..713a8fe 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -2060,6 +2060,7 @@ mymain(void)
qemuTestSetHostArch(driver.caps, VIR_ARCH_NONE);
DO_TEST("kvm-pit-delay", QEMU_CAPS_KVM_PIT_TICK_POLICY);
+ DO_TEST("kvm-pit-device", QEMU_CAPS_KVM_PIT_TICK_POLICY);
DO_TEST("panic", QEMU_CAPS_DEVICE_PANIC,
QEMU_CAPS_NODEFCONFIG);
--
2.4.11