From 786539d6bf5ff841e00c9a538fcf77c65c5c8fab Mon Sep 17 00:00:00 2001 From: Luyao Huang Date: Wed, 24 Jun 2015 12:00:36 +0800 Subject: [PATCH] conf: Format scheduler priority when it is zero https://bugzilla.redhat.com/show_bug.cgi?id=1235116 According to our XML definition, zero is as valid as any other value. Mainly because it should be kernel-agnostic. Signed-off-by: Luyao Huang --- src/conf/domain_conf.c | 6 ++- ...rgv-cputune-iothreadsched-zeropriority.xml | 38 +++++++++++++++++++ tests/qemuxml2xmltest.c | 1 + 3 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cputune-iothreadsched-zeropriority.xml diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index e9554511f9..2c3b96b0e5 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -21378,7 +21378,8 @@ virDomainDefFormatInternal(virDomainDefPtr def, ids, virProcessSchedPolicyTypeToString(sp->policy)); VIR_FREE(ids); - if (sp->priority) + if (sp->policy == VIR_PROC_POLICY_FIFO || + sp->policy == VIR_PROC_POLICY_RR) virBufferAsprintf(&childrenBuf, " priority='%d'", sp->priority); virBufferAddLit(&childrenBuf, "/>\n"); } @@ -21393,7 +21394,8 @@ virDomainDefFormatInternal(virDomainDefPtr def, ids, virProcessSchedPolicyTypeToString(sp->policy)); VIR_FREE(ids); - if (sp->priority) + if (sp->policy == VIR_PROC_POLICY_FIFO || + sp->policy == VIR_PROC_POLICY_RR) virBufferAsprintf(&childrenBuf, " priority='%d'", sp->priority); virBufferAddLit(&childrenBuf, "/>\n"); } diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cputune-iothreadsched-zeropriority.xml b/tests/qemuxml2argvdata/qemuxml2argv-cputune-iothreadsched-zeropriority.xml new file mode 100644 index 0000000000..0996723b97 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-cputune-iothreadsched-zeropriority.xml @@ -0,0 +1,38 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219136 + 219136 + 2 + 4 + + 2048 + 1000000 + -1 + + + + + + + + hvm + + + + destroy + restart + destroy + + /usr/bin/qemu + + + +
+ + + + + + + diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 711827dfe6..7a41a18704 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -492,6 +492,7 @@ mymain(void) DO_TEST("cputune"); DO_TEST("cputune-zero-shares"); DO_TEST_DIFFERENT("cputune-iothreadsched"); + DO_TEST("cputune-iothreadsched-zeropriority"); DO_TEST("cputune-numatune"); DO_TEST("vcpu-placement-static");