Skip to contentSkip to conversation

tools: add configure --with-dumpdir=DIR option

PATCH In review Olaf Hering 2 participants 4 messages May 11, 2015 – May 21, 2015

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 tools: add configure --with-dumpdir=DIR option

The current base directory /var/xen/dump for domU dumps will be patched to /var/lib/xen/dump by most distros to follow FHS.

This change does three things:
- change the default from /var/xen/dump to /var/lib/xen/dump
- provide a configure option to avoid patching the source.
- update docs to refer to the new default location

Please rerun autogen.sh after applying this patch.

Cc Ian Jackson <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Ian Campbell <[email protected]>
Cc Wei Liu <[email protected]>

---

This depends on the PRIVATE vs. automake variable series, unless sbindir, bindir and libdir gets changed to uppercase before applying.

v2:
- change default to /var/lib/xen/dump
- update also docs

 Config.mk                | 2 +-
 INSTALL                  | 4 ++++
 config/Paths.mk.in       | 1 +
 docs/man/xl.cfg.pod.5    | 6 +++---
 docs/man/xl.pod.1        | 2 +-
 m4/paths.m4              | 9 +++++++++
 tools/Makefile           | 2 +-
 tools/libxl/xl_cmdimpl.c | 2 +-
 8 files changed, 21 insertions(+), 7 deletions(-)
Config.mk +1 -1
index 46928ca..b21ccaa 100644
@@ -159,7 +159,7 @@ endef
 
 BUILD_MAKE_VARS := sbindir bindir LIBEXEC LIBEXEC_BIN libdir SHAREDIR \
                    XENFIRMWAREDIR XEN_CONFIG_DIR XEN_SCRIPT_DIR XEN_LOCK_DIR \
-                   XEN_RUN_DIR XEN_PAGING_DIR
+                   XEN_RUN_DIR XEN_PAGING_DIR XEN_DUMP_DIR
 
 buildmakevars2file = $(eval $(call buildmakevars2file-closure,$(1)))
 define buildmakevars2file-closure
INSTALL +4 -0
index a0f2e7b..10cf879 100644
@@ -128,6 +128,10 @@ original xenstored will be used. Valid names are xenstored and
 oxenstored.
   --with-xenstored=name
 
+The path where to store core dumps for domUs which are configured with
+coredump-destroy or coredump-restart can be specified with this option.
+  --with-xen-dumpdir=DIR
+
 Instead of starting the tools in dom0 with sysv runlevel scripts they
 can also be started by systemd. If this option is enabled xenstored will
 receive the communication socked directly from systemd. So starting it
config/Paths.mk.in +1 -0
index ddd72df..d36504f 100644
@@ -48,6 +48,7 @@ CONFIG_LEAF_DIR          := @CONFIG_LEAF_DIR@
 BASH_COMPLETION_DIR      := $(CONFIG_DIR)/bash_completion.d
 XEN_LOCK_DIR             := @XEN_LOCK_DIR@
 XEN_PAGING_DIR           := @XEN_PAGING_DIR@
+XEN_DUMP_DIR             := @XEN_DUMP_DIR@
 
 XENFIRMWAREDIR           := @XENFIRMWAREDIR@
 
docs/man/xl.cfg.pod.5 +3 -3
index 8e4154f..5bff236 100644
@@ -360,12 +360,12 @@ destroy`.
 
 =item B<coredump-destroy>
 
-write a "coredump" of the domain to F</var/xen/dump/NAME> and then
+write a "coredump" of the domain to F</var/lib/xen/dump/NAME> and then
 destroy the domain.
 
 =item B<coredump-restart>
 
-write a "coredump" of the domain to F</var/xen/dump/NAME> and then
+write a "coredump" of the domain to F</var/lib/xen/dump/NAME> and then
 restart the domain.
 
 =back
@@ -1692,7 +1692,7 @@ See L<qemu(1)> for more information.
 =head1 FILES
 
 F</etc/xen/NAME.cfg>
-F</var/xen/dump/NAME>
+F</var/lib/xen/dump/NAME>
 
 =head1 BUGS
 
docs/man/xl.pod.1 +1 -1
index 16783c8..b8f244b 100644
@@ -273,7 +273,7 @@ Change the domain name of I<domain-id> to I<new-name>.
 Dumps the virtual machine's memory for the specified domain to the
 I<filename> specified, without pausing the domain.  The dump file will
 be written to a distribution specific directory for dump files.  Such
-as: /var/lib/xen/dump or /var/xen/dump.
+as: /var/lib/xen/dump.
 
 =item B<help> [I<--long>]
 
m4/paths.m4 +9 -0
index db74f55..57d86c5 100644
@@ -62,6 +62,12 @@ AC_ARG_WITH([sysconfig-leaf-dir],
 CONFIG_LEAF_DIR=$config_leaf_dir
 AC_SUBST(CONFIG_LEAF_DIR)
 
+AC_ARG_WITH([xen-dumpdir],
+    AS_HELP_STRING([--with-xen-dumpdir=DIR],
+    [Path to directory for domU crash dumps. [/var/lib/xen/dump]]),
+    [xen_dumpdir_path=$withval],
+    [xen_dumpdir_path=$localstatedir/lib/xen/dump])
+
 if test "$libexecdir" = '${exec_prefix}/libexec' ; then
     case "$host_os" in
          *netbsd*) ;;
@@ -113,4 +119,7 @@ AC_SUBST(XEN_LOCK_DIR)
 
 XEN_PAGING_DIR=$localstatedir/lib/xen/xenpaging
 AC_SUBST(XEN_PAGING_DIR)
+
+XEN_DUMP_DIR=$xen_dumpdir_path
+AC_SUBST(XEN_DUMP_DIR)
 ])
tools/Makefile +1 -1
index 383d4ca..45cb4b2 100644
@@ -58,7 +58,7 @@ build all: subdirs-all
 
 .PHONY: install
 install: subdirs-install
-	$(INSTALL_DIR) $(DESTDIR)/var/xen/dump
+	$(INSTALL_DIR) $(DESTDIR)$(XEN_DUMP_DIR)
 	$(INSTALL_DIR) $(DESTDIR)/var/log/xen
 	$(INSTALL_DIR) $(DESTDIR)/var/lib/xen
 
tools/libxl/xl_cmdimpl.c +1 -1
index 526a1f6..a36ad61 100644
@@ -2303,7 +2303,7 @@ static int handle_domain_death(uint32_t *r_domid,
         char *corefile;
         int rc;
 
-        if (asprintf(&corefile, "/var/xen/dump/%s", d_config->c_info.name) < 0) {
+        if (asprintf(&corefile, XEN_DUMP_DIR "/%s", d_config->c_info.name) < 0) {
             LOG("failed to construct core dump path");
         } else {
             LOG("dumping core to %s", corefile);
Acked-by on v2 1/1
#1 lore raw

On Mon, 2015-05-11 at 15:33 +0000, Olaf Hering wrote:
[...]

m4/paths.m4 AC_ARG_WITH([sysconfig-leaf-dir], · line 67

Quoted 3 lines
m4/paths.m4 +3 -0
+AC_ARG_WITH([xen-dumpdir],
+    AS_HELP_STRING([--with-xen-dumpdir=DIR],
+    [Path to directory for domU crash dumps. [/var/lib/xen/dump]]),

Should this say $localstatedir/lib/xen/dump as below?

Other than that:

If you say so I can make that tweak as I apply.

Quoted 6 lines
m4/paths.m4 +3 -0
+    [xen_dumpdir_path=$withval],
+    [xen_dumpdir_path=$localstatedir/lib/xen/dump])
+
 if test "$libexecdir" = '${exec_prefix}/libexec' ; then
     case "$host_os" in
          *netbsd*) ;;
#2 lore raw
Quoted 7 lines · Ian Campbell

On Mon, 2015-05-11 at 15:33 +0000, Olaf Hering wrote:
[...]

m4/paths.m4 AC_ARG_WITH([sysconfig-leaf-dir], · line 67

Quoted 3 lines
m4/paths.m4 +3 -0
+AC_ARG_WITH([xen-dumpdir],
+    AS_HELP_STRING([--with-xen-dumpdir=DIR],
+    [Path to directory for domU crash dumps. [/var/lib/xen/dump]]),

Should this say $localstatedir/lib/xen/dump as below?

This is the help output, the line below is a variable assignment. I think its ok as it is. Perhaps /var can be replaced with LOCALSTATEDIR to make it clearer.

configure --help suggests that --localestatedir is PREFIX/var, but we force it to be /var. Too bad that can not be changed because it comes from generic code, I think.

Olaf

Quoted 13 lines

Other than that:

If you say so I can make that tweak as I apply.

Quoted 6 lines
m4/paths.m4 +3 -0
+    [xen_dumpdir_path=$withval],
+    [xen_dumpdir_path=$localstatedir/lib/xen/dump])
+
 if test "$libexecdir" = '${exec_prefix}/libexec' ; then
     case "$host_os" in
          *netbsd*) ;;
#3 lore raw
Quoted 8 lines · Olaf Hering
Quoted 6 lines · Ian Campbell

On Mon, 2015-05-11 at 15:33 +0000, Olaf Hering wrote:
[...]

Quoted 3 lines
m4/paths.m4 +3 -0
+AC_ARG_WITH([xen-dumpdir],
+    AS_HELP_STRING([--with-xen-dumpdir=DIR],
+    [Path to directory for domU crash dumps. [/var/lib/xen/dump]]),
Quoted 5 lines
Quoted 1 line

Should this say $localstatedir/lib/xen/dump as below?

This is the help output, the line below is a variable assignment. I think its ok as it is. Perhaps /var can be replaced with LOCALSTATEDIR to make it clearer.

Based on the other things in configure --help I think that's right. Ive applied making that change, thanks.

Quoted 3 lines

configure --help suggests that --localestatedir is PREFIX/var, but we force it to be /var. Too bad that can not be changed because it comes from generic code, I think.

I vaguely recall coming to the same conclusion when I looked at this :-(