Re: [virt-manager PATCH] cli: Add --memballoon period

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, May 27, 2019 at 11:28:06AM +0300, Athina Plaskasoviti wrote:
> XML Mapping
> 
> <memballoon model=...>
>   ...
>   <period>X</period>
> </memballoon>

This is not a correct XML, it should look like this:

<memballoon model=...>
  <stats period='10'/>
</memballoon>

> 
> Signed-off-by: Athina Plaskasoviti <athina.plaskasoviti@xxxxxxxxx>
> ---
>  tests/cli-test-xml/compare/virt-install-singleton-config-2.xml | 2 ++
>  tests/clitest.py                                               | 2 +-
>  virtinst/cli.py                                                | 1 +
>  virtinst/devices/memballoon.py                                 | 1 +
>  4 files changed, 5 insertions(+), 1 deletion(-)
> 
> 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 8f04436a..9f3b99fa 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
> @@ -189,6 +189,7 @@
>      <watchdog model="ib700" action="pause"/>
>      <memballoon model="virtio">
>        <autodeflate>on</autodeflate>
> +      <period>100s</period>

This is invalid value, it should be only number.

>      </memballoon>
>      <rng model="virtio">
>        <backend model="egd" type="udp">
> @@ -403,6 +404,7 @@
>      <watchdog model="ib700" action="pause"/>
>      <memballoon model="virtio">
>        <autodeflate>on</autodeflate>
> +      <period>100s</period>
>      </memballoon>
>      <rng model="virtio">
>        <backend model="egd" type="udp">
> diff --git a/tests/clitest.py b/tests/clitest.py
> index 9a71c9d6..73f52c44 100644
> --- a/tests/clitest.py
> +++ b/tests/clitest.py
> @@ -508,7 +508,7 @@ cache.mode=emulate,cache.level=3
>  --controller scsi,model=virtio-scsi
>  --graphics vnc
>  --filesystem /foo/source,/bar/target
> ---memballoon virtio,autodeflate=on
> +--memballoon virtio,autodeflate=on,period=100s

We could add a code which would parse the time unit in order to have
1m valid value and converted to 60, but I would say that in this case it
would not be that useful so we should accept only number.

In addition the attribute should be stats.period to reflect the XML
structure.

>  --watchdog ib700,action=pause
>  --tpm passthrough,model=tpm-crb,path=/dev/tpm0
>  --rng egd,backend_host=127.0.0.1,backend_service=8000,backend_type=udp,backend_mode=bind,backend_connect_host=foo,backend_connect_service=708,rate.bytes=1234,rate.period=1000,model=virtio
> diff --git a/virtinst/cli.py b/virtinst/cli.py
> index 715fc482..072e27a6 100644
> --- a/virtinst/cli.py
> +++ b/virtinst/cli.py
> @@ -3503,6 +3503,7 @@ class ParserMemballoon(VirtCLIParser):
>  
>          cls.add_arg("model", "model")
>          cls.add_arg("autodeflate", "autodeflate", is_onoff=True)
> +        cls.add_arg("period", "period")
>  
>  
>  ###################
> diff --git a/virtinst/devices/memballoon.py b/virtinst/devices/memballoon.py
> index 9a05b344..5b950a21 100644
> --- a/virtinst/devices/memballoon.py
> +++ b/virtinst/devices/memballoon.py
> @@ -14,6 +14,7 @@ class DeviceMemballoon(Device):
>  
>      model = XMLProperty("./@model")
>      autodeflate = XMLProperty("./autodeflate", is_onoff=True)
> +    period = XMLProperty("./period")

Here we can use is_int=True since it's a number without units.

Pavel

Attachment: signature.asc
Description: PGP signature

_______________________________________________
virt-tools-list mailing list
virt-tools-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/virt-tools-list

[Index of Archives]     [Linux Virtualization]     [KVM Development]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux