|
|
c401cc |
From 0b93fb79af02a3b1913266d9ced819e07fb3627b Mon Sep 17 00:00:00 2001
|
|
|
c401cc |
Message-Id: <0b93fb79af02a3b1913266d9ced819e07fb3627b@dist-git>
|
|
|
c401cc |
From: Peter Krempa <pkrempa@redhat.com>
|
|
|
c401cc |
Date: Mon, 10 Feb 2014 14:02:48 +0100
|
|
|
c401cc |
Subject: [PATCH] conf: Enforce supported options for certain timers
|
|
|
c401cc |
|
|
|
c401cc |
https://bugzilla.redhat.com/show_bug.cgi?id=1056205
|
|
|
c401cc |
|
|
|
c401cc |
According to the documentation various timer options are only supported
|
|
|
c401cc |
by certain timer types. Add a post parse check to verify that the user
|
|
|
c401cc |
didn't specify invalid options.
|
|
|
c401cc |
|
|
|
c401cc |
Also fix the qemu command line parsing function to set correct default
|
|
|
c401cc |
values for the kvmclock timer so that it passes the new check.
|
|
|
c401cc |
|
|
|
c401cc |
(cherry picked from commit 8ffaa42d7bc42f110ea9015a1c8f5528c3eb3bbf)
|
|
|
c401cc |
|
|
|
c401cc |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
c401cc |
---
|
|
|
c401cc |
src/conf/domain_conf.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++++
|
|
|
c401cc |
src/qemu/qemu_command.c | 1 +
|
|
|
c401cc |
2 files changed, 56 insertions(+)
|
|
|
c401cc |
|
|
|
c401cc |
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
|
|
|
c401cc |
index 99b505b..d6c5b3b 100644
|
|
|
c401cc |
--- a/src/conf/domain_conf.c
|
|
|
c401cc |
+++ b/src/conf/domain_conf.c
|
|
|
c401cc |
@@ -2801,6 +2801,61 @@ virDomainDefPostParseInternal(virDomainDefPtr def,
|
|
|
c401cc |
|
|
|
c401cc |
if (virDomainDefRejectDuplicateControllers(def) < 0)
|
|
|
c401cc |
return -1;
|
|
|
c401cc |
+
|
|
|
c401cc |
+ /* verify settings of guest timers */
|
|
|
c401cc |
+ for (i = 0; i < def->clock.ntimers; i++) {
|
|
|
c401cc |
+ virDomainTimerDefPtr timer = def->clock.timers[i];
|
|
|
c401cc |
+
|
|
|
c401cc |
+ if (timer->name == VIR_DOMAIN_TIMER_NAME_KVMCLOCK) {
|
|
|
c401cc |
+ if (timer->tickpolicy != -1) {
|
|
|
c401cc |
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
|
|
c401cc |
+ _("timer %s doesn't support setting of "
|
|
|
c401cc |
+ "timer tickpolicy"),
|
|
|
c401cc |
+ virDomainTimerNameTypeToString(timer->name));
|
|
|
c401cc |
+ return -1;
|
|
|
c401cc |
+ }
|
|
|
c401cc |
+ }
|
|
|
c401cc |
+
|
|
|
c401cc |
+ if (timer->tickpolicy != VIR_DOMAIN_TIMER_TICKPOLICY_CATCHUP &&
|
|
|
c401cc |
+ (timer->catchup.threshold != 0 ||
|
|
|
c401cc |
+ timer->catchup.limit != 0 ||
|
|
|
c401cc |
+ timer->catchup.slew != 0)) {
|
|
|
c401cc |
+ virReportError(VIR_ERR_XML_ERROR, "%s",
|
|
|
c401cc |
+ _("setting of timer catchup policies is only "
|
|
|
c401cc |
+ "supported with tickpolicy='catchup'"));
|
|
|
c401cc |
+ return -1;
|
|
|
c401cc |
+ }
|
|
|
c401cc |
+
|
|
|
c401cc |
+ if (timer->name != VIR_DOMAIN_TIMER_NAME_TSC) {
|
|
|
c401cc |
+ if (timer->frequency != 0) {
|
|
|
c401cc |
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
|
|
c401cc |
+ _("timer %s doesn't support setting of "
|
|
|
c401cc |
+ "timer frequency"),
|
|
|
c401cc |
+ virDomainTimerNameTypeToString(timer->name));
|
|
|
c401cc |
+ return -1;
|
|
|
c401cc |
+ }
|
|
|
c401cc |
+
|
|
|
c401cc |
+ if (timer->mode != -1) {
|
|
|
c401cc |
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
|
|
c401cc |
+ _("timer %s doesn't support setting of "
|
|
|
c401cc |
+ "timer mode"),
|
|
|
c401cc |
+ virDomainTimerNameTypeToString(timer->name));
|
|
|
c401cc |
+ return -1;
|
|
|
c401cc |
+ }
|
|
|
c401cc |
+ }
|
|
|
c401cc |
+
|
|
|
c401cc |
+ if (timer->name != VIR_DOMAIN_TIMER_NAME_PLATFORM &&
|
|
|
c401cc |
+ timer->name != VIR_DOMAIN_TIMER_NAME_RTC) {
|
|
|
c401cc |
+ if (timer->track != -1) {
|
|
|
c401cc |
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
|
|
c401cc |
+ _("timer %s doesn't support setting of "
|
|
|
c401cc |
+ "timer track"),
|
|
|
c401cc |
+ virDomainTimerNameTypeToString(timer->name));
|
|
|
c401cc |
+ return -1;
|
|
|
c401cc |
+ }
|
|
|
c401cc |
+ }
|
|
|
c401cc |
+ }
|
|
|
c401cc |
+
|
|
|
c401cc |
return 0;
|
|
|
c401cc |
}
|
|
|
c401cc |
|
|
|
c401cc |
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
|
|
|
c401cc |
index d43fdc9..a0ae10c 100644
|
|
|
c401cc |
--- a/src/qemu/qemu_command.c
|
|
|
c401cc |
+++ b/src/qemu/qemu_command.c
|
|
|
c401cc |
@@ -10630,6 +10630,7 @@ qemuParseCommandLineCPU(virDomainDefPtr dom,
|
|
|
c401cc |
dom->clock.timers[j]->present = present;
|
|
|
c401cc |
dom->clock.timers[j]->tickpolicy = -1;
|
|
|
c401cc |
dom->clock.timers[j]->track = -1;
|
|
|
c401cc |
+ dom->clock.timers[j]->mode = -1;
|
|
|
c401cc |
dom->clock.ntimers++;
|
|
|
c401cc |
} else if (dom->clock.timers[j]->present != -1 &&
|
|
|
c401cc |
dom->clock.timers[j]->present != present) {
|
|
|
c401cc |
--
|
|
|
c401cc |
1.8.5.4
|
|
|
c401cc |
|