[virt-tools-list] [virt-manager PATCH] virt-install: support setting hugepages/page/[@size, @unit, @nodeset] for memorybacking

Chen Hanxiao chenhanxiao at cn.fujitsu.com
Wed Jul 30 06:31:11 UTC 2014


libvirt commit
136ad49740f017aabcac48d02d2df6ab7b0195e9
introduce ./hugepages/page/[@size, @unit, @nodeset]
for memory backing.
This patch will add support in virt-install.

Signed-off-by: Chen Hanxiao <chenhanxiao at cn.fujitsu.com>
---
 tests/clitest.py                        |  2 +-
 tests/xmlparse-xml/change-guest-out.xml |  4 +++-
 tests/xmlparse.py                       |  3 +++
 virtinst/cli.py                         | 10 ++++++++--
 virtinst/domainmemorybacking.py         |  3 +++
 5 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/tests/clitest.py b/tests/clitest.py
index bb605a5..d3134e4 100644
--- a/tests/clitest.py
+++ b/tests/clitest.py
@@ -470,7 +470,7 @@ c.add_valid("--numatune 1,2,3,5-7,^6")  # Simple --numatune
 c.add_valid("--numatune 1-3,4,mode=strict")  # More complex, parser should do the right thing here
 c.add_valid("--blkiotune weight=100,device_path=/home/test/1.img,device_weight=200")  # --blkiotune
 c.add_valid("--memtune hard_limit=10,soft_limit=20,swap_hard_limit=30,min_guarantee=40")  # --memtune
-c.add_valid("--memorybacking hugepages=yes,nosharepages=yes,locked=yes")  # --memorybacking nosharepages,locked
+c.add_valid("--memorybacking size=1,unit='G',nodeset='1,2-5',nosharepages=yes,locked=yes")  # --memorybacking hugepages/page/[@size, @unit, @nodeset] nosharepages,locked
 c.add_valid("--idmap uid_start=0,uid_target=1000,uid_count=10,gid_start=0,gid_target=1000,gid_count=10")  # --idmap
 c.add_valid("--resource partition=/virtualmachines/production")  # --resource
 c.add_compare("--connect %(DEFAULTURI)s --cpuset auto --vcpus 2", "cpuset-auto")  # --cpuset=auto actually works
diff --git a/tests/xmlparse-xml/change-guest-out.xml b/tests/xmlparse-xml/change-guest-out.xml
index c7abcc9..6fc3038 100644
--- a/tests/xmlparse-xml/change-guest-out.xml
+++ b/tests/xmlparse-xml/change-guest-out.xml
@@ -95,7 +95,9 @@
     <min_guarantee>500</min_guarantee>
   </memtune>
   <memoryBacking>
-    <hugepages/>
+    <hugepages>
+      <page size="1" unit="G" nodeset="1,5-8"/>
+    </hugepages>
     <nosharepages/>
     <locked/>
   </memoryBacking>
diff --git a/tests/xmlparse.py b/tests/xmlparse.py
index f16295e..2320325 100644
--- a/tests/xmlparse.py
+++ b/tests/xmlparse.py
@@ -221,6 +221,9 @@ class XMLParseTest(unittest.TestCase):
 
         check = self._make_checker(guest.memoryBacking)
         check("hugepages", False, True)
+        check("page_size", None, 1)
+        check("page_unit", None, 'G')
+        check("page_nodeset", None, '1,5-8')
         check("nosharepages", False, True)
         check("locked", False, True)
 
diff --git a/virtinst/cli.py b/virtinst/cli.py
index 22b5284..16986ca 100644
--- a/virtinst/cli.py
+++ b/virtinst/cli.py
@@ -2082,8 +2082,14 @@ class ParserMemorybacking(VirtCLIParser):
     def _init_params(self):
         self.clear_attr = "memoryBacking"
 
-        self.set_param("memoryBacking.hugepages", "hugepages", is_onoff=True)
-        self.set_param("memoryBacking.nosharepages", "nosharepages", is_onoff=True)
+        self.set_param("memoryBacking.hugepages",
+                "hugepages", is_onoff=True)
+        self.set_param("memoryBacking.page_size", "size")
+        self.set_param("memoryBacking.page_unit", "unit")
+        self.set_param("memoryBacking.page_nodeset",
+                "nodeset", can_comma=True)
+        self.set_param("memoryBacking.nosharepages",
+                "nosharepages", is_onoff=True)
         self.set_param("memoryBacking.locked", "locked", is_onoff=True)
 
 
diff --git a/virtinst/domainmemorybacking.py b/virtinst/domainmemorybacking.py
index 1ab1932..4dc73a2 100644
--- a/virtinst/domainmemorybacking.py
+++ b/virtinst/domainmemorybacking.py
@@ -29,5 +29,8 @@ class DomainMemorybacking(XMLBuilder):
     _XML_PROP_ORDER = ["hugepages", "nosharepages", "locked"]
 
     hugepages = XMLProperty("./hugepages", is_bool=True)
+    page_size = XMLProperty("./hugepages/page/@size")
+    page_unit = XMLProperty("./hugepages/page/@unit")
+    page_nodeset = XMLProperty("./hugepages/page/@nodeset")
     nosharepages = XMLProperty("./nosharepages", is_bool=True)
     locked = XMLProperty("./locked", is_bool=True)
-- 
1.9.0




More information about the virt-tools-list mailing list