]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
libxl: honor autoballoon setting in libxl.conf
authorJim Fehlig <jfehlig@suse.com>
Mon, 30 Jan 2017 18:43:15 +0000 (11:43 -0700)
committerJim Fehlig <jfehlig@suse.com>
Wed, 8 Feb 2017 16:10:49 +0000 (09:10 -0700)
libxlGetAutoballoonConf is supposed to honor user-specified
autoballoon setting in libxl.conf. As written, the user-specified
setting could be overwritten by the subsequent logic to check
dom0_mem parameter. If user-specified setting is present and
correct, accept it. Only fallback to checking Xen dom0_mem
command line parameter if user-specfied setting is not present.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
src/libxl/libxl_conf.c

index b5186f289f03f6ea9d7d8aeacbd245c6d90c84c6..ee1e63919dace1096b12e49fd8205abb72599a85 100644 (file)
@@ -1355,8 +1355,11 @@ libxlGetAutoballoonConf(libxlDriverConfigPtr cfg,
     regex_t regex;
     int res;
 
-    if (virConfGetValueBool(conf, "autoballoon", &cfg->autoballoon) < 0)
+    res = virConfGetValueBool(conf, "autoballoon", &cfg->autoballoon);
+    if (res < 0)
         return -1;
+    else if (res == 1)
+        return 0;
 
     if ((res = regcomp(&regex,
                       "(^| )dom0_mem=((|min:|max:)[0-9]+[bBkKmMgG]?,?)+($| )",