cli: --cputune: add vcpusched[0-9]* config

This adds the following suboptions to configure <cputune>:

- vcpusched.vcpus
- vcpusched.scheduler
- vcpusched.priority

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
This commit is contained in:
Jonathan Schwender 2021-02-13 13:47:09 +01:00 committed by Cole Robinson
parent d304a9b205
commit f9a0c3ccb2
4 changed files with 29 additions and 2 deletions

View File

@ -237,6 +237,7 @@
<memorytune vcpus="0-3">
<node id="0" bandwidth="60"/>
</memorytune>
<vcpusched vcpus="0-3,^2" scheduler="fifo" priority="95"/>
</cputune>
</domain>
<domain type="kvm">
@ -481,5 +482,6 @@
<memorytune vcpus="0-3">
<node id="0" bandwidth="60"/>
</memorytune>
<vcpusched vcpus="0-3,^2" scheduler="fifo" priority="95"/>
</cputune>
</domain>

View File

@ -514,7 +514,7 @@ cell0.distances.sibling1.id=1,cell0.distances.sibling1.value=21,\
numa.cell1.distances.sibling0.id=0,numa.cell1.distances.sibling0.value=21,\
cell1.distances.sibling1.id=1,cell1.distances.sibling1.value=10,\
cache.mode=emulate,cache.level=3
--cputune vcpupin0.vcpu=0,vcpupin0.cpuset=0-3,cachetune0.vcpus=0-3,cachetune0.cache0.level=3,cachetune0.cache0.id=0,cachetune0.cache0.type=both,cachetune0.cache0.size=3,cachetune0.cache0.unit=MiB,memorytune0.vcpus=0-3,memorytune0.node0.id=0,memorytune0.node0.bandwidth=60
--cputune vcpupin0.vcpu=0,vcpupin0.cpuset=0-3,cachetune0.vcpus=0-3,cachetune0.cache0.level=3,cachetune0.cache0.id=0,cachetune0.cache0.type=both,cachetune0.cache0.size=3,cachetune0.cache0.unit=MiB,memorytune0.vcpus=0-3,memorytune0.node0.id=0,memorytune0.node0.bandwidth=60,vcpusched0.vcpus=0-3,^2,vcpusched0.scheduler=fifo,vcpusched0.priority=95
--iothreads iothreads=2,iothreadids.iothread1.id=1,iothreadids.iothread2.id=2
--metadata title=my-title,description=my-description,uuid=00000000-1111-2222-3333-444444444444,genid=e9392370-2917-565e-692b-d057f46512d6
--boot cdrom,fd,hd,network,menu=off,loader=/foo/bar,emulator=/new/emu,bootloader=/new/bootld,rebootTimeout=3,initargs="foo=bar baz=woo",initdir=/my/custom/cwd,inituser=tester,initgroup=1000,firmware=efi

View File

@ -2350,6 +2350,12 @@ class ParserCputune(VirtCLIParser):
cb = self._make_find_inst_cb(cliarg, list_propname)
return cb(*args, **kwargs)
def vcpusched_find_inst_cb(self, *args, **kwargs):
cliarg = "vcpusched" # vcpusched[0-9]*
list_propname = "vcpusched"
cb = self._make_find_inst_cb(cliarg, list_propname)
return cb(*args, **kwargs)
def cachetune_find_inst_cb(self, *args, **kwargs):
cliarg = "cachetune" # cachetune[0-9]*
list_propname = "cachetune"
@ -2388,6 +2394,12 @@ class ParserCputune(VirtCLIParser):
find_inst_cb=cls.vcpu_find_inst_cb)
cls.add_arg("vcpupin[0-9]*.cpuset", "cpuset", can_comma=True,
find_inst_cb=cls.vcpu_find_inst_cb)
cls.add_arg("vcpusched[0-9]*.vcpus", "vcpus", can_comma=True,
find_inst_cb=cls.vcpusched_find_inst_cb)
cls.add_arg("vcpusched[0-9]*.scheduler", "scheduler",
find_inst_cb=cls.vcpusched_find_inst_cb)
cls.add_arg("vcpusched[0-9]*.priority", "priority",
find_inst_cb=cls.vcpusched_find_inst_cb)
cls.add_arg("cachetune[0-9]*.vcpus", "vcpus",
find_inst_cb=cls.cachetune_find_inst_cb)
cls.add_arg("cachetune[0-9]*.cache[0-9]*.level", "level",

View File

@ -63,13 +63,26 @@ class _MemoryTuneCPU(XMLBuilder):
nodes = XMLChildProperty(_NodeCPU)
class _VCPUSched(XMLBuilder):
"""
Class for generating <cputune> child <vcpusched> XML
"""
XML_NAME = "vcpusched"
_XML_PROP_ORDER = ["vcpus", "scheduler", "priority"]
vcpus = XMLProperty("./@vcpus")
scheduler = XMLProperty("./@scheduler")
priority = XMLProperty("./@priority", is_int=True)
class DomainCputune(XMLBuilder):
"""
Class for generating <cpu> XML
"""
XML_NAME = "cputune"
_XML_PROP_ORDER = ["vcpus", "cachetune", "memorytune"]
_XML_PROP_ORDER = ["vcpus", "cachetune", "memorytune", "vcpusched"]
vcpus = XMLChildProperty(_VCPUPin)
cachetune = XMLChildProperty(_CacheTuneCPU)
memorytune = XMLChildProperty(_MemoryTuneCPU)
vcpusched = XMLChildProperty(_VCPUSched)