[virt-tools-list] [virt-manager PATCH] cli: Add --numatune memory.placement

Athina Plaskasoviti athina.plaskasoviti at gmail.com
Sun Jun 9 08:48:08 UTC 2019


XML Mapping:

<numatune>
  ...
  <memory placement=X/>
  ...
</numatune>
---
 .../cli-test-xml/compare/virt-install-singleton-config-2.xml  | 4 ++--
 tests/clitest.py                                              | 4 ++--
 virtinst/cli.py                                               | 2 ++
 virtinst/domain/numatune.py                                   | 3 ++-
 4 files changed, 8 insertions(+), 5 deletions(-)

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 c045ef52..a0d62ce1 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
@@ -43,7 +43,7 @@
   </memoryBacking>
   <vcpu>9</vcpu>
   <numatune>
-    <memory mode="strict" nodeset="1-3,4"/>
+    <memory mode="strict" nodeset="1-3,4" placement="auto"/>
   </numatune>
   <resource>
     <partition>/virtualmachines/production</partition>
@@ -260,7 +260,7 @@
   </memoryBacking>
   <vcpu>9</vcpu>
   <numatune>
-    <memory mode="strict" nodeset="1-3,4"/>
+    <memory mode="strict" nodeset="1-3,4" placement="auto"/>
   </numatune>
   <resource>
     <partition>/virtualmachines/production</partition>
diff --git a/tests/clitest.py b/tests/clitest.py
index 01f76b8a..b907a5bb 100644
--- a/tests/clitest.py
+++ b/tests/clitest.py
@@ -489,7 +489,7 @@ cache.mode=emulate,cache.level=3
 --boot cdrom,fd,hd,network,menu=off,loader=/foo/bar,emulator=/new/emu,bootloader=/new/bootld,rebootTimeout=3,initargs="foo=bar baz=woo"
 --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
---numatune 1-3,4,mode=strict
+--numatune 1-3,4,mode=strict,placement=auto
 --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
@@ -1033,7 +1033,7 @@ c.add_compare("--qemu-commandline='-foo bar,baz=\"wib wob\"'", "edit-simple-qemu
 c.add_compare("--memory 500,maxmemory=1000,hugepages=off", "edit-simple-memory")
 c.add_compare("--vcpus 10,maxvcpus=20,cores=5,sockets=4,threads=1", "edit-simple-vcpus")
 c.add_compare("--cpu model=pentium2,+x2apic,forbid=pbe", "edit-simple-cpu")
-c.add_compare("--numatune memory.nodeset=1-5,7,memory.mode=strict", "edit-simple-numatune")
+c.add_compare("--numatune memory.nodeset=1-5,7,memory.mode=strict,memory.placement=auto", "edit-simple-numatune")
 c.add_compare("--blkiotune weight=500,device_path=/dev/sdf,device_weight=600", "edit-simple-blkiotune")
 c.add_compare("--idmap uid_start=0,uid_target=2000,uid_count=30,gid_start=0,gid_target=3000,gid_count=40", "edit-simple-idmap")
 c.add_compare("--boot loader=foo.bar,useserial=on,init=/bin/bash,nvram=/test/nvram.img,os_type=hvm,domain_type=test,loader.readonly=on,loader.secure=no,machine=", "edit-simple-boot")
diff --git a/virtinst/cli.py b/virtinst/cli.py
index 7ba6b211..9ec3b57e 100644
--- a/virtinst/cli.py
+++ b/virtinst/cli.py
@@ -1698,6 +1698,7 @@ class ParserNumatune(VirtCLIParser):
     aliases = {
         "memory.mode": "mode",
         "memory.nodeset": "nodeset",
+        "memory.placement": "placement",
     }
 
     @classmethod
@@ -1705,6 +1706,7 @@ class ParserNumatune(VirtCLIParser):
         VirtCLIParser._init_class(**kwargs)
         cls.add_arg("memory.nodeset", "memory_nodeset", can_comma=True)
         cls.add_arg("memory.mode", "memory_mode")
+        cls.add_arg("memory.placement", "memory_placement")
 
 
 ####################
diff --git a/virtinst/domain/numatune.py b/virtinst/domain/numatune.py
index 33f66f35..5a7d743e 100644
--- a/virtinst/domain/numatune.py
+++ b/virtinst/domain/numatune.py
@@ -12,7 +12,8 @@ class DomainNumatune(XMLBuilder):
     Class for generating <numatune> XML
     """
     XML_NAME = "numatune"
-    _XML_PROP_ORDER = ["memory_mode", "memory_nodeset"]
+    _XML_PROP_ORDER = ["memory_mode", "memory_nodeset", "memory_placement"]
 
     memory_nodeset = XMLProperty("./memory/@nodeset")
     memory_mode = XMLProperty("./memory/@mode")
+    memory_placement = XMLProperty("./memory/@placement")
-- 
2.20.1




More information about the virt-tools-list mailing list