tools/xl: fix autoballoon regex
authorDmitry Isaykin <isaikin-dmitry@yandex.ru>
Fri, 1 Oct 2021 12:24:16 +0000 (15:24 +0300)
committerIan Jackson <iwj@xenproject.org>
Tue, 12 Oct 2021 13:40:14 +0000 (14:40 +0100)
commit2faeb4213d9b412836fe80e5685bfcccc51feb92
tree35472a2f5f7661eed05bc1d23ba5c5fcd113a2f5
parentd3b05f9b16d6ba9c550c3a35ac11ed292bf87f68
tools/xl: fix autoballoon regex

This regex is used for auto-balloon mode detection based on Xen command line.

The case of specifying a negative size was handled incorrectly.
>From misc/xen-command-line documentation:

    dom0_mem (x86)
    = List of ( min:<sz> | max:<sz> | <sz> )

    If a size is positive, it represents an absolute value.
    If a size is negative, it is subtracted from the total available memory.

Also add support for [tT] granularity suffix.
Also add support for memory fractions (i.e. '50%' or '1G+25%').

Signed-off-by: Dmitry Isaykin <isaikin-dmitry@yandex.ru>
Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
tools/xl/xl.c