[PATCH 3/4] libxl: add dump dir to libxlDriverConfig object

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Jim Fehlig <jfehlig@xxxxxxxx>
---

Without a libxl config file, I suppose the only thing needed here is
the #define in libxl_conf.h.  But I have a dusty series adding lockd
support to the libxl driver, which I'll be cleaning off soon.  That
series introduces libxl.conf, and can be expanded to include an auto
dump dir entry.

 src/libxl/libxl_conf.c   | 3 +++
 src/libxl/libxl_conf.h   | 2 ++
 src/libxl/libxl_driver.c | 7 +++++++
 3 files changed, 12 insertions(+)

diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index 4cefadf..13eddd1 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -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;
diff --git a/src/libxl/libxl_conf.h b/src/libxl/libxl_conf.h
index ca7bc7d..f089a92 100644
--- a/src/libxl/libxl_conf.h
+++ b/src/libxl/libxl_conf.h
@@ -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;
 };
 
 
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index e600de7..e18fead 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -976,6 +976,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();
-- 
1.8.1.4

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]