Skip to contentSkip to conversation

Honour more configure variables in various places (iteration 3)

PATCH Superseded Wei Liu 4 participants 24 messages Jun 15, 2016 – Jul 11, 2016

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Wei Liu

author
#0 lore raw

cover Honour more configure variables in various places (iteration 3)

This series deals with hard-coded /var/run in code.

Wei Liu (7):
xenconsoled: honour XEN_RUN_DIR
tools/helper: honour XEN_RUN_DIR in init-xenstore-domain.c hotplug/FreeBSD: honour XEN_RUN_DIR hotplug/NetBSD: honour XEN_RUN_DIR hotplug/Linux: honour XEN_RUN_DIR
libxenstat: honour XEN_RUN_DIR
oxenstored: honour XEN_RUN_DIR

 .gitignore                                    | 2 ++
 tools/console/daemon/main.c                   | 2 +-
 tools/helpers/Makefile                        | 7 +++++--
 tools/helpers/init-xenstore-domain.c          | 8 +++++---
 tools/hotplug/FreeBSD/rc.d/xendriverdomain.in | 2 +-
 tools/hotplug/Linux/init.d/xencommons.in      | 6 +++---
 tools/hotplug/Linux/init.d/xendriverdomain.in | 2 +-
 tools/hotplug/NetBSD/rc.d/xendriverdomain.in  | 2 +-
 tools/ocaml/xenstored/xenstored.ml            | 2 +-
 tools/xenstat/libxenstat/Makefile             | 7 ++++++-
 tools/xenstat/libxenstat/src/xenstat_qmp.c    | 3 ++-
 11 files changed, 28 insertions(+), 15 deletions(-)
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
author
#1 lore raw

PATCH 1/7 xenconsoled: honour XEN_RUN_DIR

Place the PID file under XEN_RUN_DIR by default. Note this change the default location from /var/run to /var/run/xen.

---
Cc: Ian Jackson <[email protected]>

---
 tools/console/daemon/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/console/daemon/main.c +1 -1
index 20e3513..806d2fd 100644
@@ -193,7 +193,7 @@ int main(int argc, char **argv)
 	increase_fd_limit();
 
 	if (!is_interactive) {
-		daemonize(pidfile ? pidfile : "/var/run/xenconsoled.pid");
+		daemonize(pidfile ? pidfile : XEN_RUN_DIR "/xenconsoled.pid");
 	}
 
 	if (!xen_setup())
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
author
#2 lore raw

PATCH 2/7 tools/helper: honour XEN_RUN_DIR in init-xenstore-domain.c

In reply to Wei Liu

Place the PID file under XEN_RUN_DIR. Note that this change the default location from /var/run to /var/run/xen.

Generate a _paths.h as that is required to make this change work.

---
Cc: Ian Jackson <[email protected]>

---
 .gitignore                           | 1 +
 tools/helpers/Makefile               | 7 +++++--
 tools/helpers/init-xenstore-domain.c | 8 +++++---
 3 files changed, 11 insertions(+), 5 deletions(-)
.gitignore +1 -0
index e019f2e..d4ffaa6 100644
@@ -145,6 +145,7 @@ tools/flask/utils/flask-loadpolicy
 tools/flask/utils/flask-setenforce
 tools/flask/utils/flask-set-bool
 tools/flask/utils/flask-label-pci
+tools/helpers/_paths.h
 tools/helpers/init-xenstore-domain
 tools/helpers/xen-init-dom0
 tools/hotplug/common/hotplugpath.sh
tools/helpers/Makefile +5 -2
index a05a368..5d444aa 100644
@@ -28,7 +28,7 @@ all: $(PROGS)
 xen-init-dom0: $(XEN_INIT_DOM0_OBJS)
 	$(CC) $(LDFLAGS) -o $@ $(XEN_INIT_DOM0_OBJS) $(LDLIBS_libxentoollog) $(LDLIBS_libxenstore) $(LDLIBS_libxenlight) $(APPEND_LDFLAGS)
 
-init-xenstore-domain: $(INIT_XENSTORE_DOMAIN_OBJS)
+init-xenstore-domain: $(INIT_XENSTORE_DOMAIN_OBJS) _paths.h
 	$(CC) $(LDFLAGS) -o $@ $(INIT_XENSTORE_DOMAIN_OBJS) $(LDLIBS_libxentoollog) $(LDLIBS_libxenstore) $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) $(LDLIBS_libxenlight) $(APPEND_LDFLAGS)
 
 .PHONY: install
@@ -41,6 +41,9 @@ endif
 
 .PHONY: clean
 clean:
-	$(RM) -f *.o $(PROGS) $(DEPS)
+	$(RM) -f *.o $(PROGS) $(DEPS) _paths.h
 
 distclean: clean
+
+genpath-target = $(call buildmakevars2header,_paths.h)
+$(eval $(genpath-target))
tools/helpers/init-xenstore-domain.c +5 -3
index 909542b..53b4b01 100644
@@ -14,6 +14,7 @@
 #include <xen-xsm/flask/flask.h>
 
 #include "init-dom-json.h"
+#include "_paths.h"
 
 static uint32_t domid = ~0;
 static char *kernel;
@@ -316,10 +317,10 @@ int main(int argc, char** argv)
     do_xs_write_dom(xsh, "memory/static-max", buf);
     xs_close(xsh);
 
-    fd = creat("/var/run/xenstored.pid", 0666);
+    fd = creat(XEN_RUN_DIR "/xenstored.pid", 0666);
     if ( fd < 0 )
     {
-        fprintf(stderr, "Creating /var/run/xenstored.pid failed\n");
+        fprintf(stderr, "Creating " XEN_RUN_DIR "/xenstored.pid failed\n");
         return 3;
     }
     rv = snprintf(buf, 16, "domid:%d\n", domid);
@@ -327,7 +328,8 @@ int main(int argc, char** argv)
     close(fd);
     if ( rv < 0 )
     {
-        fprintf(stderr, "Writing domid to /var/run/xenstored.pid failed\n");
+        fprintf(stderr,
+                "Writing domid to " XEN_RUN_DIR "/xenstored.pid failed\n");
         return 3;
     }
 
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
#3 lore raw

Re: [PATCH 2/7] tools/helper: honour XEN_RUN_DIR in init-xenstore-domain.c

Wei Liu writes ("[PATCH 2/7] tools/helper: honour XEN_RUN_DIR in init-xenstore-domain.c"):

Quoted 4 lines

Place the PID file under XEN_RUN_DIR. Note that this change the default location from /var/run to /var/run/xen.

Generate a _paths.h as that is required to make this change work.

...

tools/helpers/Makefile all: $(PROGS) · line 31

Quoted 2 lines
tools/helpers/Makefile +1 -1
-init-xenstore-domain: $(INIT_XENSTORE_DOMAIN_OBJS)
+init-xenstore-domain: $(INIT_XENSTORE_DOMAIN_OBJS) _paths.h

This dependency is surely wrong. It is the object(s) (ie, the compile) that depend on _paths.h, not the executable (ie the link).

But otherwise this is fine.

Thanks,
Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

author
#4 lore raw

Re: [PATCH 2/7] tools/helper: honour XEN_RUN_DIR in init-xenstore-domain.c

Quoted 4 lines · Ian Jackson

Wei Liu writes ("[PATCH 2/7] tools/helper: honour XEN_RUN_DIR in init-xenstore-domain.c"):

Quoted 3 lines

Place the PID file under XEN_RUN_DIR. Note that this change the default location from /var/run to /var/run/xen.

Quoted 8 lines
Quoted 1 line

Generate a _paths.h as that is required to make this change work.

...

tools/helpers/Makefile all: $(PROGS) · line 31

Quoted 2 lines
tools/helpers/Makefile +1 -1
-init-xenstore-domain: $(INIT_XENSTORE_DOMAIN_OBJS)
+init-xenstore-domain: $(INIT_XENSTORE_DOMAIN_OBJS) _paths.h

This dependency is surely wrong. It is the object(s) (ie, the compile) that depend on _paths.h, not the executable (ie the link).

Good catch. I will fix it in next version.

Wei.

Quoted 4 lines

But otherwise this is fine.

Thanks,
Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

author
#5 lore raw

PATCH 3/7 hotplug/FreeBSD: honour XEN_RUN_DIR

In reply to Wei Liu

Store xldevd.pid under XEN_RUN_DIR. Note that the default location would change from /var/run to /var/run/xen.

---
Cc: Ian Jackson <[email protected]>
Cc: Roger Pau Monné <[email protected]>

---
 tools/hotplug/FreeBSD/rc.d/xendriverdomain.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/hotplug/FreeBSD/rc.d/xendriverdomain.in +1 -1
index 4063c06..8ece7c3 100644
@@ -18,7 +18,7 @@ start_cmd="xendriverdomain_startcmd"
 stop_cmd="xendriverdomain_stop"
 extra_commands=""
 
-XLDEVD_PIDFILE="/var/run/xldevd.pid"
+XLDEVD_PIDFILE="@XEN_RUN_DIR@/xldevd.pid"
 
 xendriverdomain_precmd()
 {
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Acked-by on v1 3/7
#7 lore raw

Re: [PATCH 3/7] hotplug/FreeBSD: honour XEN_RUN_DIR

In reply to Wei Liu

Wei Liu writes ("[PATCH 3/7] hotplug/FreeBSD: honour XEN_RUN_DIR"):

Quoted 4 lines

Store xldevd.pid under XEN_RUN_DIR. Note that the default location would change from /var/run to /var/run/xen.

I see Roger has acked this already.

Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

author
#8 lore raw

PATCH 4/7 hotplug/NetBSD: honour XEN_RUN_DIR

In reply to Wei Liu

Store xldevd.pid under XEN_RUN_DIR. Note that this will change the default location from /var/run to /var/run/xen.

---
Cc: Ian Jackson <[email protected]>
Cc: Roger Pau Monné <[email protected]>

---
 tools/hotplug/NetBSD/rc.d/xendriverdomain.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/hotplug/NetBSD/rc.d/xendriverdomain.in +1 -1
index 5062a71..f47b0b1 100644
@@ -19,7 +19,7 @@ start_cmd="xendriverdomain_startcmd"
 stop_cmd="xendriverdomain_stop"
 extra_commands=""
 
-XLDEVD_PIDFILE="/var/run/xldevd.pid"
+XLDEVD_PIDFILE="@XEN_RUN_DIR@/xldevd.pid"
 
 xendriverdomain_precmd()
 {
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
author
#11 lore raw

PATCH 5/7 hotplug/Linux: honour XEN_RUN_DIR

In reply to Wei Liu

Store various PID files under XEN_RUN_DIR. Note that this change the default location from /var/run to /var/run/xen.

---
Cc: Ian Jackson <[email protected]>
Cc: Roger Pau Monné <[email protected]>

---
 tools/hotplug/Linux/init.d/xencommons.in      | 6 +++---
 tools/hotplug/Linux/init.d/xendriverdomain.in | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)
tools/hotplug/Linux/init.d/xencommons.in +3 -3
index 7b69fc2..2d8f30b 100644
@@ -27,8 +27,8 @@ xencommons_config=@CONFIG_DIR@/@CONFIG_LEAF_DIR@
 
 test -f $xencommons_config/xencommons && . $xencommons_config/xencommons
 
-XENCONSOLED_PIDFILE=/var/run/xenconsoled.pid
-QEMU_PIDFILE=/var/run/qemu-dom0.pid
+XENCONSOLED_PIDFILE=@XEN_RUN_DIR@/xenconsoled.pid
+QEMU_PIDFILE=@XEN_RUN_DIR@/qemu-dom0.pid
 shopt -s extglob
 
 # not running in Xen dom0 or domU
@@ -70,7 +70,7 @@ do_start () {
 
 		if [ -n "$XENSTORED" ] ; then
 		    echo -n Starting $XENSTORED...
-		    $XENSTORED --pid-file /var/run/xenstored.pid $XENSTORED_ARGS
+		    $XENSTORED --pid-file @XEN_RUN_DIR@/xenstored.pid $XENSTORED_ARGS
 		else
 		    echo "No xenstored found"
 		    exit 1
tools/hotplug/Linux/init.d/xendriverdomain.in +1 -1
index 8d4592a..c63060f 100644
@@ -24,7 +24,7 @@ xendriverdomain_config=@CONFIG_DIR@/@CONFIG_LEAF_DIR@
 
 test -f $xendriverdomain_config/xendriverdomain && . $xendriverdomain_config/xendriverdomain
 
-XLDEVD_PIDFILE=/var/run/xldevd.pid
+XLDEVD_PIDFILE=@XEN_RUN_DIR@/xldevd.pid
 
 # not running in Xen dom0 or domU
 if ! test -d /proc/xen ; then
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
author
#14 lore raw

PATCH 6/7 libxenstat: honour XEN_RUN_DIR

In reply to Wei Liu

This is because libxl uses XEN_RUN_DIR to generate the socket path for libxenstat while libxenstat itself uses hard-coded path, which is not necessary in sync with libxl.

Generate a _paths.h because it is required to make this change work.

---
Cc: Ian Jackson <[email protected]>

---
 .gitignore                                 | 1 +
 tools/xenstat/libxenstat/Makefile          | 7 ++++++-
 tools/xenstat/libxenstat/src/xenstat_qmp.c | 3 ++-
 3 files changed, 9 insertions(+), 2 deletions(-)
.gitignore +1 -0
index d4ffaa6..9b8dece 100644
@@ -220,6 +220,7 @@ tools/xenmon/xentrace_setmask
 tools/xenmon/xenbaked
 tools/xenpaging/xenpaging
 tools/xenpmd/xenpmd
+tools/xenstat/libxenstat/src/_paths.h
 tools/xenstat/xentop/xentop
 tools/xenstore/xenstore
 tools/xenstore/xenstore-chmod
tools/xenstat/libxenstat/Makefile +6 -1
index 850d24a..213d998 100644
@@ -40,6 +40,8 @@ LDLIBS-$(CONFIG_SunOS) += -lkstat
 .PHONY: all
 all: $(LIB) $(SHLIB) $(SHLIB_LINKS)
 
+$(OBJECTS-y): src/_paths.h
+
 $(LIB): $(OBJECTS-y)
 	$(AR) rc $@ $^
 	$(RANLIB) $@
@@ -135,9 +137,12 @@ endif
 .PHONY: clean
 clean:
 	rm -f $(LIB) $(SHLIB) $(SHLIB_LINKS) $(OBJECTS-y) \
-	      $(BINDINGS) $(BINDINGSRC) $(DEPS)
+	      $(BINDINGS) $(BINDINGSRC) $(DEPS) src/_paths.h
 
 .PHONY: distclean
 distclean: clean
 
 -include $(DEPS)
+
+genpath-target = $(call buildmakevars2header,src/_paths.h)
+$(eval $(genpath-target))
tools/xenstat/libxenstat/src/xenstat_qmp.c +2 -1
index c12929a..a87c937 100644
@@ -23,6 +23,7 @@
 #include <xenctrl.h>
 
 #include "xenstat_priv.h"
+#include "_paths.h"
 
 #ifdef HAVE_YAJL_YAJL_VERSION_H
 #  include <yajl/yajl_version.h>
@@ -398,7 +399,7 @@ static void read_attributes_qdisk_dom(xenstat_node *node, domid_t domain)
 	free(val);
 
 	/* Connect to this VMs QMP socket */
-	snprintf(path, sizeof(path), "/var/run/xen/qmp-libxenstat-%i", domain);
+	snprintf(path, sizeof(path), XEN_RUN_DIR "/qmp-libxenstat-%i", domain);
 	if ((qfd = qmp_connect(path)) < 0)
 		return;
 
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
#15 lore raw

Re: [PATCH 6/7] libxenstat: honour XEN_RUN_DIR

Wei Liu writes ("[PATCH 6/7] libxenstat: honour XEN_RUN_DIR"):

Quoted 3 lines

This is because libxl uses XEN_RUN_DIR to generate the socket path for libxenstat while libxenstat itself uses hard-coded path, which is not necessary in sync with libxl.

This commit message is confusing (and perhaps ungrammatical). Is there currently a bug here ?

Maybe this patch or something like it is a backport candidate ?

Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

author
#16 lore raw

Re: [PATCH 6/7] libxenstat: honour XEN_RUN_DIR

Quoted 5 lines · Ian Jackson

Wei Liu writes ("[PATCH 6/7] libxenstat: honour XEN_RUN_DIR"):

Quoted 3 lines

This is because libxl uses XEN_RUN_DIR to generate the socket path for libxenstat while libxenstat itself uses hard-coded path, which is not necessary in sync with libxl.

which is not necessarily the same path as XEN_RUN_DIR.

Quoted 5 lines

This commit message is confusing (and perhaps ungrammatical). Is there currently a bug here ?

Maybe this patch or something like it is a backport candidate ?

There is no bug in the default configuration because XEN_RUN_DIR is /var/run/xen by default. But if users chooses a different path the path used in libxl and the path used in libxenstat will go out of sync hence rendering libxenstat useless.

I think this is a backport candidate.

Wei.

Quoted 1 line

Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

author
#17 lore raw

PATCH 7/7 oxenstored: honour XEN_RUN_DIR

In reply to Wei Liu

Move default the pid file under XEN_RUN_DIR. Note that it changes the location from /var/run to /var/run/xen.

---
Cc: Ian Jackson <[email protected]>
Cc: Dave Scott <[email protected]>

---
 tools/ocaml/xenstored/xenstored.ml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/ocaml/xenstored/xenstored.ml +1 -1
index 30570ed..7ea4026 100644
@@ -81,7 +81,7 @@ let config_filename cf =
 	| Some name -> name
 	| None      -> Define.default_config_dir ^ "/oxenstored.conf"
 
-let default_pidfile = "/var/run/xenstored.pid"
+let default_pidfile = Paths.xen_run_dir ^ "/xenstored.pid"
 
 let ring_scan_interval = ref 20
 
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Acked-by on v1 7/7
#18 lore raw

Re: [PATCH 7/7] oxenstored: honour XEN_RUN_DIR

Quoted 25 lines · Wei Liu

Move default the pid file under XEN_RUN_DIR. Note that it changes the location from /var/run to /var/run/xen.

---
Cc: Ian Jackson <[email protected]>
Cc: Dave Scott <[email protected]>
---
tools/ocaml/xenstored/xenstored.ml | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
tools/ocaml/xenstored/xenstored.ml +1 -1
index 30570ed..7ea4026 100644
@@ -81,7 +81,7 @@ let config_filename cf =
 	| Some name -> name
 	| None      -> Define.default_config_dir ^ "/oxenstored.conf"
 
-let default_pidfile = "/var/run/xenstored.pid"
+let default_pidfile = Paths.xen_run_dir ^ "/xenstored.pid"
 
Quoted 5 lines

let ring_scan_interval = ref 20

Signature · 1 line
2.1.4

Looks fine to me.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#20 lore raw

Re: [PATCH 7/7] oxenstored: honour XEN_RUN_DIR

Ian Jackson writes ("Re: [PATCH 7/7] oxenstored: honour XEN_RUN_DIR"):

Quoted 5 lines

Wei Liu writes ("[PATCH 7/7] oxenstored: honour XEN_RUN_DIR"):

Quoted 2 lines

Move default the pid file under XEN_RUN_DIR. Note that it changes the location from /var/run to /var/run/xen.

Actually, shouldn't this be combined with some init script patch, as otherwise the tree is not bisectable ?

Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

author
#21 lore raw

Re: [PATCH 7/7] oxenstored: honour XEN_RUN_DIR

Quoted 10 lines · Ian Jackson

Ian Jackson writes ("Re: [PATCH 7/7] oxenstored: honour XEN_RUN_DIR"):

Quoted 5 lines

Wei Liu writes ("[PATCH 7/7] oxenstored: honour XEN_RUN_DIR"):

Quoted 2 lines

Move default the pid file under XEN_RUN_DIR. Note that it changes the location from /var/run to /var/run/xen.

Actually, shouldn't this be combined with some init script patch, as otherwise the tree is not bisectable ?

There is no init script to modify because oxenstored uses these paths in code by default.

Wei.

Quoted 1 line

Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

author
#22 lore raw
In reply to Wei Liu

Ian, ping?

Quoted 11 lines · Wei Liu

This series deals with hard-coded /var/run in code.

Wei Liu (7):
xenconsoled: honour XEN_RUN_DIR
tools/helper: honour XEN_RUN_DIR in init-xenstore-domain.c hotplug/FreeBSD: honour XEN_RUN_DIR hotplug/NetBSD: honour XEN_RUN_DIR hotplug/Linux: honour XEN_RUN_DIR
libxenstat: honour XEN_RUN_DIR
oxenstored: honour XEN_RUN_DIR

Quoted 16 lines
 .gitignore                                    | 2 ++
 tools/console/daemon/main.c                   | 2 +-
 tools/helpers/Makefile                        | 7 +++++--
 tools/helpers/init-xenstore-domain.c          | 8 +++++---
 tools/hotplug/FreeBSD/rc.d/xendriverdomain.in | 2 +-
 tools/hotplug/Linux/init.d/xencommons.in      | 6 +++---
 tools/hotplug/Linux/init.d/xendriverdomain.in | 2 +-
 tools/hotplug/NetBSD/rc.d/xendriverdomain.in  | 2 +-
 tools/ocaml/xenstored/xenstored.ml            | 2 +-
 tools/xenstat/libxenstat/Makefile             | 7 ++++++-
 tools/xenstat/libxenstat/src/xenstat_qmp.c    | 3 ++-
 11 files changed, 28 insertions(+), 15 deletions(-)
Signature · 1 line
2.1.4

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#23 lore raw

Wei Liu writes ("Re: [Xen-devel] [PATCH 0/7] Honour more configure variables in various places (iteration 3)"):

Quoted 1 line

Ian, ping?

You didn't actually send that ping mail to me, just to the list :-).

I'll look at the patches ...

Thanks,
Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel