Michal Privoznik wrote:
On 30.08.2013 23:46, Jim Fehlig wrote:
> Detecting whether or not to autoballoon is configuration related,
> so move the code to libxl_conf.
>
> Signed-off-by: Jim Fehlig <jfehlig(a)suse.com>
> ---
> src/libxl/libxl_conf.c | 22 ++++++++++++++++++++++
> src/libxl/libxl_conf.h | 3 +++
> src/libxl/libxl_driver.c | 25 +------------------------
> 3 files changed, 26 insertions(+), 24 deletions(-)
>
> diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
> index 8129c7f..f8937a4 100644
> --- a/src/libxl/libxl_conf.c
> +++ b/src/libxl/libxl_conf.c
> @@ -978,6 +978,28 @@ error:
> return -1;
> }
>
> +bool
> +libxlGetAutoballoonConf(libxlDriverPrivatePtr driver)
> +{
> + const libxl_version_info *info;
> + regex_t regex;
> + int ret;
> +
> + info = libxl_get_version_info(driver->ctx);
> + if (!info)
> + return true; /* default to on */
> +
> + ret = regcomp(®ex,
> + "(^| )dom0_mem=((|min:|max:)[0-9]+[bBkKmMgG]?,?)+($| )",
> + REG_NOSUB | REG_EXTENDED);
> + if (ret)
> + return true;
>
Pre-existing, but if we fail to compile the regex, shouldn't we error out?
I think so, especially since patch 7 makes similar changes, e.g. bailing
out on libxl_get_version_info() failures.
I'll send a separate patch to fix this pre-existing issue.
Regards,
Jim