]> xenbits.xensource.com Git - libvirt.git/commitdiff
libxl: add dump dir to libxlDriverConfig object
authorJim Fehlig <jfehlig@suse.com>
Wed, 19 Feb 2014 23:09:36 +0000 (16:09 -0700)
committerJim Fehlig <jfehlig@suse.com>
Mon, 24 Feb 2014 17:27:53 +0000 (10:27 -0700)
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
src/libxl/libxl_conf.c
src/libxl/libxl_conf.h
src/libxl/libxl_driver.c

index 4cefadf37f058be22102aefa712074c174f26542..13eddd11fd8d369c8353601c2fd9180d5cbeed83 100644 (file)
@@ -97,6 +97,7 @@ libxlDriverConfigDispose(void *obj)
     VIR_FREE(cfg->stateDir);
     VIR_FREE(cfg->libDir);
     VIR_FREE(cfg->saveDir);
+    VIR_FREE(cfg->autoDumpDir);
 }
 
 static int
@@ -1078,6 +1079,8 @@ libxlDriverConfigNew(void)
         goto error;
     if (VIR_STRDUP(cfg->saveDir, LIBXL_SAVE_DIR) < 0)
         goto error;
+    if (VIR_STRDUP(cfg->autoDumpDir, LIBXL_DUMP_DIR) < 0)
+        goto error;
 
     if (virAsprintf(&log_file, "%s/libxl-driver.log", cfg->logDir) < 0)
         goto error;
index ca7bc7de86a63988f85a40aa7f374fa495f267d1..f089a928dc4c3b6794c81ecc61677cb85dd5605b 100644 (file)
@@ -48,6 +48,7 @@
 # define LIBXL_LOG_DIR LOCALSTATEDIR "/log/libvirt/libxl"
 # define LIBXL_LIB_DIR LOCALSTATEDIR "/lib/libvirt/libxl"
 # define LIBXL_SAVE_DIR LIBXL_LIB_DIR "/save"
+# define LIBXL_DUMP_DIR LIBXL_LIB_DIR "/dump"
 # define LIBXL_BOOTLOADER_PATH BINDIR "/pygrub"
 
 
@@ -82,6 +83,7 @@ struct _libxlDriverConfig {
     char *stateDir;
     char *libDir;
     char *saveDir;
+    char *autoDumpDir;
 };
 
 
index 0b9bf7d66eda6f50cb9d436691bdb8a48e382d7c..088baf0c01ca28dbf9e73f3b61418b2dddde6756 100644 (file)
@@ -977,6 +977,13 @@ libxlStateInitialize(bool privileged,
                        virStrerror(errno, ebuf, sizeof(ebuf)));
         goto error;
     }
+    if (virFileMakePath(cfg->autoDumpDir) < 0) {
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       _("failed to create dump dir '%s': %s"),
+                       cfg->autoDumpDir,
+                       virStrerror(errno, ebuf, sizeof(ebuf)));
+        goto error;
+    }
 
     /* read the host sysinfo */
     libxl_driver->hostsysinfo = virSysinfoRead();