[virt-tools-list] [virt-manager PATCH] virt-install: add more parameters for memoryBacking

Cole Robinson crobinso at redhat.com
Fri Mar 14 12:40:50 UTC 2014


On 03/14/2014 06:45 AM, Chen Hanxiao wrote:
> Add support for parameters nosharepages and locked
> if using option --memory.
> 
> Signed-off-by: Chen Hanxiao <chenhanxiao at cn.fujitsu.com>
> ---
>  tests/clitest.py                        | 1 +
>  tests/xmlparse-xml/change-guest-out.xml | 2 ++
>  tests/xmlparse.py                       | 2 ++
>  virtinst/cli.py                         | 2 ++
>  virtinst/guest.py                       | 2 ++
>  5 files changed, 9 insertions(+)
> 
> diff --git a/tests/clitest.py b/tests/clitest.py
> index 6ba9a48..e36122c 100644
> --- a/tests/clitest.py
> +++ b/tests/clitest.py
> @@ -470,6 +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("--memory 500,maxmemory=1000,hugepages=off,nosharepages=yes,locked=yes")  # --memory 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_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 43e58eb..5b1a12b 100644
> --- a/tests/xmlparse-xml/change-guest-out.xml
> +++ b/tests/xmlparse-xml/change-guest-out.xml
> @@ -80,6 +80,8 @@
>    <description>Hey desc changed&</description>
>    <memoryBacking>
>      <hugepages/>
> +    <nosharepages/>
> +    <locked/>
>    </memoryBacking>
>    <memtune>
>      <hard_limit>2048</hard_limit>
> diff --git a/tests/xmlparse.py b/tests/xmlparse.py
> index 8f592b6..13edff1 100644
> --- a/tests/xmlparse.py
> +++ b/tests/xmlparse.py
> @@ -115,6 +115,8 @@ class XMLParseTest(unittest.TestCase):
>                        "11111111-2222-3333-4444-555555555555")
>          check("emulator", "/usr/lib/xen/bin/qemu-dm", "/usr/binnnn/fooemu")
>          check("hugepage", False, True)
> +        check("nosharepages", False, True)
> +        check("locked", False, True)
>          check("type", "kvm", "test")
>          check("bootloader", None, "pygrub")
>          check("on_poweroff", "destroy", "restart")
> diff --git a/virtinst/cli.py b/virtinst/cli.py
> index 41d6a8c..efed4e3 100644
> --- a/virtinst/cli.py
> +++ b/virtinst/cli.py
> @@ -1248,6 +1248,8 @@ class ParserMemory(VirtCLIParser):
>          self.set_param("memory", "memory", setter_cb=set_memory_cb)
>          self.set_param("maxmemory", "maxmemory", setter_cb=set_memory_cb)
>          self.set_param("hugepage", "hugepages", is_onoff=True)
> +        self.set_param("nosharepages", "nosharepages", is_onoff=True)
> +        self.set_param("locked", "locked", is_onoff=True)
>  
>  
>  #####################
> diff --git a/virtinst/guest.py b/virtinst/guest.py
> index c7af16f..9986865 100644
> --- a/virtinst/guest.py
> +++ b/virtinst/guest.py
> @@ -175,6 +175,8 @@ class Guest(XMLBuilder):
>      id = XMLProperty("./@id", is_int=True)
>      type = XMLProperty("./@type", default_cb=lambda s: "xen")
>      hugepage = XMLProperty("./memoryBacking/hugepages", is_bool=True)
> +    nosharepages = XMLProperty("./memoryBacking/nosharepages", is_bool=True)
> +    locked = XMLProperty("./memoryBacking/locked", is_bool=True)
>      bootloader = XMLProperty("./bootloader")
>      description = XMLProperty("./description")
>      title = XMLProperty("./title")
> 

ACK

- Cole




More information about the virt-tools-list mailing list