cli: Add --numatune options memnode[0-9]*.cellid, memnode[0-9]*.mode, memnode[0-9]*.nodeset

XML Mapping:

<numatune>
...
  <memnode cellid="X" mode="X" nodeset="X"/>
...
</numatune>

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Athina Plaskasoviti <athina.plaskasoviti@gmail.com>
This commit is contained in:
Athina Plaskasoviti 2019-06-17 22:32:54 +03:00 committed by Cole Robinson
parent eda3c22458
commit b6563b90e5
4 changed files with 30 additions and 3 deletions

View File

@ -44,6 +44,7 @@
<vcpu>9</vcpu>
<numatune>
<memory mode="strict" nodeset="1-3,4"/>
<memnode cellid="1" mode="strict" nodeset="2"/>
</numatune>
<resource>
<partition>/virtualmachines/production</partition>
@ -258,6 +259,7 @@
<vcpu>9</vcpu>
<numatune>
<memory mode="strict" nodeset="1-3,4"/>
<memnode cellid="1" mode="strict" nodeset="2"/>
</numatune>
<resource>
<partition>/virtualmachines/production</partition>

View File

@ -517,7 +517,8 @@ cache.mode=emulate,cache.level=3
--idmap uid_start=0,uid_target=1000,uid_count=10,gid_start=0,gid_target=1000,gid_count=10
--seclabel type=static,label='system_u:object_r:svirt_image_t:s0:c100,c200',relabel=yes,baselabel=baselabel
--seclabel type=dynamic,label=012:345
--numatune 1-3,4,mode=strict
--numatune 1-3,4,mode=strict,\
memnode0.cellid=1,memnode0.mode=strict,memnode0.nodeset=2
--memtune hard_limit=10,soft_limit=20,swap_hard_limit=30,min_guarantee=40
--blkiotune weight=100,device_path=/home/test/1.img,device_weight=200
--memorybacking size=1,unit='G',nodeset=0,1,nosharepages=yes,locked=yes,discard=yes,allocation.mode=immediate,access_mode=shared,source_type=file,hugepages.page.size=12,hugepages.page1.size=1234,hugepages.page1.unit=MB,hugepages.page1.nodeset=2

View File

@ -1747,6 +1747,12 @@ class ParserNumatune(VirtCLIParser):
"memory.nodeset": "nodeset",
}
def memnode_find_inst_cb(self, *args, **kwargs):
cliarg = "memnode" # memnode[0-9]*
list_propname = "memnode"
cb = self._make_find_inst_cb(cliarg, list_propname)
return cb(*args, **kwargs)
@classmethod
def _init_class(cls, **kwargs):
VirtCLIParser._init_class(**kwargs)
@ -1754,6 +1760,13 @@ class ParserNumatune(VirtCLIParser):
cls.add_arg("memory.mode", "memory_mode")
cls.add_arg("memory.placement", "memory_placement")
cls.add_arg("memnode[0-9]*.cellid", "cellid", can_comma=True,
find_inst_cb=cls.memnode_find_inst_cb)
cls.add_arg("memnode[0-9]*.mode", "mode",
find_inst_cb=cls.memnode_find_inst_cb)
cls.add_arg("memnode[0-9]*.nodeset", "nodeset", can_comma=True,
find_inst_cb=cls.memnode_find_inst_cb)
####################
# --memory parsing #

View File

@ -4,7 +4,17 @@
# This work is licensed under the GNU GPLv2 or later.
# See the COPYING file in the top-level directory.
from ..xmlbuilder import XMLBuilder, XMLProperty
from ..xmlbuilder import XMLBuilder, XMLProperty, XMLChildProperty
class _Numatune(XMLBuilder):
XML_NAME = "memnode"
_XML_PROP_ORDER = ["cellid", "mode", "nodeset"]
cellid = XMLProperty("./@cellid", is_int=True)
mode = XMLProperty("./@mode")
nodeset = XMLProperty("./@nodeset")
class DomainNumatune(XMLBuilder):
@ -12,8 +22,9 @@ class DomainNumatune(XMLBuilder):
Class for generating <numatune> XML
"""
XML_NAME = "numatune"
_XML_PROP_ORDER = ["memory_mode", "memory_nodeset", "memory_placement"]
_XML_PROP_ORDER = ["memory_mode", "memory_nodeset", "memory_placement", "memnode"]
memory_nodeset = XMLProperty("./memory/@nodeset")
memory_mode = XMLProperty("./memory/@mode")
memory_placement = XMLProperty("./memory/@placement")
memnode = XMLChildProperty(_Numatune)