diff --git a/tests/cli-test-xml/compare/virt-install-singleton-config-2.xml b/tests/cli-test-xml/compare/virt-install-singleton-config-2.xml index 4cdc70efd..9d5907c58 100644 --- a/tests/cli-test-xml/compare/virt-install-singleton-config-2.xml +++ b/tests/cli-test-xml/compare/virt-install-singleton-config-2.xml @@ -44,6 +44,7 @@ 9 + /virtualmachines/production @@ -258,6 +259,7 @@ 9 + /virtualmachines/production diff --git a/tests/clitest.py b/tests/clitest.py index de97ae38d..1165baedb 100644 --- a/tests/clitest.py +++ b/tests/clitest.py @@ -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 diff --git a/virtinst/cli.py b/virtinst/cli.py index 97eb4fc06..e5645d84f 100644 --- a/virtinst/cli.py +++ b/virtinst/cli.py @@ -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 # diff --git a/virtinst/domain/numatune.py b/virtinst/domain/numatune.py index 5a7d743e7..5f36fe519 100644 --- a/virtinst/domain/numatune.py +++ b/virtinst/domain/numatune.py @@ -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 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)