aboutsummaryrefslogtreecommitdiffstats
path: root/tools/libxl/xl.c
diff options
context:
space:
mode:
authorStefano Stabellini <stefano.stabellini@eu.citrix.com>2010-09-22 18:02:36 +0100
committerStefano Stabellini <stefano.stabellini@eu.citrix.com>2010-09-22 18:02:36 +0100
commitea4dce89d478d62341cd2f9d8944e215f7086144 (patch)
treeb876308b4100df10cf2347265339e5bb66a87b1d /tools/libxl/xl.c
parent2dbb423e17aa902de141cc735f0c496f65cd89ba (diff)
downloadxen-ea4dce89d478d62341cd2f9d8944e215f7086144.tar.gz
xen-ea4dce89d478d62341cd2f9d8944e215f7086144.tar.bz2
xen-ea4dce89d478d62341cd2f9d8944e215f7086144.zip
xl: free memory before building a domain
Free the needed amount of memory before proceeding with the domain build. Use a filelock to prevent other xl instances from conflicting during this operation. Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Diffstat (limited to 'tools/libxl/xl.c')
-rw-r--r--tools/libxl/xl.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/tools/libxl/xl.c b/tools/libxl/xl.c
index 345f4a5f35..2ad117f56d 100644
--- a/tools/libxl/xl.c
+++ b/tools/libxl/xl.c
@@ -34,6 +34,7 @@
xentoollog_logger_stdiostream *logger;
int autoballoon = 1;
+char *lockfile;
static xentoollog_level minmsglevel = XTL_PROGRESS;
@@ -44,6 +45,7 @@ static void parse_global_config(const char *configfile,
long l;
XLU_Config *config;
int e;
+ const char *buf;
config = xlu_cfg_init(stderr, configfile);
if (!config) {
@@ -60,6 +62,16 @@ static void parse_global_config(const char *configfile,
if (!xlu_cfg_get_long (config, "autoballoon", &l))
autoballoon = l;
+ if (!xlu_cfg_get_string (config, "lockfile", &buf))
+ lockfile = strdup(buf);
+ else {
+ e = asprintf(&lockfile, "%s/xl", (char *)libxl_lock_dir_path());
+ if (e < 0) {
+ fprintf(stderr, "asprintf memory allocation failed\n");
+ exit(1);
+ }
+ }
+
xlu_cfg_destroy(config);
}