[virt-tools-list] [virt-manager PATCH 2/2] test: add test cases for --memtune option

Chen Hanxiao chenhanxiao at cn.fujitsu.com
Mon Feb 24 07:28:07 UTC 2014


Add test cases for --memtune option.
Also update man page.

Signed-off-by: Chen Hanxiao <chenhanxiao at cn.fujitsu.com>
---
 man/virt-install.pod                    | 9 +++++++++
 tests/clitest.py                        | 1 +
 tests/xmlparse-xml/change-guest-out.xml | 6 ++++++
 tests/xmlparse.py                       | 6 ++++++
 4 files changed, 22 insertions(+)

diff --git a/man/virt-install.pod b/man/virt-install.pod
index 119b515..3ccfa41 100644
--- a/man/virt-install.pod
+++ b/man/virt-install.pod
@@ -151,6 +151,15 @@ mode.
 
 Use --numatune=? to see a list of all available sub options. Complete details at L<http://libvirt.org/formatdomain.html#elementsNUMATuning>
 
+=item --memtune=SOFT_LIMIT,[hard_limit=HARD_LIMIT,swap_hard_limit=SW_HARD_LIMIT,min_guarantee=MIN_GUARANTEE]
+
+Tune memory policy for the domain process. Example invocations
+
+    --memtune 1000
+    --memtune hard_limit=100,soft_limit=60,swap_hard_limit=150,min_guarantee=80
+
+Use --memtune=? to see a list of all available sub options. Complete details at L<http://libvirt.org/formatdomain.html#elementsMemoryTuning>
+
 =item --blkiotune=WEIGHT,[device_path=DEVICE_PATH,device_weight=DEVICE_WEIGHT]
 
 Tune blkio policy for the domain process. Example invocations
diff --git a/tests/clitest.py b/tests/clitest.py
index dd94bd3..585ef0b 100644
--- a/tests/clitest.py
+++ b/tests/clitest.py
@@ -464,6 +464,7 @@ c.add_valid("--cpu foobar,+x2apic,+x2apicagain,-distest,forbid=foo,forbid=bar,di
 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("--idmap uid_start=0,uid_target=1000,uid_count=10,gid_start=0,gid_target=1000,gid_count=10")  # --idmap
 c.add_compare("--connect %(DEFAULTURI)s --cpuset auto --vcpus 2", "cpuset-auto")  # --cpuset=auto actually works
 c.add_invalid("--vcpus 32 --cpuset=969-1000")  # Bogus cpuset
diff --git a/tests/xmlparse-xml/change-guest-out.xml b/tests/xmlparse-xml/change-guest-out.xml
index 2996ba3..43e58eb 100644
--- a/tests/xmlparse-xml/change-guest-out.xml
+++ b/tests/xmlparse-xml/change-guest-out.xml
@@ -81,6 +81,12 @@
   <memoryBacking>
     <hugepages/>
   </memoryBacking>
+  <memtune>
+    <hard_limit>2048</hard_limit>
+    <soft_limit>200</soft_limit>
+    <swap_hard_limit>400</swap_hard_limit>
+    <min_guarantee>500</min_guarantee>
+  </memtune>
   <blkiotune>
     <weight>200</weight>
     <device>
diff --git a/tests/xmlparse.py b/tests/xmlparse.py
index dcd6865..a2448d2 100644
--- a/tests/xmlparse.py
+++ b/tests/xmlparse.py
@@ -191,6 +191,12 @@ class XMLParseTest(unittest.TestCase):
         check("memory_mode", "interleave", "strict", None)
         check("memory_nodeset", "1-5,^3,7", "2,4,6")
 
+        check = self._make_checker(guest.memtune)
+        check("hard_limit", None, 1024, 2048)
+        check("soft_limit", None, 100, 200)
+        check("swap_hard_limit", None, 300, 400)
+        check("min_guarantee", None, 400, 500)
+
         check = self._make_checker(guest.blkiotune)
         check("weight", None, 100, 200)
         check("device_weight", None, 300)
-- 
1.8.5.3




More information about the virt-tools-list mailing list