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

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@cn.fujitsu.com>
This commit is contained in:
Chen Hanxiao 2014-07-30 14:34:03 +08:00
parent 92de2db42b
commit cff8e32c55
5 changed files with 18 additions and 4 deletions

View File

@ -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

View File

@ -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>

View File

@ -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)

View File

@ -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)

View File

@ -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)