提交 786539d6 编写于 作者: L Luyao Huang 提交者: Martin Kletzander

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: NLuyao Huang <lhuang@redhat.com>
上级 774fd399
......@@ -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");
}
......
<domain type='qemu'>
<name>QEMUGuest1</name>
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
<memory unit='KiB'>219136</memory>
<currentMemory unit='KiB'>219136</currentMemory>
<vcpu placement='static'>2</vcpu>
<iothreads>4</iothreads>
<cputune>
<shares>2048</shares>
<period>1000000</period>
<quota>-1</quota>
<vcpupin vcpu='0' cpuset='0'/>
<vcpupin vcpu='1' cpuset='1'/>
<emulatorpin cpuset='1'/>
<vcpusched vcpus='0-1' scheduler='fifo' priority='0'/>
<iothreadsched iothreads='1-3' scheduler='rr' priority='0'/>
</cputune>
<os>
<type arch='i686' machine='pc'>hvm</type>
<boot dev='hd'/>
</os>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/usr/bin/qemu</emulator>
<disk type='block' device='disk'>
<source dev='/dev/HostVG/QEMUGuest1'/>
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' target='0' unit='0'/>
</disk>
<controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<controller type='pci' index='0' model='pci-root'/>
<memballoon model='virtio'/>
</devices>
</domain>
......@@ -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");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册