aboutsummaryrefslogtreecommitdiffstats
path: root/tools/libxl
diff options
context:
space:
mode:
authorDario Faggioli <dario.faggioli@citrix.com>2012-06-21 13:43:18 +0100
committerDario Faggioli <dario.faggioli@citrix.com>2012-06-21 13:43:18 +0100
commitb1a4a51944c6acec9878fdfbee1b9432477af862 (patch)
treefa713fc40029e9713914a1ecf3dfd02a0cb9ba27 /tools/libxl
parent70622118ee7bb925205c5d8c1e7bec82fc257351 (diff)
downloadxen-b1a4a51944c6acec9878fdfbee1b9432477af862.tar.gz
xen-b1a4a51944c6acec9878fdfbee1b9432477af862.tar.bz2
xen-b1a4a51944c6acec9878fdfbee1b9432477af862.zip
xl: fix sedf parameters checking
25468:9d1fd58ff602 was bogus in not letting a new domain being created if its scheduling parameters --when running under the sedf scheduler-- were not fully specified, making creation fail like in this example here below: 2012-06-16 07:37:47 Z executing ssh ... root@10.80.248.105 xl create /etc/xen/debian.guest.osstest.cfg libxl: error: libxl.c:3619:sched_sedf_domain_set: setting domain sched sedf: Invalid argument libxl: error: libxl_create.c:710:domcreate_bootloader_done: cannot (re-)build domain: -3 Parsing config from /etc/xen/debian.guest.osstest.cfg This is due to the fact the values for period, slice, weight and extratime should be consistent among each others, and if not all are explicitly specified, someone has to make that happen. That was right the purpose of the change in question, but it was failing at achieving so. This commit fixes things by forcing unspecified parameters to sensible values, depending on the ones the user provided. Signed-off-by: Dario Faggioli <dario.faggioli@citix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
Diffstat (limited to 'tools/libxl')
-rw-r--r--tools/libxl/xl_cmdimpl.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
index 3ea95ef426..63dc564cb2 100644
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -555,6 +555,8 @@ static int sched_params_valid(libxl_domain_sched_params *scp)
int has_weight = scp->weight != LIBXL_DOMAIN_SCHED_PARAM_WEIGHT_DEFAULT;
int has_period = scp->period != LIBXL_DOMAIN_SCHED_PARAM_PERIOD_DEFAULT;
int has_slice = scp->slice != LIBXL_DOMAIN_SCHED_PARAM_SLICE_DEFAULT;
+ int has_extratime =
+ scp->extratime != LIBXL_DOMAIN_SCHED_PARAM_EXTRATIME_DEFAULT;
libxl_domain_sched_params sci;
libxl_domain_sched_params_get(ctx, domid, &sci);
@@ -563,12 +565,27 @@ static int sched_params_valid(libxl_domain_sched_params *scp)
if (sci.sched == LIBXL_SCHEDULER_SEDF) {
if (has_weight && (has_period || has_slice))
return 0;
+ if (has_period != has_slice)
+ return 0;
+ /*
+ * Idea is, if we specify a weight, then both period and
+ * slice has to be zero. OTOH, if we do not specify a weight,
+ * that means we want a pure best effort domain or an actual
+ * real-time one. In the former case, it is period that needs
+ * to be zero, in the latter, weight should be.
+ */
if (has_weight) {
scp->slice = 0;
scp->period = 0;
}
- if (has_period || has_slice)
+ else if (!has_period) {
+ /* We can setup a proper best effort domain (extra time only)
+ * iff we either already have or are asking for some extra time. */
+ scp->weight = has_extratime ? scp->extratime : sci.extratime;
+ scp->period = 0;
+ }
+ if (has_period && has_slice)
scp->weight = 0;
}