On 12/09/2016 09:28 AM, Maxim Nestratov wrote:
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(-)
My suggestion here - let's rename *pit-device.xml to *pit-discard.xml
and do the same for the .args file. That'll make it clearer. Of course
that means modifying argvtest.c as well.
This would alter the commit message to:
qemu: Allow to specify pit timer tick policy=discard
Separate out the "policy=discard" into it's own specific
qemu command line.
We'll rename "kvm-pit-device" test case to be
"kvm-pit-discard"
since it has the syntax we'd be using.
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 */
s/these modes/this mode/
ACK w/ these adjustments (I can do this as well if you want)
John
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);