cli: Add --cputune cachetune options

- cachetune[0-9]*.vcpus
- cachetune[0-9]*.cache[0-9]*.level
- cachetune[0-9]*.cache[0-9]*.id
- cachetune[0-9]*.cache[0-9]*.type
- cachetune[0-9]*.cache[0-9]*.size
- cachetune[0-9]*.cache[0-9]*.unit

XML Mapping:

<domain>
...
  <cputune>
  ...
    <cachetune vcpus="X">
      <cache level="X" id="X" type="X" size="X" unit="X"/>
    </cachetune>
  ...
  </cputune>
...
</domain>

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Athina Plaskasoviti <athina.plaskasoviti@gmail.com>
This commit is contained in:
Athina Plaskasoviti 2019-08-09 12:14:05 +03:00 committed by Cole Robinson
parent 3d5a72e18a
commit 9cea262b85
4 changed files with 62 additions and 1 deletions

View File

@ -224,6 +224,9 @@
<on_lockfailure>ignore</on_lockfailure>
<cputune>
<vcpupin vcpu="0" cpuset="0-3"/>
<cachetune vcpus="0-3">
<cache level="3" id="0" type="both" size="3" unit="MiB"/>
</cachetune>
</cputune>
</domain>
<domain type="kvm">
@ -455,5 +458,8 @@
<on_lockfailure>ignore</on_lockfailure>
<cputune>
<vcpupin vcpu="0" cpuset="0-3"/>
<cachetune vcpus="0-3">
<cache level="3" id="0" type="both" size="3" unit="MiB"/>
</cachetune>
</cputune>
</domain>

View File

@ -505,7 +505,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
--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
--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

@ -2084,6 +2084,21 @@ class ParserCputune(VirtCLIParser):
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"
cb = self._make_find_inst_cb(cliarg, list_propname)
return cb(*args, **kwargs)
def cache_find_inst_cb(self, inst, *args, **kwargs):
cachetune = self.cachetune_find_inst_cb(inst, *args, **kwargs)
inst = cachetune
cliarg = "cache" # cachetune[0-9]*.cache[0-9]*
list_propname = "caches" # cachetune.caches
cb = self._make_find_inst_cb(cliarg, list_propname)
return cb(inst, *args, **kwargs)
@classmethod
def _init_class(cls, **kwargs):
VirtCLIParser._init_class(**kwargs)
@ -2092,6 +2107,18 @@ 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("cachetune[0-9]*.vcpus", "vcpus",
find_inst_cb=cls.cachetune_find_inst_cb)
cls.add_arg("cachetune[0-9]*.cache[0-9]*.level", "level",
find_inst_cb=cls.cache_find_inst_cb)
cls.add_arg("cachetune[0-9]*.cache[0-9]*.id", "id",
find_inst_cb=cls.cache_find_inst_cb)
cls.add_arg("cachetune[0-9]*.cache[0-9]*.type", "type",
find_inst_cb=cls.cache_find_inst_cb)
cls.add_arg("cachetune[0-9]*.cache[0-9]*.size", "size",
find_inst_cb=cls.cache_find_inst_cb)
cls.add_arg("cachetune[0-9]*.cache[0-9]*.unit", "unit",
find_inst_cb=cls.cache_find_inst_cb)
#######################

View File

@ -17,9 +17,37 @@ class _VCPUPin(XMLBuilder):
cpuset = XMLProperty("./@cpuset")
class _CacheCPU(XMLBuilder):
"""
Class for generating <cachetune> child <cache> XML
"""
XML_NAME = "cache"
_XML_PROP_ORDER = ["level", "id", "type", "size", "unit"]
level = XMLProperty("./@level", is_int=True)
id = XMLProperty("./@id", is_int=True)
type = XMLProperty("./@type")
size = XMLProperty("./@size", is_int=True)
unit = XMLProperty("./@unit")
class _CacheTuneCPU(XMLBuilder):
"""
Class for generating <cputune> child <cachetune> XML
"""
XML_NAME = "cachetune"
_XML_PROP_ORDER = ["vcpus", "caches"]
vcpus = XMLProperty("./@vcpus")
caches = XMLChildProperty(_CacheCPU)
class DomainCputune(XMLBuilder):
"""
Class for generating <cpu> XML
"""
XML_NAME = "cputune"
_XML_PROP_ORDER = ["vcpus", "cachetune"]
vcpus = XMLChildProperty(_VCPUPin)
cachetune = XMLChildProperty(_CacheTuneCPU)