xen: add systemd support
v5 cover xen: add systemd support
From: "Luis R. Rodriguez" <[email protected]>
This is v5 on the xen systemd integration series. It addresses all concerns raised. I've also taken the time to run time test this with systems without systemd, and also built binaries with systemd enabled and tested these on non systemd systemd even with and without systemd libraries present. The trick was to use the dynamic link loader. Since the dynamic link loader is used, since ocaml lacks systemd support, and since it makes sense to share as much code as possible I've piggy backed systemd support into libxenstore.so and made oxenstored link to that. This series enables systemd on build time if you have what it takes to build systemd support, after all binaries with the dynamic link loader support won't require folks on systems to actually have systemd libraries present unless they actually *booted with systemd* as their init. Folks that don't like that approach can toy around and replace usage of AX_AVAILABLE_SYSTEMD() with AX_ALLOW_SYSTEMD() or AX_ENABLE_SYSTEMD() and enabling the CFLAG and LDFLAG as I had done in previous patches, the current approach however is the most flexible, and less intrusive.
This series also goes with sd_notify() support, thereby simplfying the systemd init even further. I generated this series using the latest unstable version of git to ensure we get proper review through simple renames with git format-patch -M --B.
I've dropped the retries stuff, I actually have a fix for that but I don't have the time to test, if some folks might be interested I can provide RFTs but I really want to get this out of the way first.
Luis R. Rodriguez (14):
xenstored: enable usage of config.h on both xenstored and oxenstored libxenstore.so: add support for systemd
cxenstored: add support for systemd active sockets
oxenstored: add support for systemd active sockets
oxenstored: force FD_CLOEXEC with Unix.set_close_on_exec on LSB init tools/xendomains: make xl the default
tools/xendomains: do space cleanups
tools/xendomains: move to libexec and use a smaller init helper
autoconf: xen: force a refresh with autoconf
autoconf: update m4/pkg.m4
autoconf: xen: move standard variables to a generic place
autoconf: xen: enable explicit preference option for xenstored
preference
xencommons: move module list into a generic place
systemd: add xen systemd service and module files
.gitignore | 7 +
Config.mk | 13 -
Makefile | 6 +-
README | 96 ++++
autogen.sh | 8 +-
config/StdGNU.mk | 28 +-
config/Tools.mk.in | 6 +
config/Toplevel.mk.in | 27 +
config/defaults.mk | 21 +
config/modules | 16 +
config/xen-environment-header.in | 16 +
config/xen-environment-scripts.in | 18 +
configure.ac | 10 +-
m4/README.source | 35 ++
m4/expand_config.m4 | 122 ++++
m4/pkg.m4 | 88 ++-
m4/systemd.m4 | 120 ++++
stubdom/Makefile | 17 +-
stubdom/configure.ac | 4 +
tools/configure.ac | 17 +-
tools/hotplug/Linux/Makefile | 45 +-
.../Linux/init.d/{xencommons => xencommons.in} | 22 +-
tools/hotplug/Linux/init.d/xendomains | 635 ++-------------------
tools/hotplug/Linux/systemd/Makefile | 70 +++
tools/hotplug/Linux/systemd/proc-xen.mount.in | 9 +
.../Linux/systemd/var-lib-xenstored.mount.in | 13 +
.../systemd/xen-qemu-dom0-disk-backend.service.in | 22 +
.../hotplug/Linux/systemd/xen-watchdog.service.in | 13 +
tools/hotplug/Linux/systemd/xenconsoled.service.in | 20 +
tools/hotplug/Linux/systemd/xendomains.service.in | 16 +
tools/hotplug/Linux/systemd/xenstored.service.in | 27 +
tools/hotplug/Linux/systemd/xenstored.socket.in | 11 +
tools/hotplug/Linux/{init.d => }/xendomains | 70 +--
tools/hotplug/common/Makefile | 6 +-
tools/libxl/Makefile | 11 +-
tools/ocaml/xenstored/Makefile | 13 +-
tools/ocaml/xenstored/systemd.ml | 17 +
tools/ocaml/xenstored/systemd.mli | 24 +
tools/ocaml/xenstored/systemd_stubs.c | 132 +++++
tools/ocaml/xenstored/utils.ml | 21 +-
tools/ocaml/xenstored/xenstored.ml | 2 +
tools/python/Makefile | 6 +-
tools/xenstore/Makefile | 8 +-
tools/xenstore/xenstore.h | 11 +
tools/xenstore/xenstored_core.c | 49 +-
tools/xenstore/xs_systemd.c | 321 +++++++++++
46 files changed, 1549 insertions(+), 720 deletions(-)
create mode 100644 config/defaults.mk
create mode 100644 config/modules
create mode 100644 config/xen-environment-header.in
create mode 100644 config/xen-environment-scripts.in
create mode 100644 m4/README.source
create mode 100644 m4/expand_config.m4
create mode 100644 m4/systemd.m4
rename tools/hotplug/Linux/init.d/{xencommons => xencommons.in} (82%)
rewrite tools/hotplug/Linux/init.d/xendomains (95%)
create mode 100644 tools/hotplug/Linux/systemd/Makefile
create mode 100644 tools/hotplug/Linux/systemd/proc-xen.mount.in
create mode 100644 tools/hotplug/Linux/systemd/var-lib-xenstored.mount.in
create mode 100644 tools/hotplug/Linux/systemd/xen-qemu-dom0-disk-backend.service.in
create mode 100644 tools/hotplug/Linux/systemd/xen-watchdog.service.in
create mode 100644 tools/hotplug/Linux/systemd/xenconsoled.service.in
create mode 100644 tools/hotplug/Linux/systemd/xendomains.service.in
create mode 100644 tools/hotplug/Linux/systemd/xenstored.service.in
create mode 100644 tools/hotplug/Linux/systemd/xenstored.socket.in
rename tools/hotplug/Linux/{init.d => }/xendomains (94%)
create mode 100644 tools/ocaml/xenstored/systemd.ml
create mode 100644 tools/ocaml/xenstored/systemd.mli
create mode 100644 tools/ocaml/xenstored/systemd_stubs.c
create mode 100644 tools/xenstore/xs_systemd.cSignature · 1 line
2.0.0.rc3.18.g00a5b79
PATCH v5 1/14 xenstored: enable usage of config.h on both xenstored and oxenstored
From: "Luis R. Rodriguez" <[email protected]>
This will be used later for dynamic configuration paths on C code.
--- tools/ocaml/xenstored/Makefile | 2 ++ tools/xenstore/Makefile | 1 + 2 files changed, 3 insertions(+)
tools/ocaml/xenstored/Makefile +2 -0
@@ -2,6 +2,8 @@ XEN_ROOT = $(CURDIR)/../../.. OCAML_TOPLEVEL = $(CURDIR)/.. include $(OCAML_TOPLEVEL)/common.make +CFLAGS += -I$(XEN_ROOT)/tools/ + OCAMLINCLUDE += \ -I $(OCAML_TOPLEVEL)/libs/xb \ -I $(OCAML_TOPLEVEL)/libs/mmap \
tools/xenstore/Makefile +1 -0
@@ -6,6 +6,7 @@ MINOR = 3 CFLAGS += -Werror CFLAGS += -I. +CFLAGS += -I$(XEN_ROOT)/tools/ CFLAGS += $(CFLAGS_libxenctrl) CLIENTS := xenstore-exists xenstore-list xenstore-read xenstore-rm xenstore-chmod
Signature · 1 line
2.0.0.rc3.18.g00a5b79
PATCH v5 2/14 libxenstore.so: add support for systemd
In reply to Luis R. RodriguezFrom: "Luis R. Rodriguez" <[email protected]>
This adds support for systemd into libxenstore.so to enable usage through cxenstored and oxenstored. The way we provide support for systemd is to *not* compile systemd with -lsystemd-daemon but instead to look for libsystemd-daemon.so at run time if the binary was compiled with support for systemd. Before using systemd though we check if the system was booted with systemd as the init process by using sd_booted() and only if this is true will we assume that's the only mechanism allowed. For systems that do not have systemd present or that have systemd libraries present but did not boot with systemd the old init unix socket creation mechanism will be used.
Systems that do not use unix sockets at all will continue to chug on as they used to skipping all this unix socket actication and relying on the kernel ring interface, used for exampl when CONFIG_STUBDOM=y which sets CFLAGS += -DNO_SOCKETS=1 on tools/xenstore/Makefile and also by the oxenstored --disable_socket run time flag.
This enables Linux distributions to ship and support one binary for both systemd and non-systemd type of environments.
--- tools/xenstore/Makefile | 7 +- tools/xenstore/xenstore.h | 11 ++ tools/xenstore/xs_systemd.c | 321 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 337 insertions(+), 2 deletions(-) create mode 100644 tools/xenstore/xs_systemd.c
tools/xenstore/Makefile +5 -2
@@ -9,10 +9,13 @@ CFLAGS += -I. CFLAGS += -I$(XEN_ROOT)/tools/ CFLAGS += $(CFLAGS_libxenctrl) +LDFLAGS += -ldl -rdynamic + CLIENTS := xenstore-exists xenstore-list xenstore-read xenstore-rm xenstore-chmod CLIENTS += xenstore-write xenstore-ls xenstore-watch XENSTORED_OBJS = xenstored_core.o xenstored_watch.o xenstored_domain.o xenstored_transaction.o xs_lib.o talloc.o utils.o tdb.o hashtable.o +XENSTORED_OBJS += xs_systemd.o XENSTORED_OBJS_$(CONFIG_Linux) = xenstored_linux.o xenstored_posix.o XENSTORED_OBJS_$(CONFIG_SunOS) = xenstored_solaris.o xenstored_posix.o xenstored_probes.o
@@ -86,10 +89,10 @@ libxenstore.so.$(MAJOR): libxenstore.so.$(MAJOR).$(MINOR) xs.opic: CFLAGS += -DUSE_PTHREAD -libxenstore.so.$(MAJOR).$(MINOR): xs.opic xs_lib.opic +libxenstore.so.$(MAJOR).$(MINOR): xs.opic xs_lib.opic xs_systemd.opic $(CC) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenstore.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $^ $(SOCKET_LIBS) -lpthread $(APPEND_LDFLAGS) -libxenstore.a: xs.o xs_lib.o +libxenstore.a: xs.o xs_lib.o xs_systemd.o $(AR) rcs $@ $^ .PHONY: clean
tools/xenstore/xenstore.h +11 -0
@@ -49,6 +49,7 @@#define XS_UNWATCH_FILTER 1UL<<2struct xs_handle ; +struct xs_sd_ctx ;typedef uint32_t xs_transaction_t ;/* IMPORTANT: For details on xenstore protocol limits, see
@@ -244,6 +245,16 @@ char *xs_debug_command(struct xs_handle *h, const char *cmd, void *data, unsigned int len);int xs_suspend_evtchn_port (int domid); + +struct xs_sd_ctx *xs_get_sd_ctx (void ); +void xs_free_sd_ctx (struct xs_sd_ctx *ctx); + +bool xs_load_sd_required (struct xs_sd_ctx *ctx); + +int xs_claim_active_socket (struct xs_sd_ctx *ctx,const char *connect_to); + +int xs_sd_notify_ready (struct xs_sd_ctx *ctx); +#endif /* XENSTORE_H */ /*
tools/xenstore/xs_systemd.c new file +321 -0
321 lines not on this page · raw message
Signature · 1 line
2.0.0.rc3.18.g00a5b79
Re: [PATCH v5 02/14] libxenstore.so: add support for systemd
Quoted 7 lines · Luis R. Rodriguez
From: "Luis R. Rodriguez" <[email protected]>
This adds support for systemd into libxenstore.so to enable usage through cxenstored and oxenstored. The way we provide support for systemd is to *not* compile systemd with -lsystemd-daemon but instead to look for libsystemd-daemon.so at run time if the binary was compiled with support for systemd.
This is not what either Ian or I intended to suggest. It is perfectly fine for the binary to be dynamically linked against -lsystemd-daemon in the normal way (and for the resulting binary packages to depend on the libsystemd-daemon package etc) if the headers etc are present at compile time.
What we were after was for the actual use of systemd to be runtime not compile time. IOW it is fine for xenstored to require the library to be installed, but not that systemd be the init which is in use.
Quoted 9 lines
Before using systemd though we check if the
system was booted with systemd as the init process by usingsd_booted()and only if this is true will we assume that's the only mechanism allowed. For systems that do not have systemd present or that have systemd libraries present but did not boot with systemd the old init unix socket creation mechanism will be used.Systems that do not use unix sockets at all will continue to chug on as they used to skipping all this unix socket actication and relying on the
"activation"
Quoted 1 line
kernel ring interface, used for exampl when
CONFIG_STUBDOM=ywhich sets
"example"
tools/xenstore/xs_systemd.c line 169
Quoted 12 lines
tools/xenstore/xs_systemd.c new file +6
-0+ +/* +* We list stdin, stdout and stderr simply for documentation purposes +* and to help our array size fit the number of expected sockets we +* as sd_listen_fds() will return 5 for example if you set the socket +* service with 2 sockets.
Please can we get rid of this list (which is bad enough in itself but the three spurious entries are ludicrous) and just
#define SOCKET_RW_INDEX SD_LISTEN_FDS_START
#define SOCKET_RO_INDEX SDL_LISTEN_FDS_START + 1
etc and use those for lookups, as I described in <[email protected]>?
Ian.
Re: [PATCH v5 02/14] libxenstore.so: add support for systemd
Quoted 5 lines · Ian Campbell
Quoted 5 lines
tools/xenstore/xs_systemd.c new file +5
-0+ +/* +* We list stdin, stdout and stderr simply for documentation purposes +* and to help our array size fit the number of expected sockets we +* as sd_listen_fds() will return 5 for example if you set the socket
Quoted 8 lines
Quoted 1 line
+ * service with 2 sockets.
Please can we get rid of this list (which is bad enough in itself but the three spurious entries are ludicrous) and just
#defineSOCKET_RW_INDEXSD_LISTEN_FDS_START
#defineSOCKET_RO_INDEXSDL_LISTEN_FDS_START+ 1
etc and use those for lookups, as I described in <[email protected]>?
Also I thought that we decided that the mapping from the indexes here to the functionality need to be documented as well, I'm not seeing that, at least not based on a skim of the other subject lines in this series.
Ian.
Re: [PATCH v5 02/14] libxenstore.so: add support for systemd
Quoted 16 lines · Ian Campbell
Quoted 5 lines · Ian Campbell
Quoted 5 lines
tools/xenstore/xs_systemd.c new file +5
-0+ +/* +* We list stdin, stdout and stderr simply for documentation purposes +* and to help our array size fit the number of expected sockets we +* as sd_listen_fds() will return 5 for example if you set the socket Quoted 8 lines
Quoted 1 line
+ * service with 2 sockets.
Please can we get rid of this list (which is bad enough in itself but the three spurious entries are ludicrous) and just
#defineSOCKET_RW_INDEXSD_LISTEN_FDS_START
#defineSOCKET_RO_INDEXSDL_LISTEN_FDS_START+ 1
etc and use those for lookups, as I described in <[email protected]>?
Quoted 3 lines
Also I thought that we decided that the mapping from the indexes here to the functionality need to be documented as well, I'm not seeing that, at least not based on a skim of the other subject lines in this series.
I didn't like the #define approach so wanted to pitch it again under new usage, I'll be sure to add something once a final approach is decided.
Please note that another reason for tucking things away under a list and library was to *eventually* remove the different definitions of these socket's paths. That code is already split up but can be brought together under libxenstore and for the systemd case the list can be used to to do an O(1) lookup of the socket path in the list. If we use just #defines we would just be adding more #defines for other things other than the file descriptor for systemd, we'd have it also for mode, and paths. The list therefore seemed more attractive.
Let me know.
Luis
Re: [PATCH v5 02/14] libxenstore.so: add support for systemd
Quoted 17 lines · Luis R. Rodriguez
Quoted 16 lines · Ian Campbell
Quoted 13 lines · Ian Campbell
tools/xenstore/xs_systemd.c line 169
Quoted 6 lines
tools/xenstore/xs_systemd.c new file +6
-0+ +/* +* We list stdin, stdout and stderr simply for documentation purposes +* and to help our array size fit the number of expected sockets we +* as sd_listen_fds() will return 5 for example if you set the socket +* service with 2 sockets. Please can we get rid of this list (which is bad enough in itself but the three spurious entries are ludicrous) and just
#defineSOCKET_RW_INDEXSD_LISTEN_FDS_START
#defineSOCKET_RO_INDEXSDL_LISTEN_FDS_START+ 1
etc and use those for lookups, as I described in <[email protected]>?
Quoted 5 lines
Quoted 3 lines
Also I thought that we decided that the mapping from the indexes here to the functionality need to be documented as well, I'm not seeing that, at least not based on a skim of the other subject lines in this series.
I didn't like the #define approach
The indexes are into the systemd provided environment variable of the fds which it has produced for us. It *must* be documented what xenstored's expectations are wrt what is in that array. Non optional and completely orthogonal to the use of #defines or anything else.
Quoted 8 lines
so wanted to pitch it again under
new usage, I'll be sure to add something once a final approach is decided.Please note that another reason for tucking things away under a list and library was to *eventually* remove the different definitions of these socket's paths.
Quoted 6 lines
That code is already split up but can be brought
together under libxenstore and for the systemd case the list can be used to to do an O(1) lookup of the socket path in the list. If we use just #defines we would just be adding more #defines for other things other than the file descriptor for systemd, we'd have it also for mode, and paths. The list therefore seemed more attractive.
I'm afraid non of this makes any sense to me.
If this mad list of paths and indexes scheme is The Systemd Way then please provide references. Otherwise:
systemd case:
int get_handle(int index)
{
return sd_listen_fds(index);
}no extra uses of the path or need for #defines for modes or anything like that.
non-systemd case:
switch(index)
case SOCKET_WR_INDEX:
open /var/run/xensotred/socket by whatever means.
Ian.
Re: [PATCH v5 02/14] libxenstore.so: add support for systemd
Quoted 22 lines · Ian Campbell
Quoted 21 lines · Luis R. Rodriguez
Quoted 19 lines · Ian Campbell
Quoted 5 lines · Ian Campbell
Quoted 5 lines
tools/xenstore/xs_systemd.c new file +5
-0+ +/* +* We list stdin, stdout and stderr simply for documentation purposes +* and to help our array size fit the number of expected sockets we +* as sd_listen_fds() will return 5 for example if you set the socket Quoted 8 lines
Quoted 1 line
+ * service with 2 sockets.
Please can we get rid of this list (which is bad enough in itself but the three spurious entries are ludicrous) and just
#defineSOCKET_RW_INDEXSD_LISTEN_FDS_START
#defineSOCKET_RO_INDEXSDL_LISTEN_FDS_START+ 1
etc and use those for lookups, as I described in <[email protected]>?Also I thought that we decided that the mapping from the indexes here to the functionality need to be documented as well, I'm not seeing that, at least not based on a skim of the other subject lines in this series.
Quoted 6 lines
Quoted 1 line
I didn't like the #define approach
The indexes are into the systemd provided environment variable of the fds which it has produced for us. It *must* be documented what xenstored's expectations are wrt what is in that array. Non optional and completely orthogonal to the use of #defines or anything else.
Sure.
Quoted 17 lines
Quoted 8 lines
so wanted to pitch it again under
new usage, I'll be sure to add something once a final approach is decided.Please note that another reason for tucking things away under a list and library was to *eventually* remove the different definitions of these socket's paths.
Quoted 6 lines
That code is already split up but can be brought
together under libxenstore and for the systemd case the list can be used to to do an O(1) lookup of the socket path in the list. If we use just #defines we would just be adding more #defines for other things other than the file descriptor for systemd, we'd have it also for mode, and paths. The list therefore seemed more attractive.I'm afraid non of this makes any sense to me.
Quoted 8 lines
If this mad list of paths and indexes scheme is The Systemd Way then please provide references. Otherwise:
systemd case:
int get_handle(int index) { return sd_listen_fds(index);
That's not the way to use sd_listen_fds(). More on this below.
Quoted 9 lines
}no extra uses of the path or need for #defines for modes or anything like that.
non-systemd case:
switch(index)
caseSOCKET_WR_INDEX:
open/var/run/xensotred/socketby whatever means.
The struct I defined is not something part of systemd, in fact there are not many example codes out there that use multiple sockets but the approach to use multiple sockets is to actually only call sd_listen_fds() once. That returns the list of sockets that systemd was configured through service units that process should have, systemd would have activated them for us, we just then carry them over. We do sanity checks with the number returned, so if we expected systemd to have set up 2 sockets for us we should check for that number and then *additionally* systemd *does* recommend that we validate the type of socket is what we expected and hence the usage of sd_is_socket_unix(). The arguments for sd_is_socket_unix() is what I set up in a struct mapped by the path. This is what xs_claim_active_socket() ends up doing for us.
Luis
Re: [PATCH v5 02/14] libxenstore.so: add support for systemd
Quoted 70 lines · Luis R. Rodriguez
Quoted 22 lines · Ian Campbell
Quoted 21 lines · Luis R. Rodriguez
Quoted 19 lines · Ian Campbell
Quoted 5 lines · Ian Campbell
Quoted 5 lines
tools/xenstore/xs_systemd.c new file +5
-0+ +/* +* We list stdin, stdout and stderr simply for documentation purposes +* and to help our array size fit the number of expected sockets we +* as sd_listen_fds() will return 5 for example if you set the socket Quoted 8 lines
Quoted 1 line
+ * service with 2 sockets.
Please can we get rid of this list (which is bad enough in itself but the three spurious entries are ludicrous) and just
#defineSOCKET_RW_INDEXSD_LISTEN_FDS_START
#defineSOCKET_RO_INDEXSDL_LISTEN_FDS_START+ 1
etc and use those for lookups, as I described in <[email protected]>?Also I thought that we decided that the mapping from the indexes here to the functionality need to be documented as well, I'm not seeing that, at least not based on a skim of the other subject lines in this series.
Quoted 6 lines
Quoted 1 line
I didn't like the #define approach
The indexes are into the systemd provided environment variable of the fds which it has produced for us. It *must* be documented what xenstored's expectations are wrt what is in that array. Non optional and completely orthogonal to the use of #defines or anything else.
Sure.
Quoted 17 lines
Quoted 8 lines
so wanted to pitch it again under
new usage, I'll be sure to add something once a final approach is decided.Please note that another reason for tucking things away under a list and library was to *eventually* remove the different definitions of these socket's paths.
Quoted 6 lines
That code is already split up but can be brought
together under libxenstore and for the systemd case the list can be used to to do an O(1) lookup of the socket path in the list. If we use just #defines we would just be adding more #defines for other things other than the file descriptor for systemd, we'd have it also for mode, and paths. The list therefore seemed more attractive.I'm afraid non of this makes any sense to me.
Quoted 8 lines
If this mad list of paths and indexes scheme is The Systemd Way then please provide references. Otherwise:
systemd case:
int get_handle(int index) { return sd_listen_fds(index);That's not the way to use
sd_listen_fds(). More on this below.Quoted 9 lines
}no extra uses of the path or need for #defines for modes or anything like that.
non-systemd case:
switch(index)
caseSOCKET_WR_INDEX:
open/var/run/xensotred/socketby whatever means.
Quoted 4 lines
The struct I defined is not something part of systemd, in fact there are not many example codes out there that use multiple sockets but the approach to use multiple sockets is to actually only call
sd_listen_fds()once.
OK, so fds = sd_listen_fds() once then return fds[index] above instead (modulo the checks you want to do).
Quoted 9 lines
That returns the list of sockets that systemd was configured through
service units that process should have, systemd would have activated them for us, we just then carry them over. We do sanity checks with the number returned, so if we expected systemd to have set up 2 sockets for us we should check for that number and then *additionally* systemd *does* recommend that we validate the type of socket is what we expected and hence the usage ofsd_is_socket_unix(). The arguments forsd_is_socket_unix()is what I set up in a struct mapped by the path. This is whatxs_claim_active_socket()ends up doing for us.
Passing a NULL path to sd_is_socket_unix() is valid though, which means you don't need the path in two places (the unit file and here). The length and listening should both always be 0, so you don't need those either. The mode for chmod seems strange to me, does systemd not let you configure that? In any case a table lookup for that one thing seems like overkill to me, you could put it in the switch for instance.
Ian.
Re: [PATCH v5 02/14] libxenstore.so: add support for systemd
Quoted 8 lines · Ian Campbell
Quoted 4 lines · Luis R. Rodriguez
The struct I defined is not something part of systemd, in fact there are not many example codes out there that use multiple sockets but the approach to use multiple sockets is to actually only call
sd_listen_fds()once.OK, so fds =
sd_listen_fds()once then return fds[index] above instead (modulo the checks you want to do).
Now we're talking. Yes. Brilliant.
Quoted 11 lines
Quoted 7 lines
for us, we just then carry them over. We do sanity checks with the number returned, so if we expected systemd to have set up 2 sockets for us we should check for that number and then *additionally* systemd *does* recommend that we validate the type of socket is what we expected and hence the usage of
sd_is_socket_unix(). The arguments forsd_is_socket_unix()is what I set up in a struct mapped by the path. This is whatxs_claim_active_socket()ends up doing for us.Passing a NULL path to
sd_is_socket_unix()is valid though, which means you don't need the path in two places (the unit file and here). The length and listening should both always be 0,
Actually in practice it seems listening is 1 as I guess systemd listens on the socket before hand. I tested this with const data and it doesn't matter what socket I try to activate, only 1 yields correct and expected results. The fields that have 0 -- I am not sure if we can ignore those, in kernel land you can as the stack sets data to 0, but in userspace I'm afraid that is not true unless you memset 0.
Quoted 3 lines
so you don't need those
either. The mode for chmod seems strange to me, does systemd not let you configure that?
Only one mode is allowed, I tried all combinations and no, it only allows one single mode for all, which means we have to set a single restrictive mode first and then once the sockets are claimed we do what we need and chmod().
Quoted 2 lines
In any case a table lookup for that one thing seems like
overkill to me, you could put it in the switch for instance.
Whatever works. I think you get what is needed now though. I actualy don't think a const table is bad, in fact I think it saves space, makes things cleaner, and clear. I'll do the switch though.
Luis
Re: [PATCH v5 02/14] libxenstore.so: add support for systemd
In reply to Ian CampbellQuoted 15 lines · Ian Campbell
Quoted 7 lines · Luis R. Rodriguez
From: "Luis R. Rodriguez" <[email protected]>
This adds support for systemd into libxenstore.so to enable usage through cxenstored and oxenstored. The way we provide support for systemd is to *not* compile systemd with -lsystemd-daemon but instead to look for libsystemd-daemon.so at run time if the binary was compiled with support for systemd.
This is not what either Ian or I intended to suggest. It is perfectly fine for the binary to be dynamically linked against -lsystemd-daemon in the normal way (and for the resulting binary packages to depend on the libsystemd-daemon package etc) if the headers etc are present at compile time.
Quoted 3 lines
What we were after was for the actual use of systemd to be runtime not compile time. IOW it is fine for xenstored to require the library to be installed, but not that systemd be the init which is in use.
In order to work dynamically *and* automatically at run time, that is to let the binary figure out what is best, the dynamic linker was the best choice. The reason is that we have to consider a binary that can run on systems that do not have the systemd libraries present, or that have them but didn't use sytemd as the init process. This solution covers all those cases.
Quoted 16 lines
tools/xenstore/xs_systemd.c line 169
Quoted 12 lines
tools/xenstore/xs_systemd.c new file +6
-0+ +/* +* We list stdin, stdout and stderr simply for documentation purposes +* and to help our array size fit the number of expected sockets we +* as sd_listen_fds() will return 5 for example if you set the socket +* service with 2 sockets. Please can we get rid of this list (which is bad enough in itself but the three spurious entries are ludicrous)
Quoted 5 lines
and just
#defineSOCKET_RW_INDEXSD_LISTEN_FDS_START#defineSOCKET_RO_INDEXSDL_LISTEN_FDS_START+ 1 etc and use those for lookups, as I described in <[email protected]>?
Did you see the mode? Its an example of how different preferences can be tucked away under it, but we can always statically peg associations. The purpose of the list was also to allow a switch on the type to alternate on sd_is_socket_*() calls but of course if we're not growing the xenstore implementation this means we only have to deal with one type and can use that statically.
Up to you, just consider the above and let me know.
Luis
Re: [PATCH v5 02/14] libxenstore.so: add support for systemd
Quoted 16 lines · Luis R. Rodriguez
Quoted 15 lines · Ian Campbell
Quoted 7 lines · Luis R. Rodriguez
From: "Luis R. Rodriguez" <[email protected]>
This adds support for systemd into libxenstore.so to enable usage through cxenstored and oxenstored. The way we provide support for systemd is to *not* compile systemd with -lsystemd-daemon but instead to look for libsystemd-daemon.so at run time if the binary was compiled with support for systemd.
This is not what either Ian or I intended to suggest. It is perfectly fine for the binary to be dynamically linked against -lsystemd-daemon in the normal way (and for the resulting binary packages to depend on the libsystemd-daemon package etc) if the headers etc are present at compile time.
Quoted 8 lines
Quoted 3 lines
What we were after was for the actual use of systemd to be runtime not compile time. IOW it is fine for xenstored to require the library to be installed, but not that systemd be the init which is in use.
In order to work dynamically *and* automatically at run time, that is to let the binary figure out what is best, the dynamic linker was the best choice. The reason is that we have to consider a binary that can run on systems that do not have the systemd libraries present,
This is not a requirement. If the systemd libraries were present at build time then it is acceptable to require them at runtime even if systemd is not actually in use. (Of course other than he "is_systemd_being_used" function nothing in the library really ought to get called in this case)
Quoted 1 line
or that have them but didn't use sytemd as the init process.
That case must work but if it required dlopen then something is horribly broken somewhere.
Quoted 19 lines
This solution
covers all those cases.Quoted 16 lines
tools/xenstore/xs_systemd.c line 169
Quoted 12 lines
tools/xenstore/xs_systemd.c new file +6
-0+ +/* +* We list stdin, stdout and stderr simply for documentation purposes +* and to help our array size fit the number of expected sockets we +* as sd_listen_fds() will return 5 for example if you set the socket +* service with 2 sockets. Please can we get rid of this list (which is bad enough in itself but the three spurious entries are ludicrous)
Quoted 8 lines
Quoted 5 lines
and just
#defineSOCKET_RW_INDEXSD_LISTEN_FDS_START#defineSOCKET_RO_INDEXSDL_LISTEN_FDS_START+ 1 etc and use those for lookups, as I described in <[email protected]>?Did you see the mode? Its an example of how different preferences can be tucked away under it, but we can always statically peg associations.
I have no idea what you are trying to ask/say here...
Quoted 4 lines
The purpose of the list was also to allow a switch on the type to alternate on sd_is_socket_*() calls but of course if we're not growing the xenstore implementation this means we only have to deal with one type and can use that statically.
...or here.
If socket activation is enabled then both of the things we are passed should be unix domain sockets so I don't understand why you would need to "alternate" on anything there either. And if a new thing were added to the list then its index would imply that it was whatever type it must be, because you'd have written it in the spec.
Quoted 1 line
Up to you, just consider the above and let me know.
The list should go.
Ian.
Re: [PATCH v5 02/14] libxenstore.so: add support for systemd
Quoted 26 lines · Ian Campbell
Quoted 16 lines · Luis R. Rodriguez
Quoted 15 lines · Ian Campbell
Quoted 7 lines · Luis R. Rodriguez
From: "Luis R. Rodriguez" <[email protected]>
This adds support for systemd into libxenstore.so to enable usage through cxenstored and oxenstored. The way we provide support for systemd is to *not* compile systemd with -lsystemd-daemon but instead to look for libsystemd-daemon.so at run time if the binary was compiled with support for systemd.
This is not what either Ian or I intended to suggest. It is perfectly fine for the binary to be dynamically linked against -lsystemd-daemon in the normal way (and for the resulting binary packages to depend on the libsystemd-daemon package etc) if the headers etc are present at compile time.
Quoted 8 lines
Quoted 3 lines
What we were after was for the actual use of systemd to be runtime not compile time. IOW it is fine for xenstored to require the library to be installed, but not that systemd be the init which is in use.
In order to work dynamically *and* automatically at run time, that is to let the binary figure out what is best, the dynamic linker was the best choice. The reason is that we have to consider a binary that can run on systems that do not have the systemd libraries present,
Quoted 5 lines
This is not a requirement. If the systemd libraries were present at build time then it is acceptable to require them at runtime even if systemd is not actually in use. (Of course other than he "
is_systemd_being_used" function nothing in the library really ought to get called in this case)
It was not clear that this was not a requirement and hence the use of dlopen() and dlsym(). Now that that work is done though up to you guys to decide what you want, this option works now, I've tested it, so just let me know.
I believe the existing use integration provides the most flexibility.
Quoted 4 lines
Quoted 1 line
or that have them but didn't use sytemd as the init process.
That case must work but if it required dlopen then something is horribly broken somewhere.
If a requirement was not to produce binaries to work on non systemd systems then yes, otherwise no.
Quoted 25 lines
Quoted 25 lines
This solution
covers all those cases.Quoted 21 lines
tools/xenstore/xs_systemd.c line 169
Quoted 12 lines
tools/xenstore/xs_systemd.c new file +6
-0+ +/* +* We list stdin, stdout and stderr simply for documentation purposes +* and to help our array size fit the number of expected sockets we +* as sd_listen_fds() will return 5 for example if you set the socket +* service with 2 sockets. Please can we get rid of this list (which is bad enough in itself but the three spurious entries are ludicrous)
and just
#defineSOCKET_RW_INDEXSD_LISTEN_FDS_START#defineSOCKET_RO_INDEXSDL_LISTEN_FDS_START+ 1 etc and use those for lookups, as I described in <[email protected]>?
Quoted 4 lines
Quoted 2 lines
Did you see the mode? Its an example of how different preferences can be tucked away under it, but we can always statically peg associations.
I have no idea what you are trying to ask/say here...
There are seval uses of the structure I defined, one is the making it easier to call sd_is_socket_unix() with already prepared data, the other use case is to chmod() the socket on the path given that while systemd service unit files does support specifying permissions on the sockets its a wide set permission setting, so changes between permissions must be handled manually right now. See the use of chmod on xs_claim_active_socket() Its another example of the use of the structure format I laid out instead of defines.
Quoted 9 lines
Quoted 4 lines
The purpose of the list was also to allow a switch on the type to alternate on sd_is_socket_*() calls but of course if we're not growing the xenstore implementation this means we only have to deal with one type and can use that statically.
...or here.
If socket activation is enabled then both of the things we are passed should be unix domain sockets
It doesn't matter, systemd documentation recommends for a sanity check on the type of socket given back to us by systemd, and hance the use of sd_is_socket_unix().
Quoted 2 lines
so I don't understand why you would need
to "alternate" on anything there either.
What I mean by alternating on different sd_is_socket_*() calls is if we were to grow xenstored with different type of sockets and make the code a bit more dynamic. In such case we'd just throw a switch on the active_socket->type and call the appropriate sd_is_socket_*().
Quoted 3 lines
And if a new thing were added
to the list then its index would imply that it was whatever type it must be, because you'd have written it in the spec.
Even so you are still recommended to call sd_is_socket_*() for the type of expected socket. What I did tries to make the code easier to grow and manage.
Quoted 3 lines
Quoted 1 line
Up to you, just consider the above and let me know.
The list should go.
OK...
Luis
Re: [PATCH v5 02/14] libxenstore.so: add support for systemd
Quoted 33 lines · Luis R. Rodriguez
Quoted 26 lines · Ian Campbell
Quoted 16 lines · Luis R. Rodriguez
Quoted 15 lines · Ian Campbell
Quoted 7 lines · Luis R. Rodriguez
From: "Luis R. Rodriguez" <[email protected]>
This adds support for systemd into libxenstore.so to enable usage through cxenstored and oxenstored. The way we provide support for systemd is to *not* compile systemd with -lsystemd-daemon but instead to look for libsystemd-daemon.so at run time if the binary was compiled with support for systemd.
This is not what either Ian or I intended to suggest. It is perfectly fine for the binary to be dynamically linked against -lsystemd-daemon in the normal way (and for the resulting binary packages to depend on the libsystemd-daemon package etc) if the headers etc are present at compile time.
Quoted 8 lines
Quoted 3 lines
What we were after was for the actual use of systemd to be runtime not compile time. IOW it is fine for xenstored to require the library to be installed, but not that systemd be the init which is in use.
In order to work dynamically *and* automatically at run time, that is to let the binary figure out what is best, the dynamic linker was the best choice. The reason is that we have to consider a binary that can run on systems that do not have the systemd libraries present,
Quoted 5 lines
This is not a requirement. If the systemd libraries were present at build time then it is acceptable to require them at runtime even if systemd is not actually in use. (Of course other than he "
is_systemd_being_used" function nothing in the library really ought to get called in this case)
Quoted 6 lines
It was not clear that this was not a requirement and hence the use of
dlopen()anddlsym(). Now that that work is done though up to you guys to decide what you want, this option works now, I've tested it, so just let me know.I believe the existing use integration provides the most flexibility.
Please drop dlopen and just link against the libraries.
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
Did you see the mode? Its an example of how different preferences can be tucked away under it, but we can always statically peg associations.
I have no idea what you are trying to ask/say here...
There are seval uses of the structure I defined, one is the making it easier to call
sd_is_socket_unix()with already prepared data,
Practically all the arguments to which are static in this case though. (Once you ignore the totally useless stdio entries)
Quoted 5 lines
the other
use case is tochmod()the socket on the path given that while systemd service unit files does support specifying permissions on the sockets its a wide set permission setting, so changes between permissions must be handled manually right now. See the use of chmod onxs_claim_active_socket()
I don't think you need a table just to select between 0600 and 0660 out of a choice of two sockets. At most a switch is needed, even an if would do for now.
Quoted 7 lines
Quoted 2 lines
so I don't understand why you would need
to "alternate" on anything there either.What I mean by alternating on different sd_is_socket_*() calls is if we were to grow xenstored with different type of sockets and make the code a bit more dynamic. In such case we'd just throw a switch on the
active_socket->typeand call the appropriate sd_is_socket_*().
No we wouldn't, we'd throw a switch over the index into the lookup function and handle it there.
Ian.
Re: [PATCH v5 02/14] libxenstore.so: add support for systemd
Quoted 2 lines · Ian Campbell
No we wouldn't, we'd throw a switch over the index into the lookup function and handle it there.
Switch it is.
Luis.
PATCH v5 3/14 cxenstored: add support for systemd active sockets
In reply to Luis R. RodriguezFrom: "Luis R. Rodriguez" <[email protected]>
This adds systemd socket activation support for the C xenstored. Active sockets enable xenstored to be loaded only if required by a system onto which Xen is installed on. Socket activation is handled by systemd, once a port for a service which claims a socket is used systemd will start the required services for it, on demand. For more details on socket activation refer to Lennart's socket-activation post regarding this [0].
Right now this code adds a no-op for this functionality, leaving the enablement to be done later once systemd is properly hooked into the build system. The socket activation is ordered in aligment with the socket activation order passed on to systemd.
[0] http://0pointer.de/blog/projects/socket-activation2.html
--- tools/xenstore/xenstored_core.c | 49 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-)
tools/xenstore/xenstored_core.c +48 -1
@@ -40,10 +40,12 @@#include <signal.h> #include <assert.h> #include <setjmp.h> +#include <config.h> #include "utils.h" #include "list.h" #include "talloc.h" +#include "xenstore.h" #include "xenstore_lib.h" #include "xenstored_core.h" #include "xenstored_watch.h"
@@ -1706,6 +1708,11 @@ static void init_sockets(int **psock, int **pro_sock)static int minus_one =-1 ; *psock = *pro_sock = &minus_one; } +static void xen_claim_active_sockets (struct xs_sd_ctx *ctx,int **psock,int **pro_sock) +{ +static int minus_one =-1 ; + *psock = *pro_sock = &minus_one; +}#else static int destroy_fd (void *_fd) {
@@ -1714,6 +1721,26 @@ static int destroy_fd(void *_fd)return 0 ; } +static void xen_claim_active_sockets (struct xs_sd_ctx *ctx,int **psock,int **pro_sock) +{ +int *sock, *ro_sock; +const char *soc_str =xs_daemon_socket (); +const char *soc_str_ro =xs_daemon_socket_ro (); + + *psock = sock =talloc (talloc_autofree_context (), int); + *sock =xs_claim_active_socket (ctx, soc_str); +if (*sock <=0 ) +barf_perror ("%s" , soc_str); + + *pro_sock = ro_sock =talloc (talloc_autofree_context (), int); + *ro_sock =xs_claim_active_socket (ctx, soc_str_ro); +if (*ro_sock <=0 ) +barf_perror ("%s" , soc_str_ro); + +talloc_set_destructor (sock, destroy_fd); +talloc_set_destructor (ro_sock, destroy_fd); +} +static void init_sockets (int **psock,int **pro_sock) {struct sockaddr_un addr;
@@ -1822,8 +1849,10 @@ int main(int argc, char *argv[])bool dofork = true;bool outputpid = false;bool no_domain_init = false; +bool sd_booted = false;const char *pidfile =NULL ;int timeout; +struct xs_sd_ctx *ctx;while ((opt =getopt_long (argc, argv,"DE:F:HNPS:t:T:RLVW:" , options,NULL )) !=-1 ) {
@@ -1884,6 +1913,16 @@ int main(int argc, char *argv[])if (optind != argc)barf ("%s: No arguments desired" , argv[0 ]); + ctx =xs_get_sd_ctx (); +/* xs_sd_ctx can be NULL and that's OK */ +if (xs_load_sd_required (ctx)) { + sd_booted = true; + dofork = false; +if (pidfile) +barf ("%s: PID file not needed on systemd" , argv[0 ]); + pidfile =NULL ; + } +reopen_log ();/* make sure xenstored directories exist */
@@ -1905,7 +1944,11 @@ int main(int argc, char *argv[])/* Don't kill us with SIGPIPE. */ signal (SIGPIPE ,SIG_IGN ); -init_sockets (&sock, &ro_sock); +if (sd_booted) +xen_claim_active_sockets (ctx, &sock, &ro_sock); +else +init_sockets (&sock, &ro_sock); +init_pipe (reopen_log_pipe);/* Setup the database */
@@ -1936,6 +1979,9 @@ int main(int argc, char *argv[])/* Tell the kernel we're up and running. */ xenbus_notify_running (); +if (sd_booted) +xs_sd_notify_ready (ctx); +/* Main loop. */ for (;;) {struct connection *conn, *next;
@@ -2047,6 +2093,7 @@ int main(int argc, char *argv[])initialize_fds (*sock, &sock_pollfd_idx, *ro_sock, &ro_sock_pollfd_idx, &timeout); } +xs_free_sd_ctx (ctx); }/*
Signature · 1 line
2.0.0.rc3.18.g00a5b79
PATCH v5 4/14 oxenstored: add support for systemd active sockets
In reply to Luis R. RodriguezFrom: "Luis R. Rodriguez" <[email protected]>
This adds systemd socket activation support for the Ocaml xenstored. Ocaml lacks systemd library support so we provide our own C helpers as is done with other functionality lacking on Ocaml.
Active sockets enables oxenstored to be loaded only if required by a system onto which Xen is installed on. Socket activation is handled by systemd, once a port for a service which claims a socket is used systemd will start the required services for it, on demand. For more details on socket activation refer to Lennart's socket-activation post regarding this [0].
An important difference with socket activation is that systemd will set FD_CLOEXEC for us on the socket before giving it to us, we'll sprinkly the Unix.set_close_on_exec for LSB init next as a separate commit.
Right now this code adds a no-op for this functionality, leaving the enablement to be done later once systemd is properly hooked into the build system. The socket activation is ordered in aligment with the socket activation order passed on to systemd.
[0] http://0pointer.de/blog/projects/socket-activation2.html
--- tools/ocaml/xenstored/Makefile | 11 ++- tools/ocaml/xenstored/systemd.ml | 17 +++++ tools/ocaml/xenstored/systemd.mli | 24 +++++++ tools/ocaml/xenstored/systemd_stubs.c | 132 ++++++++++++++++++++++++++++++++++ tools/ocaml/xenstored/utils.ml | 20 ++++-- tools/ocaml/xenstored/xenstored.ml | 2 + 6 files changed, 198 insertions(+), 8 deletions(-) create mode 100644 tools/ocaml/xenstored/systemd.ml create mode 100644 tools/ocaml/xenstored/systemd.mli create mode 100644 tools/ocaml/xenstored/systemd_stubs.c
tools/ocaml/xenstored/Makefile +10 -1
@@ -15,6 +15,14 @@ syslog_OBJS = syslog syslog_C_OBJS = syslog_stubs OCAML_LIBRARY = syslog +LDFLAGS += $(LDLIBS_libxenstore) +CFLAGS += $(CFLAGS_libxenstore) + +LIBS += systemd.cma systemd.cmxa +systemd_OBJS = systemd +systemd_C_OBJS = systemd_stubs +OCAML_LIBRARY += systemd + OBJS = define \ stdext \ trie \
@@ -36,11 +44,12 @@ OBJS = define \ process \ xenstored -INTF = symbol.cmi trie.cmi syslog.cmi +INTF = symbol.cmi trie.cmi syslog.cmi systemd.cmi XENSTOREDLIBS = \ unix.cmxa \ -ccopt -L -ccopt . syslog.cmxa \ + -ccopt -L -ccopt . systemd.cmxa \ -ccopt -L -ccopt $(OCAML_TOPLEVEL)/libs/mmap $(OCAML_TOPLEVEL)/libs/mmap/xenmmap.cmxa \ -ccopt -L -ccopt $(OCAML_TOPLEVEL)/libs/eventchn $(OCAML_TOPLEVEL)/libs/eventchn/xeneventchn.cmxa \ -ccopt -L -ccopt $(OCAML_TOPLEVEL)/libs/xc $(OCAML_TOPLEVEL)/libs/xc/xenctrl.cmxa \
tools/ocaml/xenstored/systemd.ml new file +17 -0
@@ -0,0 +1,17 @@ +(* + * Copyright (C) 2014 Luis R. Rodriguez <[email protected]> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation; version 2.1 only. with the special + * exception on linking described in file LICENSE. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + *) + +external sd_listen_fds: string -> Unix.file_descr = "ocaml_sd_listen_fds" +external sd_active_socket_required: unit -> bool = "ocaml_sd_active_socket_required" +external sd_notify_ready: unit -> unit = "ocaml_sd_notify_ready"
tools/ocaml/xenstored/systemd.mli new file +24 -0
@@ -0,0 +1,24 @@ +(* + * Copyright (C) 2014 Luis R. Rodriguez <[email protected]> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation; version 2.1 only. with the special + * exception on linking described in file LICENSE. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + *) + +(** Calls the C library sd_listen_fds() function for us. Although + * the library doesn't accept argument we send one over to help + * us do sanity checks on the expected sockets *) +val sd_listen_fds: string -> Unix.file_descr + +(** Tells us whether or not systemd support was compiled in *) +val sd_active_socket_required: unit -> bool + +(** Tells systemd we're ready *) +external sd_notify_ready: unit -> unit = "ocaml_sd_notify_ready"
tools/ocaml/xenstored/systemd_stubs.c new file +132 -0
132 lines not on this page · raw message
tools/ocaml/xenstored/utils.ml +13 -7
@@ -73,14 +73,20 @@ let trim_path path = let join_by_null ls = String.concat "\000" ls (* unix utils *) +let create_regular_unix_socket name = + Unixext.unlink_safe name; + Unixext.mkdir_rec (Filename.dirname name) 0o700; + let sockaddr = Unix.ADDR_UNIX(name) in + let sock = Unix.socket Unix.PF_UNIX Unix.SOCK_STREAM 0 in + Unix.bind sock sockaddr; + Unix.listen sock 1; + sock + let create_unix_socket name = - Unixext.unlink_safe name; - Unixext.mkdir_rec (Filename.dirname name) 0o700; - let sockaddr = Unix.ADDR_UNIX(name) in - let sock = Unix.socket Unix.PF_UNIX Unix.SOCK_STREAM 0 in - Unix.bind sock sockaddr; - Unix.listen sock 1; - sock + if Systemd.sd_active_socket_required() then + Systemd.sd_listen_fds name + else + create_regular_unix_socket name let read_file_single_integer filename = let fd = Unix.openfile filename [ Unix.O_RDONLY ] 0o640 in
tools/ocaml/xenstored/xenstored.ml +2 -0
@@ -383,6 +383,8 @@ let _ = while not !quit do try + if Systemd.sd_active_socket_required() then + Systemd.sd_notify_ready (); main_loop () with exc -> error "caught exception %s" (Printexc.to_string exc);
Signature · 1 line
2.0.0.rc3.18.g00a5b79
PATCH v5 5/14 oxenstored: force FD_CLOEXEC with Unix.set_close_on_exec on LSB init
In reply to Luis R. RodriguezFrom: "Luis R. Rodriguez" <[email protected]>
Lets match the systemd active socket activation implementation and ensure that FD_CLOEXEC is set by usin Unix.set_close_on_exec. David notes oxenstored likely does not exec but there is no harm in being careful just in case things change in the future.
--- tools/ocaml/xenstored/utils.ml | 1 + 1 file changed, 1 insertion(+)
tools/ocaml/xenstored/utils.ml +1 -0
@@ -78,6 +78,7 @@ let create_regular_unix_socket name = Unixext.mkdir_rec (Filename.dirname name) 0o700; let sockaddr = Unix.ADDR_UNIX(name) in let sock = Unix.socket Unix.PF_UNIX Unix.SOCK_STREAM 0 in + Unix.set_close_on_exec sock; Unix.bind sock sockaddr; Unix.listen sock 1; sock
Signature · 1 line
2.0.0.rc3.18.g00a5b79
PATCH v5 6/14 tools/xendomains: make xl the default
In reply to Luis R. RodriguezFrom: "Luis R. Rodriguez" <[email protected]>
If that fails backoff to using xm.
--- tools/hotplug/Linux/init.d/xendomains | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
tools/hotplug/Linux/init.d/xendomains +4 -4
@@ -29,13 +29,13 @@ . /etc/xen/scripts/hotplugpath.sh -CMD=${SBINDIR}/xm -HEADCOMP="LinuxGuestRecord" +CMD=${SBINDIR}/xl +HEADCOMP="Xen saved domain" $CMD list &> /dev/null if test $? -ne 0 then - CMD=${SBINDIR}/xl - HEADCOMP="Xen saved domain" + CMD=${SBINDIR}/xm + HEADCOMP="LinuxGuestRecord" fi $CMD list &> /dev/null
Signature · 7 lines
2.0.0.rc3.18.g00a5b79 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
Re: [PATCH v5 06/14] tools/xendomains: make xl the default
Quoted 3 lines · Luis R. Rodriguez
From: "Luis R. Rodriguez" <[email protected]>
If that fails backoff to using xm.
In <[email protected]> on v4 I said "Please fold it in to one patch to just forget about xm in one go." where it was a patch removing the now pointless xm fallback. I don't even see that patch in this series, let alone folded in here.
Ian.
Re: [PATCH v5 06/14] tools/xendomains: make xl the default
Quoted 9 lines · Ian Campbell
Quoted 3 lines · Luis R. Rodriguez
From: "Luis R. Rodriguez" <[email protected]>
If that fails backoff to using xm.
In <[email protected]> on v4 I said "Please fold it in to one patch to just forget about xm in one go." where it was a patch removing the now pointless xm fallback. I don't even see that patch in this series, let alone folded in here.
Dah, sorry, my laptop got hosed and I lost that patch. I merged that now.
Luis
PATCH v5 7/14 tools/xendomains: do space cleanups
In reply to Luis R. RodriguezFrom: "Luis R. Rodriguez" <[email protected]>
This has no functional changes. This is just to prepare the file to be moved, so you won't blind your eyes or get git am to complain.
--- tools/hotplug/Linux/init.d/xendomains | 62 +++++++++++++++++------------------ 1 file changed, 31 insertions(+), 31 deletions(-)
tools/hotplug/Linux/init.d/xendomains +31 -31
@@ -23,7 +23,7 @@ # Default-Start: 2 3 5 # Default-Stop: 0 1 6 # Short-Description: Start/stop secondary xen domains -# Description: Start / stop domains automatically when domain 0 +# Description: Start / stop domains automatically when domain 0 # boots / shuts down. ### END INIT INFO
@@ -44,7 +44,7 @@ then exit 0; fi -# Correct exit code would probably be 5, but it's enough +# Correct exit code would probably be 5, but it's enough # if xend complains if we're not running as privileged domain if ! [ -e /proc/xen/privcmd ]; then exit 0
@@ -74,7 +74,7 @@ test -r $XENDOM_CONFIG || { echo "$XENDOM_CONFIG not existing"; if test -e /etc/rc.status; then # SUSE rc script library . /etc/rc.status -else +else _cmd=$1 declare -a _SMSG if test "${_cmd}" = "status"; then
@@ -97,7 +97,7 @@ else fi } elif test -e /lib/lsb/init-functions; then - # LSB + # LSB . /lib/lsb/init-functions if alias log_success_msg >/dev/null 2>/dev/null; then echo_rc()
@@ -114,7 +114,7 @@ else fi } fi - else + else # emulate it echo_rc() {
@@ -124,17 +124,17 @@ else rc_reset() { _RC_RV=0; } rc_failed() { - if test -z "$1"; then + if test -z "$1"; then _RC_RV=1; - elif test "$1" != "0"; then - _RC_RV=$1; - fi + elif test "$1" != "0"; then + _RC_RV=$1; + fi return ${_RC_RV} } rc_check() { return rc_failed $? - } + } rc_status() { rc_failed $?
@@ -146,7 +146,7 @@ else return ${_RC_RV} } rc_exit() { exit ${_RC_RV}; } - rc_active() + rc_active() { if test -z "$RUNLEVEL"; then read RUNLEVEL REST < <(/sbin/runlevel); fi if test -e /etc/init.d/S[0-9][0-9]${1}; then return 0; fi
@@ -193,13 +193,13 @@ rdnames() { NAMES= if ! contains_something "$XENDOMAINS_AUTO" - then + then return fi for dom in $XENDOMAINS_AUTO/*; do rdname $dom - if test -z $NAMES; then - NAMES=$NM; + if test -z $NAMES; then + NAMES=$NM; else NAMES="$NAMES|$NM" fi
@@ -232,7 +232,7 @@ is_running() while read LN; do parseln "$LN" || continue if test $id = 0; then continue; fi - case $name in + case $name in ($NM) RC=0 ;;
@@ -241,11 +241,11 @@ is_running() return $RC } -start() +start() { - if [ -f $LOCKFILE ]; then + if [ -f $LOCKFILE ]; then echo -e "xendomains already running (lockfile exists)" - return; + return; fi saved_domains=" "
@@ -285,10 +285,10 @@ start() # XENDOMAINS_AUTO - they could just be symlinks to files elsewhere # Create all domains with config files in XENDOMAINS_AUTO. - # TODO: We should record which domain name belongs + # TODO: We should record which domain name belongs # so we have the option to selectively shut down / migrate later # If a domain statefile from $XENDOMAINS_SAVE matches a domain name - # in $XENDOMAINS_AUTO, do not try to start that domain; if it didn't + # in $XENDOMAINS_AUTO, do not try to start that domain; if it didn't # restore correctly it requires administrative attention. for dom in $XENDOMAINS_AUTO/*; do echo -n " ${dom##*/}"
@@ -349,14 +349,14 @@ watchdog_xencmd() read PSF PSUID PSPID PSPPID < <(echo "$PSAX") # kill $CMD $1 kill $PSPID >/dev/null 2>&1 - + echo -e . } stop() { exec 3>&2 2> /dev/null - + # Collect list of domains to shut down if test "$XENDOMAINS_AUTO_ONLY" = "true"; then rdnames
@@ -380,7 +380,7 @@ stop() esac " fi - # XENDOMAINS_SYSRQ chould be something like just "s" + # XENDOMAINS_SYSRQ chould be something like just "s" # or "s e i u" or even "s e s i u o" # for the latter, you should set XENDOMAINS_USLEEP to 1200000 or so if test -n "$XENDOMAINS_SYSRQ"; then
@@ -413,7 +413,7 @@ stop() kill $WDOG_PID >/dev/null 2>&1 else kill $WDOG_PID >/dev/null 2>&1 - + echo -e . usleep 1000 continue
@@ -472,7 +472,7 @@ stop() # Unconditionally delete lock file rm -f $LOCKFILE - + exec 2>&3 }
@@ -482,7 +482,7 @@ check_domain_up() while read LN; do parseln "$LN" || continue if test $id = 0; then continue; fi - case $name in + case $name in ($1) return 0 ;;
@@ -501,9 +501,9 @@ check_all_auto_domains_up() for nm in $XENDOMAINS_AUTO/*; do rdname $nm found=0 - if check_domain_up "$NM"; then + if check_domain_up "$NM"; then echo -n " $name" - else + else missing="$missing $NM" fi done
@@ -516,7 +516,7 @@ check_all_auto_domains_up() check_all_saved_domains_up() { - if ! contains_something "$XENDOMAINS_SAVE" + if ! contains_something "$XENDOMAINS_SAVE" then return 0 fi
@@ -563,8 +563,8 @@ case "$1" in ;; status) - echo -n "Checking for xendomains:" - if test ! -f $LOCKFILE; then + echo -n "Checking for xendomains:" + if test ! -f $LOCKFILE; then rc_failed 3 else check_all_auto_domains_up
Signature · 7 lines
2.0.0.rc3.18.g00a5b79 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
PATCH v5 8/14 tools/xendomains: move to libexec and use a smaller init helper
In reply to Luis R. RodriguezFrom: "Luis R. Rodriguez" <[email protected]>
The xendomains script can be reused with systemd systems as it does not control services or sockets per se, but does a one shot scrape of domUs it needs start bring up, stop, reload so we're going to reuse it. This moves the core of the script to libexec and leaves only a helper on init.
---
tools/hotplug/Linux/Makefile | 3 +
tools/hotplug/Linux/init.d/xendomains | 635 +++-------------------------
tools/hotplug/Linux/{init.d => }/xendomains | 0
3 files changed, 53 insertions(+), 585 deletions(-)
rewrite tools/hotplug/Linux/init.d/xendomains (95%)
rename tools/hotplug/Linux/{init.d => }/xendomains (100%)tools/hotplug/Linux/Makefile +3 -0
@@ -3,6 +3,7 @@ include $(XEN_ROOT)/tools/Rules.mk # Init scripts. XENDOMAINS_INITD = init.d/xendomains +XENDOMAINS_LIBEXEC = xendomains XENDOMAINS_SYSCONFIG = init.d/sysconfig.xendomains XENCOMMONS_INITD = init.d/xencommons
@@ -45,6 +46,8 @@ install: all install-initd install-scripts install-udev install-initd: [ -d $(DESTDIR)$(INITD_DIR) ] || $(INSTALL_DIR) $(DESTDIR)$(INITD_DIR) [ -d $(DESTDIR)$(SYSCONFIG_DIR) ] || $(INSTALL_DIR) $(DESTDIR)$(SYSCONFIG_DIR) + [ -d $(DESTDIR)$(LIBEXEC) ] || $(INSTALL_DIR) $(DESTDIR)$(LIBEXEC) + $(INSTALL_PROG) $(XENDOMAINS_LIBEXEC) $(DESTDIR)$(LIBEXEC) $(INSTALL_PROG) $(XENDOMAINS_INITD) $(DESTDIR)$(INITD_DIR) $(INSTALL_DATA) $(XENDOMAINS_SYSCONFIG) $(DESTDIR)$(SYSCONFIG_DIR)/xendomains $(INSTALL_PROG) $(XENCOMMONS_INITD) $(DESTDIR)$(INITD_DIR)
tools/hotplug/Linux/init.d/xendomains +50 -585
635 lines not on this page · raw message
tools/hotplug/Linux/xendomains renamed from tools/hotplug/Linux/init.d/xendomains +0 -0
Signature · 7 lines
2.0.0.rc3.18.g00a5b79 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
PATCH v5 9/14 autoconf: xen: force a refresh with autoconf
In reply to Luis R. RodriguezFrom: "Luis R. Rodriguez" <[email protected]>
With some new functionality introduced we can't keep around the old cache, but more specifically at times autogen.sh can produce inconsistent results without considering all files obsolete. The cost of considering all files obsolete is small so just force it.
--- autogen.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
autogen.sh +4 -4
@@ -1,12 +1,12 @@ #!/bin/sh -e -autoconf +autoconf -f ( cd tools - autoconf + autoconf -f autoheader ) ( cd stubdom - autoconf + autoconf -f ) ( cd docs - autoconf + autoconf -f )
Signature · 7 lines
2.0.0.rc3.18.g00a5b79 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
Re: [PATCH v5 09/14] autoconf: xen: force a refresh with autoconf
Quoted 7 lines · Luis R. Rodriguez
From: "Luis R. Rodriguez" <[email protected]>
With some new functionality introduced we can't keep around the old cache, but more specifically at times
autogen.shcan produce inconsistent results without considering all files obsolete. The cost of considering all files obsolete is small so just force it.
Quoted 7 lines
Cc Ian Campbell <[email protected]>Cc Ian Jackson <[email protected]>Cc Jan Beulich <[email protected]>Cc Keir Fraser <[email protected]>Cc Tim Deegan <[email protected]>Acked-by Roger Pau Monné <[email protected]>Signed-off-by Luis R. Rodriguez <[email protected]>
(we tend to order Cc, Ack, S-o-b in chronological order BTW, so your S-o-b, then CC'd, then {Acked,Reviewed,etc}-by in the order they come in)
Ian.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v5 09/14] autoconf: xen: force a refresh with autoconf
Quoted 16 lines · Ian Campbell
Quoted 7 lines · Luis R. Rodriguez
From: "Luis R. Rodriguez" <[email protected]>
With some new functionality introduced we can't keep around the old cache, but more specifically at times
autogen.shcan produce inconsistent results without considering all files obsolete. The cost of considering all files obsolete is small so just force it.Quoted 7 lines
Cc Ian Campbell <[email protected]>Cc Ian Jackson <[email protected]>Cc Jan Beulich <[email protected]>Cc Keir Fraser <[email protected]>Cc Tim Deegan <[email protected]>Acked-by Roger Pau Monné <[email protected]>Signed-off-by Luis R. Rodriguez <[email protected]>
Quoted 5 lines
Acked-by Ian Campbell <[email protected]>(we tend to order Cc, Ack, S-o-b in chronological order BTW, so your S-o-b, then CC'd, then {Acked,Reviewed,etc}-by in the order they come in)
OK.
Luis
PATCH v5 10/14 autoconf: update m4/pkg.m4
In reply to Luis R. RodriguezFrom: "Luis R. Rodriguez" <[email protected]>
The provenance of the m4 pkg.m4 macro library was not documented and it was not clear how and if we can update this without breaking things. Document where this comes from, update us to the latest release from git and put a warning about avoiding private evolutions so that instead things go upstream.
The pkg-config m4 macro library comes from the upstream pkg-config git repository [0]. If you update the m4 library update this file with provenance and last commit ID information. For documentation on how to use this read the pkg-config(1) man page.
Tree: git://anongit.freedesktop.org/pkg-config
The last synch was from commit:
commit 4f0084d9d3b8726a797a373c7ec5e406000995d0
Author: Dan Nicholson <[email protected]> Date: Mon Feb 3 15:59:18 2014 -0800
glib: Fix Makefiles to suppress warnings from automake
With the newly added glib.mk, some of the noinst_* variables need to use += in the evaluation to avoid multiple definition warnings from automake.
---
Please run ./autgen.sh after this patch is applied.
m4/README.source | 28 ++++++++++++++++++ m4/pkg.m4 | 88 ++++++++++++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 110 insertions(+), 6 deletions(-) create mode 100644 m4/README.source
m4/README.source new file +28 -0
@@ -0,0 +1,28 @@ +About +===== +This documents the upstream sources for the different slew of different +m4 sources we have picked up or developed. + +pkg.m4 +====== +The pkg-config m4 macro library comes from the upstream pkg-config +git repository [0]. If you update the m4 library update this file +with provenance and last commit ID information. For documentation +on how to use this read the pkg-config(1) man page. + +Do not modify this file yourself, if you want to evolve it send +patches upstream and then synch back here. + +Tree: git://anongit.freedesktop.org/pkg-config + +The last synch was from commit: + +commit 4f0084d9d3b8726a797a373c7ec5e406000995d0 +Author: Dan Nicholson <[email protected]> +Date: Mon Feb 3 15:59:18 2014 -0800 + + glib: Fix Makefiles to suppress warnings from automake + + With the newly added glib.mk, some of the noinst_* variables need to use + += in the evaluation to avoid multiple definition warnings from + automake.
m4/pkg.m4 +82 -6
122 lines not on this page · raw message
Signature · 1 line
2.0.0.rc3.18.g00a5b79
PATCH v5 11/14 autoconf: xen: move standard variables to a generic place
In reply to Luis R. RodriguezFrom: "Luis R. Rodriguez" <[email protected]>
This moves all generic variables to the top level makefile, tons of files use these so just make them general enough. This also paves the way to let us easily dynamically configure these with autoconf, for now we leave the same presets as was present before.
This work was prompted by looking for an autoconf way to do replacements for the hotplug global file, while at it I realized that a few other files use the same variables and have in places around the tree the same constructs for generating their own files. This replaces all that with a two central files, one for shell scripts and another for C header files. We should later optimize this further by only having one target file and generating the two needed from that.
Building the hypervisor and extras/mini-os without requiring configure is kept supported by providing a default configuration file with defaults that will be overwritten only if configure is used.
While at it lets add some documentation on the README and enable us to expand further details on the wiki [0].
[0] http://wiki.xen.org/wiki/Category:Host_Configuration#System_wide_xen_configuration
---
Please run ./autgen.sh after this patch is applied.
.gitignore | 2 ++ Config.mk | 13 --------- README | 16 ++++++++++ config/StdGNU.mk | 28 +++++++++--------- config/Toplevel.mk.in | 24 +++++++++++++++ config/defaults.mk | 21 ++++++++++++++ config/xen-environment-header.in | 13 +++++++++ config/xen-environment-scripts.in | 15 ++++++++++ configure.ac | 9 +++++- m4/expand_config.m4 | 61 +++++++++++++++++++++++++++++++++++++++ stubdom/Makefile | 17 ++++++----- stubdom/configure.ac | 3 ++ tools/configure.ac | 3 ++ tools/hotplug/common/Makefile | 6 ++-- tools/libxl/Makefile | 11 ++----- tools/python/Makefile | 6 ++-- 16 files changed, 198 insertions(+), 50 deletions(-) create mode 100644 config/defaults.mk create mode 100644 config/xen-environment-header.in create mode 100644 config/xen-environment-scripts.in create mode 100644 m4/expand_config.m4
.gitignore +2 -0
@@ -36,6 +36,8 @@ config.log config.status config.cache config/Toplevel.mk +config/xen-environment-scripts +config/xen-environment-header build-* dist/*
Config.mk +0 -13
@@ -166,19 +166,6 @@ define move-if-changed if ! cmp -s $(1) $(2); then mv -f $(1) $(2); else rm -f $(1); fi endef -buildmakevars2file = $(eval $(call buildmakevars2file-closure,$(1))) -define buildmakevars2file-closure - .PHONY: genpath - genpath: - rm -f $(1).tmp; \ - $(foreach var, \ - SBINDIR BINDIR LIBEXEC LIBDIR SHAREDIR PRIVATE_BINDIR \ - XENFIRMWAREDIR XEN_CONFIG_DIR XEN_SCRIPT_DIR XEN_LOCK_DIR \ - XEN_RUN_DIR XEN_PAGING_DIR, \ - echo "$(var)=\"$($(var))\"" >>$(1).tmp;) \ - $(call move-if-changed,$(1).tmp,$(1)) -endef - ifeq ($(debug_symbols),y) CFLAGS += -g endif
README +16 -0
@@ -129,6 +129,22 @@ performed with root privileges.] versions of those scripts, so that you can copy the dist directory to another machine and install from that distribution. +Xen system configuration +======================== + +Xen uses a set of variables for system configuration and upon build time, +because of this these variables are defined on a top level general input +source and are generated after running ./configure. There are two versions +of the input files, one for scripts (bash, python) and another for C / header +files: + + * config/xen-environment-header.in - used to generate config/xen-environment-header + * config/xen-environment-scripts.in - used to generate config/xen-environment-scripts + +Further documentation can be found on the wiki: + +http://wiki.xen.org/wiki/Category:Host_Configuration#System_wide_xen_configuration + Python Runtime Libraries ========================
config/StdGNU.mk +14 -14
@@ -1,3 +1,17 @@ +# These are standard defaults which you can use to avoid having +# to run ./configure -- you can use this to compile the hypervisor +# and the mini os: +# +# make xen +# sudo make -C xen install +# +# make -C extras/mini-os +include $(XEN_ROOT)/config/defaults.mk + +# This comes from running configure and will override +# the defaults. +-include $(XEN_ROOT)/config/Toplevel.mk + AS = $(CROSS_COMPILE)as LD = $(CROSS_COMPILE)ld ifeq ($(clang),y)
@@ -27,24 +41,10 @@ INSTALL_DIR = $(INSTALL) -d -m0755 -p INSTALL_DATA = $(INSTALL) -m0644 -p INSTALL_PROG = $(INSTALL) -m0755 -p -PREFIX ?= /usr -BINDIR = $(PREFIX)/bin INCLUDEDIR = $(PREFIX)/include -LIBEXEC = $(PREFIX)/lib/xen/bin -SHAREDIR = $(PREFIX)/share MANDIR = $(SHAREDIR)/man MAN1DIR = $(MANDIR)/man1 MAN8DIR = $(MANDIR)/man8 -SBINDIR = $(PREFIX)/sbin -XENFIRMWAREDIR = $(PREFIX)/lib/xen/boot - -PRIVATE_PREFIX = $(LIBDIR)/xen -PRIVATE_BINDIR = $(PRIVATE_PREFIX)/bin - -CONFIG_DIR = /etc -XEN_LOCK_DIR = /var/lock -XEN_RUN_DIR = /var/run/xen -XEN_PAGING_DIR = /var/lib/xen/xenpaging SYSCONFIG_DIR = $(CONFIG_DIR)/$(CONFIG_LEAF_DIR)
config/Toplevel.mk.in +24 -0
@@ -1 +1,25 @@ SUBSYSTEMS := @SUBSYSTEMS@ + +SBINDIR := @SBINDIR@ +BINDIR := @BINDIR@ +LIBEXEC := @LIBEXEC@ + +SHAREDIR := @SHAREDIR@ +LIBDIR := @LIBDIR@ + +XEN_RUN_DIR := @XEN_RUN_DIR@ +XEN_LOG_DIR := @XEN_LOG_DIR@ +XEN_LIB_STORED := @XEN_LIB_STORED@ + +CONFIG_DIR := @CONFIG_DIR@ +XEN_LOCK_DIR := @XEN_LOCK_DIR@ +XEN_PAGING_DIR := @XEN_PAGING_DIR@ + +PRIVATE_PREFIX := @PRIVATE_PREFIX@ +PRIVATE_PREFIX := @PKG_XEN_PREFIX@ +PRIVATE_BINDIR := @PRIVATE_BINDIR@ + +XENFIRMWAREDIR := @XENFIRMWAREDIR@ + +XEN_CONFIG_DIR := @XEN_CONFIG_DIR@ +XEN_SCRIPT_DIR := @XEN_SCRIPT_DIR@
config/defaults.mk new file +21 -0
@@ -0,0 +1,21 @@ +# Build system defaults, in case you never ran ./configure, this is +# supported to be able to build the xen hypervisor and the mini os: +# +# make xen +# sudo make -C xen install +# +# make -C extras/mini-os +PREFIX ?= /usr +BINDIR = $(PREFIX)/bin +LIBEXEC = $(PREFIX)/lib/xen/bin +SHAREDIR = $(PREFIX)/share +SBINDIR = $(PREFIX)/sbin +XENFIRMWAREDIR = $(PREFIX)/lib/xen/boot + +PRIVATE_PREFIX = $(LIBDIR)/xen +PRIVATE_BINDIR = $(PRIVATE_PREFIX)/bin + +CONFIG_DIR = /etc +XEN_LOCK_DIR = /var/lock +XEN_RUN_DIR = /var/run/xen +XEN_PAGING_DIR = /var/lib/xen/xenpaging
config/xen-environment-header.in new file +13 -0
@@ -0,0 +1,13 @@ +#define SBINDIR "@SBINDIR@" +#define BINDIR "@BINDIR@" +#define LIBEXEC "@LIBEXEC@" +#define LIBDIR "@LIBDIR@" +#define SHAREDIR "@SHAREDIR@" + +#define PRIVATE_BINDIR "@PRIVATE_BINDIR@" +#define XENFIRMWAREDIR "@XENFIRMWAREDIR@" +#define XEN_CONFIG_DIR "@XEN_CONFIG_DIR@" +#define XEN_SCRIPT_DIR "@XEN_SCRIPT_DIR@" +#define XEN_LOCK_DIR "@XEN_LOCK_DIR@" +#define XEN_RUN_DIR "@XEN_RUN_DIR@" +#define XEN_PAGING_DIR "@XEN_PAGING_DIR@"
config/xen-environment-scripts.in new file +15 -0
@@ -0,0 +1,15 @@ +SBINDIR="@SBINDIR@" +BINDIR="@BINDIR@" +LIBEXEC="@LIBEXEC@" +LIBDIR="@LIBDIR@" +SHAREDIR="@SHAREDIR@" + +PRIVATE_BINDIR="@PRIVATE_BINDIR@" +XENFIRMWAREDIR="@XENFIRMWAREDIR@" +XEN_CONFIG_DIR="@XEN_CONFIG_DIR@" +XEN_SCRIPT_DIR="@XEN_SCRIPT_DIR@" +XEN_LOCK_DIR="@XEN_LOCK_DIR@" +XEN_LOG_DIR="@XEN_LOG_DIR@" +XEN_LIB_STORED="@XEN_LIB_STORED@" +XEN_RUN_DIR="@XEN_RUN_DIR@" +XEN_PAGING_DIR="@XEN_PAGING_DIR@"
configure.ac +8 -1
@@ -5,12 +5,19 @@ AC_PREREQ([2.67]) AC_INIT([Xen Hypervisor], m4_esyscmd([./version.sh ./xen/Makefile]), [[email protected]], [xen], [http://www.xen.org/]) AC_CONFIG_SRCDIR([./xen/common/kernel.c]) -AC_CONFIG_FILES([./config/Toplevel.mk]) +AC_CONFIG_FILES([ + config/Toplevel.mk + config/xen-environment-scripts + config/xen-environment-header +]) AC_CANONICAL_HOST m4_include([m4/features.m4]) m4_include([m4/subsystem.m4]) +m4_include([m4/expand_config.m4]) + +AX_XEN_EXPAND_CONFIG() dnl mini-os is only ported to certain platforms case "$host_cpu" in
m4/expand_config.m4 new file +61 -0
61 lines not on this page · raw message
stubdom/Makefile +9 -8
@@ -48,18 +48,19 @@ TARGET_LDFLAGS += -nostdlib -L$(CROSS_PREFIX)/$(GNU_TARGET_ARCH)-xen-elf/lib TARGETS=$(STUBDOM_TARGETS) +STUBDOMPATH="stubdompath.sh" + +$(STUBDOMPATH): $(XEN_ROOT)/config/xen-environment-scripts + @cp $(XEN_ROOT)/config/xen-environment-scripts $@ + .PHONY: all all: build ifeq ($(STUBDOM_SUPPORTED),1) -build: genpath $(STUBDOM_BUILD) +build: $(STUBDOMPATH) $(STUBDOM_BUILD) else -build: genpath +build: $(STUBDOMPATH) endif -STUBDOMPATH="stubdompath.sh" -genpath-target = $(call buildmakevars2file,$(STUBDOMPATH)) -$(eval $(genpath-target)) - ############## # Cross-newlib ##############
@@ -448,9 +449,9 @@ xenstore-stubdom: mini-os-$(XEN_TARGET_ARCH)-xenstore libxc xenstore ######### ifeq ($(STUBDOM_SUPPORTED),1) -install: genpath install-readme $(STUBDOM_INSTALL) +install: $(STUBDOMPATH) install-readme $(STUBDOM_INSTALL) else -install: genpath +install: $(STUBDOMPATH) endif install-readme:
stubdom/configure.ac +3 -0
@@ -16,6 +16,9 @@ m4_include([../m4/features.m4]) m4_include([../m4/path_or_fail.m4]) m4_include([../m4/depends.m4]) m4_include([../m4/fetcher.m4]) +m4_include([../m4/expand_config.m4]) + +AX_XEN_EXPAND_CONFIG() # Enable/disable stub domains AX_STUBDOM_CONDITIONAL([ioemu-stubdom], [ioemu])
tools/configure.ac +3 -0
@@ -47,6 +47,9 @@ m4_include([../m4/ptyfuncs.m4]) m4_include([../m4/extfs.m4]) m4_include([../m4/fetcher.m4]) m4_include([../m4/ax_compare_version.m4]) +m4_include([../m4/expand_config.m4]) + +AX_XEN_EXPAND_CONFIG() # Enable/disable options AX_ARG_DEFAULT_DISABLE([githttp], [Download GIT repositories via HTTP])
tools/hotplug/common/Makefile +3 -3
@@ -9,14 +9,14 @@ HOTPLUGPATH="hotplugpath.sh" XEN_SCRIPTS = XEN_SCRIPT_DATA = $(HOTPLUGPATH) -genpath-target = $(call buildmakevars2file,$(HOTPLUGPATH)) -$(eval $(genpath-target)) +$(HOTPLUGPATH): $(XEN_ROOT)/config/xen-environment-scripts + @cp $(XEN_ROOT)/config/xen-environment-scripts $@ .PHONY: all all: build .PHONY: build -build: genpath +build: $(HOTPLUGPATH) .PHONY: install install: all install-scripts
tools/libxl/Makefile +3 -8
@@ -97,6 +97,9 @@ TEST_PROGS += $(foreach t, $(LIBXL_TESTS),test_$t) $(LIBXL_OBJS) $(LIBXL_TEST_OBJS): CFLAGS += $(CFLAGS_LIBXL) -include $(XEN_ROOT)/tools/config.h +_paths.h: $(XEN_ROOT)/config/xen-environment-header + @cp $(XEN_ROOT)/config/xen-environment-header $@ + AUTOINCS= libxlu_cfg_y.h libxlu_cfg_l.h _libxl_list.h _paths.h \ libxlu_disk_l.h _libxl_save_msgs_callout.h _libxl_save_msgs_helper.h AUTOSRCS= libxlu_cfg_y.c libxlu_cfg_l.c
@@ -141,9 +144,6 @@ $(LIBXL_OBJS) $(LIBXLU_OBJS) $(XL_OBJS) $(SAVE_HELPER_OBJS) \ @rm -f $*.[ch] $(FLEX) --header-file=$*.h --outfile=$*.c $< -genpath-target = $(call buildmakevars2file,_paths.h.tmp) -$(eval $(genpath-target)) - libxl.api-ok: check-libxl-api-rules _libxl.api-for-check $(PERL) $^ touch $@
@@ -154,11 +154,6 @@ _%.api-for-check: %.h $(AUTOINCS) >[email protected] mv -f [email protected] $@ -_paths.h: genpath - sed -e "s/\([^=]*\)=\(.*\)/#define \1 \2/g" [email protected] >[email protected] - rm -f [email protected] - $(call move-if-changed,[email protected],$@) - _libxl_list.h: $(XEN_INCLUDE)/xen-external/bsd-sys-queue-h-seddery $(XEN_INCLUDE)/xen-external/bsd-sys-queue.h $(PERL) $^ --prefix=libxl >[email protected] $(call move-if-changed,[email protected],$@)
tools/python/Makefile +3 -3
@@ -6,11 +6,11 @@ all: build XENPATH = "xen/util/path.py" -genpath-target = $(call buildmakevars2file,$(XENPATH)) -$(eval $(genpath-target)) +$(XENPATH): $(XEN_ROOT)/config/xen-environment-scripts + @cp $(XEN_ROOT)/config/xen-environment-scripts $@ .PHONY: build -build: genpath genwrap.py $(XEN_ROOT)/tools/libxl/libxl_types.idl \ +build: $(XENPATH) genwrap.py $(XEN_ROOT)/tools/libxl/libxl_types.idl \ $(XEN_ROOT)/tools/libxl/idl.py PYTHONPATH=$(XEN_ROOT)/tools/libxl $(PYTHON) genwrap.py \ $(XEN_ROOT)/tools/libxl/libxl_types.idl \
Signature · 1 line
2.0.0.rc3.18.g00a5b79
Re: [PATCH v5 11/14] autoconf: xen: move standard variables to a generic place
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 20.05.14 at 14:31, <[email protected]> wrote:
config/StdGNU.mk +3
-0@@ -1,3 +1,17 @@ +# These are standard defaults which you can use to avoid having +# to run ./configure -- you can use this to compile the hypervisor +# and the mini os:
config/StdGNU.mk line 13
Quoted 10 lines
config/StdGNU.mk +10
-0+# +# make xen +# sudo make -C xen install +# +# make -C extras/mini-os +include $(XEN_ROOT)/config/defaults.mk + +# This comes from running configure and will override +# the defaults. +-include $(XEN_ROOT)/config/Toplevel.mk
So what is the result of running one of the above make invocations without having run ./configure, then running ./configure before running the same make invocation (for an incremental update) again?
config/defaults.mk line 8
Quoted 11 lines
config/defaults.mk new file +8
-0@@ -0,0 +1,21 @@ +# Build system defaults, in case you never ran ./configure, this is +# supported to be able to build the xen hypervisor and the mini os: +# +# make xen +# sudo make -C xen install +# +# make -C extras/mini-os +PREFIX ?= /usr
Presumably this is meant to retain the previous setting from StdGNU.mk, but being tree-wide this then is kind of in conflict with the tools default of /usr/local (and I think with the switch to the latter StdGNU.mk should have been switched too).
Also you appear to be ignoring the similar settings done in SunOS.mk.
Jan
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH v5 11/14] autoconf: xen: move standard variables to a generic place
Quoted 14 lines · Jan Beulich
Quoted 14 lines
Quoted 1 line
Quoted 1 line · On 20.05.14 at 14:31, <[email protected]> wrote:
config/StdGNU.mk +10
-0@@ -1,3 +1,17 @@ +# These are standard defaults which you can use to avoid having +# to run ./configure -- you can use this to compile the hypervisor +# and the mini os: +# +# make xen +# sudo make -C xen install +# +# make -C extras/mini-os +include $(XEN_ROOT)/config/defaults.mk +
Quoted 8 lines
config/StdGNU.mk line 13
Quoted 3 lines
config/StdGNU.mk +3
-0+# This comes from running configure and will override +# the defaults. +-include $(XEN_ROOT)/config/Toplevel.mkSo what is the result of running one of the above make invocations without having run ./configure, then running ./configure before running the same make invocation (for an incremental update) again?
In my last v4 you pointed out two targets which you wished to ensure would not require running configure, both of those targets:
make xen -j $(getconf _NPROCESSORS_ONLN)
make -C extras/mini-os -j $(getconf _NPROCESSORS_ONLN)
I have ensured this in this series and the above change indeed is what you were looking for.
Quoted 7 lines
Quoted 7 lines
config/defaults.mk new file +4
-0@@ -0,0 +1,21 @@ +# Build system defaults, in case you never ran ./configure, this is +# supported to be able to build the xen hypervisor and the mini os: +# +# make xen
Quoted 8 lines
config/defaults.mk line 8
Quoted 4 lines
config/defaults.mk new file +4
-0+# sudo make -C xen install +# +# make -C extras/mini-os +PREFIX ?= /usrPresumably this is meant to retain the previous setting from StdGNU.mk, but being tree-wide this then is kind of in conflict with the tools default of
/usr/local
It would seem that way but ./configure is required to compile tools and /usr/local/ is actually preserved as the default for tools if no prefix is specifified, just as before.
Quoted 5 lines
(and I think with the switch to the
latter StdGNU.mk should have been switched too).Also you appear to be ignoring the similar settings done in SunOS.mk.
Can someone with a Solaris box test the above similar changes?
Luis
Re: [PATCH v5 11/14] autoconf: xen: move standard variables to a generic place
Quoted 25 lines
Quoted 1 line
Quoted 1 line · On 20.05.14 at 19:54, <[email protected]> wrote:
Quoted 14 lines · Jan Beulich
Quoted 14 lines
Quoted 1 line
Quoted 1 line · On 20.05.14 at 14:31, <[email protected]> wrote:
config/StdGNU.mk +10
-0@@ -1,3 +1,17 @@ +# These are standard defaults which you can use to avoid having +# to run ./configure -- you can use this to compile the hypervisor +# and the mini os: +# +# make xen +# sudo make -C xen install +# +# make -C extras/mini-os +include $(XEN_ROOT)/config/defaults.mk +Quoted 8 lines
config/StdGNU.mk line 13
Quoted 3 lines
config/StdGNU.mk +3
-0+# This comes from running configure and will override +# the defaults. +-include $(XEN_ROOT)/config/Toplevel.mkSo what is the result of running one of the above make invocations without having run ./configure, then running ./configure before running the same make invocation (for an incremental update) again?
Quoted 8 lines
In my last v4 you pointed out two targets which you wished to ensure would not require running configure, both of those targets:
make xen -j $(getconf
_NPROCESSORS_ONLN)
make -C extras/mini-os -j $(getconf_NPROCESSORS_ONLN)I have ensured this in this series and the above change indeed is what you were looking for.
I understand that; what I was asking however was what the effect of the named sequence of operations would be, i.e. whether that then perhaps would unexpectedly change things between the original and the incremental make runs. Obviously an incremental make should change _only_ things where the contributing sources changed, but nothing resulting merely from the intermediate ./configure run.
Quoted 16 lines
Quoted 7 lines
Quoted 7 lines
config/defaults.mk new file +4
-0@@ -0,0 +1,21 @@ +# Build system defaults, in case you never ran ./configure, this is +# supported to be able to build the xen hypervisor and the mini os: +# +# make xenQuoted 8 lines
config/defaults.mk line 8
Quoted 4 lines
config/defaults.mk new file +4
-0+# sudo make -C xen install +# +# make -C extras/mini-os +PREFIX ?= /usrPresumably this is meant to retain the previous setting from StdGNU.mk, but being tree-wide this then is kind of in conflict with the tools default of
/usr/local
Quoted 3 lines
It would seem that way but ./configure is required to compile tools and
/usr/local/is actually preserved as the default for tools if no prefix is specifified, just as before.
I simply tried to point out an inconsistency that might be worth fixing in the context of the re-work.
Jan
Re: [PATCH v5 11/14] autoconf: xen: move standard variables to a generic place
Quoted 34 lines · Jan Beulich
Quoted 25 lines
Quoted 1 line
Quoted 1 line · On 20.05.14 at 19:54, <[email protected]> wrote:
Quoted 14 lines · Jan Beulich
Quoted 14 lines
Quoted 1 line
Quoted 1 line · On 20.05.14 at 14:31, <[email protected]> wrote:
config/StdGNU.mk +10
-0@@ -1,3 +1,17 @@ +# These are standard defaults which you can use to avoid having +# to run ./configure -- you can use this to compile the hypervisor +# and the mini os: +# +# make xen +# sudo make -C xen install +# +# make -C extras/mini-os +include $(XEN_ROOT)/config/defaults.mk +Quoted 8 lines
config/StdGNU.mk line 13
Quoted 3 lines
config/StdGNU.mk +3
-0+# This comes from running configure and will override +# the defaults. +-include $(XEN_ROOT)/config/Toplevel.mkSo what is the result of running one of the above make invocations without having run ./configure, then running ./configure before running the same make invocation (for an incremental update) again?
Quoted 8 lines
In my last v4 you pointed out two targets which you wished to ensure would not require running configure, both of those targets:
make xen -j $(getconf
_NPROCESSORS_ONLN)
make -C extras/mini-os -j $(getconf_NPROCESSORS_ONLN)I have ensured this in this series and the above change indeed is what you were looking for.
Quoted 7 lines
I understand that; what I was asking however was what the effect of the named sequence of operations would be, i.e. whether that then perhaps would unexpectedly change things between the original and the incremental make runs. Obviously an incremental make should change _only_ things where the contributing sources changed, but nothing resulting merely from the intermediate ./configure run.
Nothing I've introduced here should hamper the typical compile as what you described you want. Let me know if you find issues though. We're human.
Quoted 16 lines
Quoted 16 lines
Quoted 15 lines
config/defaults.mk line 8
Quoted 11 lines
config/defaults.mk new file +8
-0@@ -0,0 +1,21 @@ +# Build system defaults, in case you never ran ./configure, this is +# supported to be able to build the xen hypervisor and the mini os: +# +# make xen +# sudo make -C xen install +# +# make -C extras/mini-os +PREFIX ?= /usrPresumably this is meant to retain the previous setting from StdGNU.mk, but being tree-wide this then is kind of in conflict with the tools default of
/usr/local
Quoted 6 lines
Quoted 3 lines
It would seem that way but ./configure is required to compile tools and
/usr/local/is actually preserved as the default for tools if no prefix is specifified, just as before.I simply tried to point out an inconsistency that might be worth fixing in the context of the re-work.
I hear ya, just tired to preserve the old behavior which is where I got those static non ./configure defaults. At this point from what I've observed anything as small as a needle could affect anything hugely in Xen so I would rather simplify the introduction of systemd without radical changes, and let things evolve slowly as atomic collateral evolutions over time where we could then bisect.
Luis
Re: [PATCH v5 11/14] autoconf: xen: move standard variables to a generic place
Quoted 44 lines
Quoted 1 line
Quoted 1 line · On 21.05.14 at 10:03, <[email protected]> wrote:
Quoted 34 lines · Jan Beulich
Quoted 25 lines
Quoted 1 line
Quoted 1 line · On 20.05.14 at 19:54, <[email protected]> wrote:
Quoted 14 lines · Jan Beulich
Quoted 14 lines
Quoted 1 line
Quoted 1 line · On 20.05.14 at 14:31, <[email protected]> wrote:
config/StdGNU.mk +10
-0@@ -1,3 +1,17 @@ +# These are standard defaults which you can use to avoid having +# to run ./configure -- you can use this to compile the hypervisor +# and the mini os: +# +# make xen +# sudo make -C xen install +# +# make -C extras/mini-os +include $(XEN_ROOT)/config/defaults.mk +Quoted 8 lines
config/StdGNU.mk line 13
Quoted 3 lines
config/StdGNU.mk +3
-0+# This comes from running configure and will override +# the defaults. +-include $(XEN_ROOT)/config/Toplevel.mkSo what is the result of running one of the above make invocations without having run ./configure, then running ./configure before running the same make invocation (for an incremental update) again?
Quoted 8 lines
In my last v4 you pointed out two targets which you wished to ensure would not require running configure, both of those targets:
make xen -j $(getconf
_NPROCESSORS_ONLN)
make -C extras/mini-os -j $(getconf_NPROCESSORS_ONLN)I have ensured this in this series and the above change indeed is what you were looking for.
Quoted 7 lines
I understand that; what I was asking however was what the effect of the named sequence of operations would be, i.e. whether that then perhaps would unexpectedly change things between the original and the incremental make runs. Obviously an incremental make should change _only_ things where the contributing sources changed, but nothing resulting merely from the intermediate ./configure run.
Quoted 3 lines
Nothing I've introduced here should hamper the typical compile as what you described you want. Let me know if you find issues though. We're human.
Did you try it? I would expect the PREFIX change (from /usr to /usr/local) alone would already alter things.
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
Quoted 15 lines
config/defaults.mk line 8
Quoted 11 lines
config/defaults.mk new file +8
-0@@ -0,0 +1,21 @@ +# Build system defaults, in case you never ran ./configure, this is +# supported to be able to build the xen hypervisor and the mini os: +# +# make xen +# sudo make -C xen install +# +# make -C extras/mini-os +PREFIX ?= /usrPresumably this is meant to retain the previous setting from StdGNU.mk, but being tree-wide this then is kind of in conflict with the tools default of
/usr/local
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
It would seem that way but ./configure is required to compile tools and
/usr/local/is actually preserved as the default for tools if no prefix is specifified, just as before.I simply tried to point out an inconsistency that might be worth fixing in the context of the re-work.
I hear ya, just tired to preserve the old behavior which is where I
s/tired/tried/ perhaps? Or else I don't understand why you simply changed it to /usr/local.
Jan
Quoted 7 lines
got those static non ./configure defaults. At this point from what I've observed anything as small as a needle could affect anything hugely in Xen so I would rather simplify the introduction of systemd without radical changes, and let things evolve slowly as atomic collateral evolutions over time where we could then bisect.
Luis
Re: [PATCH v5 11/14] autoconf: xen: move standard variables to a generic place
Quoted 45 lines · Jan Beulich
Quoted 45 lines
Quoted 2 lines
Quoted 2 lines · On 21.05.14 at 10:03, <[email protected]> wrote:
Quoted 41 lines · Jan Beulich
Quoted 25 lines
Quoted 1 line
Quoted 1 line · On 20.05.14 at 19:54, <[email protected]> wrote:
Quoted 14 lines · Jan Beulich
Quoted 14 lines
Quoted 1 line
Quoted 1 line · On 20.05.14 at 14:31, <[email protected]> wrote:
config/StdGNU.mk +10
-0@@ -1,3 +1,17 @@ +# These are standard defaults which you can use to avoid having +# to run ./configure -- you can use this to compile the hypervisor +# and the mini os: +# +# make xen +# sudo make -C xen install +# +# make -C extras/mini-os +include $(XEN_ROOT)/config/defaults.mk +Quoted 8 lines
config/StdGNU.mk line 13
Quoted 3 lines
config/StdGNU.mk +3
-0+# This comes from running configure and will override +# the defaults. +-include $(XEN_ROOT)/config/Toplevel.mkSo what is the result of running one of the above make invocations without having run ./configure, then running ./configure before running the same make invocation (for an incremental update) again?
Quoted 8 lines
In my last v4 you pointed out two targets which you wished to ensure would not require running configure, both of those targets:
make xen -j $(getconf
_NPROCESSORS_ONLN)
make -C extras/mini-os -j $(getconf_NPROCESSORS_ONLN)I have ensured this in this series and the above change indeed is what you were looking for.
I understand that; what I was asking however was what the effect of the named sequence of operations would be, i.e. whether that then perhaps would unexpectedly change things between the original and the incremental make runs. Obviously an incremental make should change _only_ things where the contributing sources changed, but nothing resulting merely from the intermediate ./configure run.
Quoted 5 lines
Quoted 3 lines
Nothing I've introduced here should hamper the typical compile as what you described you want. Let me know if you find issues though. We're human.
Did you try it?
Tried only full install with cxenstored, oxenstored on both old init and systemd with and without systemd lib dev libs, with and without ocaml poo. I also tried to compile test what you asked, anything else I haven't tried so test results, reports and patches at this point are welcomed for all the other cases.
Quoted 2 lines
I would expect the PREFIX change (from /usr to
/usr/local) alone would already alter things.
That's only done upon configure, but maybe I'm missing something.
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
config/defaults.mk line 1
Quoted 4 lines
config/defaults.mk new file +1
-0@@ -0,0 +1,21 @@ +# Build system defaults, in case you never ran ./configure, this
is
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
config/defaults.mk line 2
Quoted 1 line
config/defaults.mk new file +1
-0+# supported to be able to build the xen hypervisor and the mini
os:
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 14 lines
Quoted 10 lines
config/defaults.mk line 8
Quoted 6 lines
config/defaults.mk new file +6
-0+# +# make xen +# sudo make -C xen install +# +# make -C extras/mini-os +PREFIX ?= /usrPresumably this is meant to retain the previous setting from StdGNU.mk, but being tree-wide this then is kind of in conflict with the tools default of
/usr/localIt would seem that way but ./configure is required to compile tools and
/usr/local/is actually preserved as the default for tools if no prefix is specifified, just as before.
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
I simply tried to point out an inconsistency that might be worth fixing in the context of the re-work.
I hear ya, just tired to preserve the old behavior which is where I
s/tired/tried/ perhaps?
Tried. Which is what I tried.
Quoted 2 lines
Or else I don't understand why you simply
changed it to/usr/local.
That's the tools default upon default configure.
Luis
Quoted 13 lines
Jan
Quoted 7 lines
got those static non ./configure defaults. At this point from what I've observed anything as small as a needle could affect anything hugely in Xen so I would rather simplify the introduction of systemd without radical changes, and let things evolve slowly as atomic collateral evolutions over time where we could then bisect.
Luis
Quoted 4 lines
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v5 11/14] autoconf: xen: move standard variables to a generic place
In reply to Jan BeulichQuoted 44 lines · Jan Beulich
Quoted 44 lines
Quoted 1 line
Quoted 1 line · On 21.05.14 at 10:03, <[email protected]> wrote:
Quoted 41 lines · Jan Beulich
Quoted 25 lines
Quoted 1 line
Quoted 1 line · On 20.05.14 at 19:54, <[email protected]> wrote:
Quoted 14 lines · Jan Beulich
Quoted 14 lines
Quoted 1 line
Quoted 1 line · On 20.05.14 at 14:31, <[email protected]> wrote:
config/StdGNU.mk +10
-0@@ -1,3 +1,17 @@ +# These are standard defaults which you can use to avoid having +# to run ./configure -- you can use this to compile the hypervisor +# and the mini os: +# +# make xen +# sudo make -C xen install +# +# make -C extras/mini-os +include $(XEN_ROOT)/config/defaults.mk +Quoted 8 lines
config/StdGNU.mk line 13
Quoted 3 lines
config/StdGNU.mk +3
-0+# This comes from running configure and will override +# the defaults. +-include $(XEN_ROOT)/config/Toplevel.mkSo what is the result of running one of the above make invocations without having run ./configure, then running ./configure before running the same make invocation (for an incremental update) again?
Quoted 8 lines
In my last v4 you pointed out two targets which you wished to ensure would not require running configure, both of those targets:
make xen -j $(getconf
_NPROCESSORS_ONLN)
make -C extras/mini-os -j $(getconf_NPROCESSORS_ONLN)I have ensured this in this series and the above change indeed is what you were looking for.
I understand that; what I was asking however was what the effect of the named sequence of operations would be, i.e. whether that then perhaps would unexpectedly change things between the original and the incremental make runs. Obviously an incremental make should change _only_ things where the contributing sources changed, but nothing resulting merely from the intermediate ./configure run.
Quoted 6 lines
Quoted 3 lines
Nothing I've introduced here should hamper the typical compile as what you described you want. Let me know if you find issues though. We're human.
Did you try it? I would expect the PREFIX change (from /usr to
/usr/local) alone would already alter things.
Do either the xen or extras/mini-os subtrees depend on PREFIX at all?
At most I would expoect xen to depend on BOOT_DIR which I don't think is overridable with configure?
I haven't looked at this patch in detail yet but I'm not sure why Toplevel.mk is getting included in the StdGNU.mk rather than including it from FOO.mk only for those components which depend on configure having been run.
Ian.
Re: [PATCH v5 11/14] autoconf: xen: move standard variables to a generic place
Quoted 50 lines
Quoted 1 line
Quoted 1 line · On 21.05.14 at 12:33, <[email protected]> wrote:
Quoted 48 lines · Jan Beulich
Quoted 47 lines
Quoted 1 line
Quoted 1 line · On 21.05.14 at 10:03, <[email protected]> wrote:
Quoted 34 lines · Jan Beulich
Quoted 25 lines
Quoted 1 line
Quoted 1 line · On 20.05.14 at 19:54, <[email protected]> wrote:
Quoted 14 lines · Jan Beulich
Quoted 14 lines
Quoted 1 line
Quoted 1 line · On 20.05.14 at 14:31, <[email protected]> wrote:
config/StdGNU.mk +10
-0@@ -1,3 +1,17 @@ +# These are standard defaults which you can use to avoid having +# to run ./configure -- you can use this to compile the hypervisor +# and the mini os: +# +# make xen +# sudo make -C xen install +# +# make -C extras/mini-os +include $(XEN_ROOT)/config/defaults.mk +Quoted 8 lines
config/StdGNU.mk line 13
Quoted 3 lines
config/StdGNU.mk +3
-0+# This comes from running configure and will override +# the defaults. +-include $(XEN_ROOT)/config/Toplevel.mkSo what is the result of running one of the above make invocations without having run ./configure, then running ./configure before running the same make invocation (for an incremental update) again?
Quoted 8 lines
In my last v4 you pointed out two targets which you wished to ensure would not require running configure, both of those targets:
make xen -j $(getconf
_NPROCESSORS_ONLN)
make -C extras/mini-os -j $(getconf_NPROCESSORS_ONLN)I have ensured this in this series and the above change indeed is what you were looking for.
Quoted 7 lines
I understand that; what I was asking however was what the effect of the named sequence of operations would be, i.e. whether that then perhaps would unexpectedly change things between the original and the incremental make runs. Obviously an incremental make should change _only_ things where the contributing sources changed, but nothing resulting merely from the intermediate ./configure run.
Nothing I've introduced here should hamper the typical compile as what you described you want. Let me know if you find issues though. We're human.
Quoted 7 lines
Quoted 2 lines
Did you try it? I would expect the PREFIX change (from /usr to
/usr/local) alone would already alter things.Do either the xen or extras/mini-os subtrees depend on PREFIX at all?
At most I would expoect xen to depend on
BOOT_DIRwhich I don't think is overridable with configure?
I would have expected the /usr use in x86_64.mk to have got converted to $(PREFIX), but looks like it's still hard coded. With that there indeed shouldn't be any use of PREFIX in those sub-trees.
Jan
Re: [PATCH v5 11/14] autoconf: xen: move standard variables to a generic place
In reply to Ian CampbellQuoted 4 lines · Ian Campbell
I haven't looked at this patch in detail yet but I'm not sure why Toplevel.mk is getting included in the StdGNU.mk rather than including it from FOO.mk only for those components which depend on configure having been run.
So, having looked at this patch now it seems to me that the stuff being added to config/Toplevel.mk should instead be added to a new config/Paths.mk which should be included from the appropriate per-subsystem config/{Tools,Stubdom,Docs}.mk and not from anything which would cause it to be included when building Xen or minios.
Ian.
Re: [PATCH v5 11/14] autoconf: xen: move standard variables to a generic place
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 21.05.14 at 17:14, <[email protected]> wrote:
Quoted 4 lines · Ian Campbell
I haven't looked at this patch in detail yet but I'm not sure why Toplevel.mk is getting included in the StdGNU.mk rather than including it from FOO.mk only for those components which depend on configure having been run.
Quoted 5 lines
So, having looked at this patch now it seems to me that the stuff being added to
config/Toplevel.mkshould instead be added to a newconfig/Paths.mkwhich should be included from the appropriate per-subsystemconfig/{Tools,Stubdom,Docs}.mkand not from anything which would cause it to be included when building Xen or minios.
Yes, that seems desirable.
Jan
Re: [PATCH v5 11/14] autoconf: xen: move standard variables to a generic place
In reply to Luis R. RodriguezREADME performed with root privileges.] · line 135
Quoted 12 lines · Luis R. Rodriguez
README +4
-0@@ -129,6 +129,22 @@ performed with root privileges.] versions of those scripts, so that you can copy the dist directory to another machine and install from that distribution. +Xen system configuration +======================== + +Xen uses a set of variables for system configuration and upon build time,
s/upon/at/
README performed with root privileges.] · line 144
Quoted 9 lines
README +9
-0+because of this these variables are defined on a top level general input +source and are generated after running ./configure. There are two versions +of the input files, one for scripts (bash, python) and another for C / header +files: + + * config/xen-environment-header.in - used to generate config/xen-environment-header + * config/xen-environment-scripts.in - used to generate config/xen-environment-scripts + +Further documentation can be found on the wiki:
This all seems very developer focused (why would users care about this?). I think most of this would be better as a comment in the relevant files.
README performed with root privileges.] · line 146
Quoted 2 lines
README +2
-0+ +http://wiki.xen.org/wiki/Category:Host_Configuration#System_wide_xen_configuration
This might be useful if it were more user focused in particular if it referred to the installed locations of things and not the source which users don't care about.
Quoted 12 lines
README +1
-0+ Python Runtime Libraries ========================config/StdGNU.mk +3
-0@@ -1,3 +1,17 @@ +# These are standard defaults which you can use to avoid having +# to run ./configure -- you can use this to compile the hypervisor +# and the mini os:
config/StdGNU.mk line 13
Quoted 10 lines
config/StdGNU.mk +10
-0+# +# make xen +# sudo make -C xen install +# +# make -C extras/mini-os +include $(XEN_ROOT)/config/defaults.mk + +# This comes from running configure and will override +# the defaults. +-include $(XEN_ROOT)/config/Toplevel.mk
As I said in the reply to the subthread started by Jan I don't think any of this belongs here.
Quoted 29 lines
new file mode 100644
index 0000000..7dd7a53config/xen-environment-header.in new file +13
-0@@ -0,0 +1,13 @@ +#define SBINDIR "@SBINDIR@" +#define BINDIR "@BINDIR@" +#define LIBEXEC "@LIBEXEC@" +#define LIBDIR "@LIBDIR@" +#define SHAREDIR "@SHAREDIR@" + +#define PRIVATE_BINDIR "@PRIVATE_BINDIR@" +#define XENFIRMWAREDIR "@XENFIRMWAREDIR@" +#define XEN_CONFIG_DIR "@XEN_CONFIG_DIR@" +#define XEN_SCRIPT_DIR "@XEN_SCRIPT_DIR@" +#define XEN_LOCK_DIR "@XEN_LOCK_DIR@" +#define XEN_RUN_DIR "@XEN_RUN_DIR@" +#define XEN_PAGING_DIR "@XEN_PAGING_DIR@"config/xen-environment-scripts.in new file +5
-0@@ -0,0 +1,15 @@ +SBINDIR="@SBINDIR@" +BINDIR="@BINDIR@" +LIBEXEC="@LIBEXEC@" +LIBDIR="@LIBDIR@" +SHAREDIR="@SHAREDIR@"
config/xen-environment-scripts.in line 15
Quoted 10 lines
config/xen-environment-scripts.in new file +10
-0+ +PRIVATE_BINDIR="@PRIVATE_BINDIR@" +XENFIRMWAREDIR="@XENFIRMWAREDIR@" +XEN_CONFIG_DIR="@XEN_CONFIG_DIR@" +XEN_SCRIPT_DIR="@XEN_SCRIPT_DIR@" +XEN_LOCK_DIR="@XEN_LOCK_DIR@" +XEN_LOG_DIR="@XEN_LOG_DIR@" +XEN_LIB_STORED="@XEN_LIB_STORED@" +XEN_RUN_DIR="@XEN_RUN_DIR@" +XEN_PAGING_DIR="@XEN_PAGING_DIR@"
The downside of these is that we now need to keep both in sync. I think a reasonable compromise would be to generate the scripts version of this via autoconf and create the C version using a mechanism similar to the existing buildmakevars2file etc stuff.
m4/expand_config.m4
Quoted 1 line
m4/expand_config.m4 +0
-0
expand_config is a strange name for this, paths.m4 would be more descriptive, wouldn't it?
Or this sort of thing wouldn't be out of place in confgure.ac I think.
Quoted 5 lines
new file mode 100644
index 0000000..717fcd1
m4/expand_config.m4 line 10
Quoted 10 lines
m4/expand_config.m4 new file +10
-0@@ -0,0 +1,61 @@ +AC_DEFUN([AX_XEN_EXPAND_CONFIG], [ +dnl expand these early so we can use this for substitutions +test "x$prefix" = "xNONE" && prefix=$ac_default_prefix +test "x$exec_prefix" = "xNONE" && exec_prefix=$ac_default_prefix + +BINDIR=$prefix/bin +AC_SUBST(BINDIR) + +SBINDIR=$prefix/sbin +AC_SUBST(SBINDIR)
TBH I thought that after going through all this fuss --bindir and --sbindir might worl.
stubdom/Makefile TARGET_LDFLAGS += -nostdlib -L$(CROSS_PREFIX)/$(GNU_TARGET_ARCH)-xen-elf/lib · line 54
Quoted 12 lines
stubdom/Makefile +4
-0@@ -48,18 +48,19 @@ TARGET_LDFLAGS += -nostdlib -L$(CROSS_PREFIX)/$(GNU_TARGET_ARCH)-xen-elf/lib TARGETS=$(STUBDOM_TARGETS) +STUBDOMPATH="stubdompath.sh" + +$(STUBDOMPATH): $(XEN_ROOT)/config/xen-environment-scripts + @cp $(XEN_ROOT)/config/xen-environment-scripts $@
cp $< $@
Not sure it needs hiding from the user either.
(there are a few of these)
stubdom/configure.ac m4_include([../m4/features.m4]) · line 21
Quoted 11 lines
stubdom/configure.ac +3
-0@@ -16,6 +16,9 @@ m4_include([../m4/features.m4]) m4_include([../m4/path_or_fail.m4]) m4_include([../m4/depends.m4]) m4_include([../m4/fetcher.m4]) +m4_include([../m4/expand_config.m4]) + +AX_XEN_EXPAND_CONFIG()
Doesn't only the toplevel configure.ac need this, because you've put the things into config/Toplevel.mk (soon to be config/Paths.mk).
Ian.
Re: [PATCH v5 11/14] autoconf: xen: move standard variables to a generic place
Quoted 9 lines · Ian Campbell
Quoted 8 lines · Luis R. Rodriguez
README +0
-0@@ -129,6 +129,22 @@ performed with root privileges.] versions of those scripts, so that you can copy the dist directory to another machine and install from that distribution.
Quoted 6 lines
README performed with root privileges.] · line 135
Quoted 4 lines
README +4
-0+Xen system configuration +======================== + +Xen uses a set of variables for system configuration and upon build time,s/upon/at/
Ammended.
Quoted 14 lines
README performed with root privileges.] · line 144
Quoted 9 lines
README +9
-0+because of this these variables are defined on a top level general input +source and are generated after running ./configure. There are two versions +of the input files, one for scripts (bash, python) and another for C / header +files: + + * config/xen-environment-header.in - used to generate config/xen-environment-header + * config/xen-environment-scripts.in - used to generate config/xen-environment-scripts + +Further documentation can be found on the wiki:This all seems very developer focused (why would users care about this?). I think most of this would be better as a comment in the relevant files.
Quoted 6 lines
README performed with root privileges.] · line 146
Quoted 2 lines
README +2
-0+ +http://wiki.xen.org/wiki/Category:Host_Configuration#System_wide_xen_configurationThis might be useful if it were more user focused in particular if it referred to the installed locations of things and not the source which users don't care about.
OK tossed it into config/xen-environment-scripts.in.
Quoted 17 lines
Quoted 17 lines
README +1
-0+ Python Runtime Libraries ========================config/StdGNU.mk +8
-0@@ -1,3 +1,17 @@ +# These are standard defaults which you can use to avoid having +# to run ./configure -- you can use this to compile the hypervisor +# and the mini os: +# +# make xen +# sudo make -C xen install +# +# make -C extras/mini-os
Quoted 8 lines
config/StdGNU.mk line 13
Quoted 5 lines
config/StdGNU.mk +5
-0+include $(XEN_ROOT)/config/defaults.mk + +# This comes from running configure and will override +# the defaults. +-include $(XEN_ROOT)/config/Toplevel.mkAs I said in the reply to the subthread started by Jan I don't think any of this belongs here.
OK.
Quoted 36 lines
Quoted 36 lines
new file mode 100644
index 0000000..7dd7a53config/xen-environment-header.in new file +13
-0@@ -0,0 +1,13 @@ +#define SBINDIR "@SBINDIR@" +#define BINDIR "@BINDIR@" +#define LIBEXEC "@LIBEXEC@" +#define LIBDIR "@LIBDIR@" +#define SHAREDIR "@SHAREDIR@" + +#define PRIVATE_BINDIR "@PRIVATE_BINDIR@" +#define XENFIRMWAREDIR "@XENFIRMWAREDIR@" +#define XEN_CONFIG_DIR "@XEN_CONFIG_DIR@" +#define XEN_SCRIPT_DIR "@XEN_SCRIPT_DIR@" +#define XEN_LOCK_DIR "@XEN_LOCK_DIR@" +#define XEN_RUN_DIR "@XEN_RUN_DIR@" +#define XEN_PAGING_DIR "@XEN_PAGING_DIR@"config/xen-environment-scripts.in new file +12
-0@@ -0,0 +1,15 @@ +SBINDIR="@SBINDIR@" +BINDIR="@BINDIR@" +LIBEXEC="@LIBEXEC@" +LIBDIR="@LIBDIR@" +SHAREDIR="@SHAREDIR@" + +PRIVATE_BINDIR="@PRIVATE_BINDIR@" +XENFIRMWAREDIR="@XENFIRMWAREDIR@" +XEN_CONFIG_DIR="@XEN_CONFIG_DIR@" +XEN_SCRIPT_DIR="@XEN_SCRIPT_DIR@" +XEN_LOCK_DIR="@XEN_LOCK_DIR@" +XEN_LOG_DIR="@XEN_LOG_DIR@"
Quoted 8 lines
config/xen-environment-scripts.in line 15
Quoted 3 lines
config/xen-environment-scripts.in new file +3
-0+XEN_LIB_STORED="@XEN_LIB_STORED@" +XEN_RUN_DIR="@XEN_RUN_DIR@" +XEN_PAGING_DIR="@XEN_PAGING_DIR@"The downside of these is that we now need to keep both in sync. I think a reasonable compromise would be to generate the scripts version of this via autoconf and create the C version using a mechanism similar to the existing buildmakevars2file etc stuff.
OK I kept only config/xen-environment-scripts.in and repurposed buildmakevars2file for C header generation.
Quoted 4 lines
m4/expand_config.m4
Quoted 1 line
m4/expand_config.m4 +0
-0
expand_configis a strange name for this, paths.m4 would be more descriptive, wouldn't it?
Sure.
Quoted 1 line
Or this sort of thing wouldn't be out of place in confgure.ac I think.
Quoted 10 lines
Quoted 10 lines
new file mode 100644
index 0000000..717fcd1m4/expand_config.m4 new file +5
-0@@ -0,0 +1,61 @@ +AC_DEFUN([AX_XEN_EXPAND_CONFIG], [ +dnl expand these early so we can use this for substitutions +test "x$prefix" = "xNONE" && prefix=$ac_default_prefix +test "x$exec_prefix" = "xNONE" && exec_prefix=$ac_default_prefix +
Quoted 8 lines
m4/expand_config.m4 line 10
Quoted 5 lines
m4/expand_config.m4 new file +5
-0+BINDIR=$prefix/bin +AC_SUBST(BINDIR) + +SBINDIR=$prefix/sbin +AC_SUBST(SBINDIR)TBH I thought that after going through all this fuss --bindir and --sbindir might worl.
We can surely do that but that is an atomic change and I'd much prefer this was treated separately as a separate patch given that this would change existing behavior. If you want me to roll this in I can do so but do not think that's a good idea for regression analysis.
Quoted 15 lines
stubdom/Makefile TARGET_LDFLAGS += -nostdlib -L$(CROSS_PREFIX)/$(GNU_TARGET_ARCH)-xen-elf/lib · line 54
Quoted 12 lines
stubdom/Makefile +4
-0@@ -48,18 +48,19 @@ TARGET_LDFLAGS += -nostdlib -L$(CROSS_PREFIX)/$(GNU_TARGET_ARCH)-xen-elf/lib TARGETS=$(STUBDOM_TARGETS) +STUBDOMPATH="stubdompath.sh" + +$(STUBDOMPATH): $(XEN_ROOT)/config/xen-environment-scripts + @cp $(XEN_ROOT)/config/xen-environment-scripts $@cp $< $@
Quoted 3 lines
Not sure it needs hiding from the user either.
(there are a few of these)
OK.
Quoted 6 lines
Quoted 6 lines
stubdom/configure.ac +0
-0@@ -16,6 +16,9 @@ m4_include([../m4/features.m4]) m4_include([../m4/path_or_fail.m4])
Quoted 8 lines
stubdom/configure.ac m4_include([../m4/features.m4]) · line 21
Quoted 5 lines
stubdom/configure.ac +3
-0m4_include([../m4/depends.m4]) m4_include([../m4/fetcher.m4]) +m4_include([../m4/expand_config.m4]) + +AX_XEN_EXPAND_CONFIG()Doesn't only the toplevel configure.ac need this, because you've put the things into
config/Toplevel.mk(soon to beconfig/Paths.mk).
I had similar expectations and was equally surprised to see this didn't fly.
Here's the latest version of the patch let me know what you folks think, I think its pointless to foll in a new series just to address this rather more important change.
From: "Luis R. Rodriguez" <[email protected]>
Date: Mon, 28 Apr 2014 03:52:29 -0700
Subject: [PATCH] autoconf: xen: move standard path variables to
config/Paths.mk.in
This moves all generic path variables to a new the config/Paths.mk.in input source file to be processed at configure time, tons of files use these so this just share them. This also paves the way to let us easily dynamically configure these with autoconf, for now we leave the same presets as was present before.
This work was prompted by looking for an autoconf way to do replacements for the hotplug global file, while at it I realized that a few other files use the same variables and have in places around the tree the same constructs for generating their own files. This replaces all that with a *one* central file script file, and lets us generate the C header file from the first one. To do this we repuropose buildmakevars2file Makefile helper to generate the header file.
This has no impact on building the hypervisor and extras/mini-os, you do not need to, and are not expected to, run configure to build those targets.
While at it lets add some documentation on the for the two files on the source file, we can expand further details on the wiki [0].
[0] http://wiki.xen.org/wiki/Category:Host_Configuration#System_wide_xen_configuration
--- .gitignore | 3 ++ Config.mk | 9 +++++- Makefile | 18 +++++++++++- config/Paths.mk.in | 23 +++++++++++++++ config/Stubdom.mk.in | 1 + config/xen-environment-scripts.in | 35 ++++++++++++++++++++++ configure.ac | 9 +++++- m4/paths.m4 | 61 +++++++++++++++++++++++++++++++++++++++ stubdom/Makefile | 18 +++++++----- stubdom/configure.ac | 3 ++ tools/Rules.mk | 1 + tools/configure.ac | 3 ++ tools/hotplug/common/Makefile | 6 ++-- tools/libxl/Makefile | 11 ++----- tools/python/Makefile | 6 ++-- 15 files changed, 182 insertions(+), 25 deletions(-) create mode 100644 config/Paths.mk.in create mode 100644 config/xen-environment-scripts.in create mode 100644 m4/paths.m4
.gitignore +3 -0
@@ -36,6 +36,9 @@ config.log config.status config.cache config/Toplevel.mk +config/Paths.mk +config/xen-environment-scripts +config/xen-environment-header build-* dist/*
Config.mk +8 -1
@@ -175,10 +175,17 @@ define buildmakevars2file-closure SBINDIR BINDIR LIBEXEC LIBDIR SHAREDIR PRIVATE_BINDIR \ XENFIRMWAREDIR XEN_CONFIG_DIR XEN_SCRIPT_DIR XEN_LOCK_DIR \ XEN_RUN_DIR XEN_PAGING_DIR, \ - echo "$(var)=\"$($(var))\"" >>$(1).tmp;) \ + echo "#define $(var) \"$($(var))\"" >>$(1).tmp;) \ $(call move-if-changed,$(1).tmp,$(1)) endef +empty_genpath = $(eval $(call empty_genpath-closure)) +define empty_genpath-closure + .PHONY: genpath-skip + genpath-skip: + @# do nothing +endef + ifeq ($(debug_symbols),y) CFLAGS += -g endif
Makefile +17 -1
@@ -39,10 +39,26 @@ endif test: $(MAKE) -C tools/python test +XEN_ENV_HEADER="$(XEN_ROOT)/config/xen-environment-header" +CONFIG_RUN="$(XEN_ROOT)/config.status" + +genpath-target = $(call buildmakevars2file,$(XEN_ENV_HEADER)) +$(eval $(genpath-target)) + +genpath-ignore = $(call empty_genpath) +$(eval $(genpath-ignore)) + +# This generates xen-environment-header only if configure has been run +ifneq ("$(wildcard $(CONFIG_RUN))","") + XENGENPATH=genpath-skip +else + XENGENPATH=genpath +endif + # build and install everything into local dist directory .PHONY: dist dist: DESTDIR=$(DISTDIR)/install -dist: $(TARGS_DIST) dist-misc +dist: $(XENGENPATH) $(TARGS_DIST) dist-misc dist-misc: $(INSTALL_DIR) $(DISTDIR)/
config/Paths.mk.in new file +23 -0
@@ -0,0 +1,23 @@ +SBINDIR := @SBINDIR@ +BINDIR := @BINDIR@ +LIBEXEC := @LIBEXEC@ + +SHAREDIR := @SHAREDIR@ +LIBDIR := @LIBDIR@ + +XEN_RUN_DIR := @XEN_RUN_DIR@ +XEN_LOG_DIR := @XEN_LOG_DIR@ +XEN_LIB_STORED := @XEN_LIB_STORED@ + +CONFIG_DIR := @CONFIG_DIR@ +XEN_LOCK_DIR := @XEN_LOCK_DIR@ +XEN_PAGING_DIR := @XEN_PAGING_DIR@ + +PRIVATE_PREFIX := @PRIVATE_PREFIX@ +PRIVATE_PREFIX := @PKG_XEN_PREFIX@ +PRIVATE_BINDIR := @PRIVATE_BINDIR@ + +XENFIRMWAREDIR := @XENFIRMWAREDIR@ + +XEN_CONFIG_DIR := @XEN_CONFIG_DIR@ +XEN_SCRIPT_DIR := @XEN_SCRIPT_DIR@
config/Stubdom.mk.in +1 -0
@@ -1,4 +1,5 @@ # Prefix and install folder +include $(XEN_ROOT)/config/Paths.mk prefix := @prefix@ PREFIX := $(prefix) exec_prefix := @exec_prefix@
config/xen-environment-scripts.in new file +35 -0
@@ -0,0 +1,35 @@ +# Xen system configuration +# ======================== +# +# Xen uses a set of variables for system configuration and at build time, +# because of this these variables are defined one master input source file +# and is generated after running ./configure. The master source is located +# on the xen source tree at under config/xen-environment-scripts.in and it +# is used to generate config/xen-environment-scripts after ./configure has +# been run. The C header file is generated after make is run. There are two +# files the build system can then use, one for scripts (bash, python) and +# another for C / header files: +# +# * config/xen-environment-scripts +# * config/xen-environment-header +# +# These files may be used by the build system to generate local copies +# for their own purpose. For more documentation you can refer to the wiki: +# +# http://wiki.xen.org/wiki/Category:Host_Configuration#System_wide_xen_configuration + +SBINDIR="@SBINDIR@" +BINDIR="@BINDIR@" +LIBEXEC="@LIBEXEC@" +LIBDIR="@LIBDIR@" +SHAREDIR="@SHAREDIR@" + +PRIVATE_BINDIR="@PRIVATE_BINDIR@" +XENFIRMWAREDIR="@XENFIRMWAREDIR@" +XEN_CONFIG_DIR="@XEN_CONFIG_DIR@" +XEN_SCRIPT_DIR="@XEN_SCRIPT_DIR@" +XEN_LOCK_DIR="@XEN_LOCK_DIR@" +XEN_LOG_DIR="@XEN_LOG_DIR@" +XEN_LIB_STORED="@XEN_LIB_STORED@" +XEN_RUN_DIR="@XEN_RUN_DIR@" +XEN_PAGING_DIR="@XEN_PAGING_DIR@"
configure.ac +8 -1
@@ -5,12 +5,19 @@ AC_PREREQ([2.67]) AC_INIT([Xen Hypervisor], m4_esyscmd([./version.sh ./xen/Makefile]), [[email protected]], [xen], [http://www.xen.org/]) AC_CONFIG_SRCDIR([./xen/common/kernel.c]) -AC_CONFIG_FILES([./config/Toplevel.mk]) +AC_CONFIG_FILES([ + config/Toplevel.mk + config/Paths.mk + config/xen-environment-scripts +]) AC_CANONICAL_HOST m4_include([m4/features.m4]) m4_include([m4/subsystem.m4]) +m4_include([m4/paths.m4]) + +AX_XEN_EXPAND_CONFIG() dnl mini-os is only ported to certain platforms case "$host_cpu" in
m4/paths.m4 new file +61 -0
61 lines not on this page · raw message
stubdom/Makefile +10 -8
@@ -7,6 +7,7 @@ export stubdom=y export debug=y include $(XEN_ROOT)/Config.mk -include $(XEN_ROOT)/config/Stubdom.mk +include $(XEN_ROOT)/config/Paths.mk GNU_TARGET_ARCH:=$(XEN_TARGET_ARCH) ifeq ($(XEN_TARGET_ARCH),x86_32)
@@ -48,18 +49,19 @@ TARGET_LDFLAGS += -nostdlib -L$(CROSS_PREFIX)/$(GNU_TARGET_ARCH)-xen-elf/lib TARGETS=$(STUBDOM_TARGETS) +STUBDOMPATH="stubdompath.sh" + +$(STUBDOMPATH): $(XEN_ROOT)/config/xen-environment-scripts + cp $(XEN_ROOT)/config/xen-environment-scripts $@ + .PHONY: all all: build ifeq ($(STUBDOM_SUPPORTED),1) -build: genpath $(STUBDOM_BUILD) +build: $(STUBDOMPATH) $(STUBDOM_BUILD) else -build: genpath +build: $(STUBDOMPATH) endif -STUBDOMPATH="stubdompath.sh" -genpath-target = $(call buildmakevars2file,$(STUBDOMPATH)) -$(eval $(genpath-target)) - ############## # Cross-newlib ##############
@@ -448,9 +450,9 @@ xenstore-stubdom: mini-os-$(XEN_TARGET_ARCH)-xenstore libxc xenstore ######### ifeq ($(STUBDOM_SUPPORTED),1) -install: genpath install-readme $(STUBDOM_INSTALL) +install: $(STUBDOMPATH) install-readme $(STUBDOM_INSTALL) else -install: genpath +install: $(STUBDOMPATH) endif install-readme:
stubdom/configure.ac +3 -0
@@ -16,6 +16,9 @@ m4_include([../m4/features.m4]) m4_include([../m4/path_or_fail.m4]) m4_include([../m4/depends.m4]) m4_include([../m4/fetcher.m4]) +m4_include([../m4/paths.m4]) + +AX_XEN_EXPAND_CONFIG() # Enable/disable stub domains AX_STUBDOM_CONDITIONAL([ioemu-stubdom], [ioemu])
tools/Rules.mk +1 -0
@@ -5,6 +5,7 @@ all: -include $(XEN_ROOT)/config/Tools.mk include $(XEN_ROOT)/Config.mk +include $(XEN_ROOT)/config/Paths.mk export _INSTALL := $(INSTALL) INSTALL = $(XEN_ROOT)/tools/cross-install
tools/configure.ac +3 -0
@@ -47,6 +47,9 @@ m4_include([../m4/ptyfuncs.m4]) m4_include([../m4/extfs.m4]) m4_include([../m4/fetcher.m4]) m4_include([../m4/ax_compare_version.m4]) +m4_include([../m4/paths.m4]) + +AX_XEN_EXPAND_CONFIG() # Enable/disable options AX_ARG_DEFAULT_DISABLE([githttp], [Download GIT repositories via HTTP])
tools/hotplug/common/Makefile +3 -3
@@ -9,14 +9,14 @@ HOTPLUGPATH="hotplugpath.sh" XEN_SCRIPTS = XEN_SCRIPT_DATA = $(HOTPLUGPATH) -genpath-target = $(call buildmakevars2file,$(HOTPLUGPATH)) -$(eval $(genpath-target)) +$(HOTPLUGPATH): $(XEN_ROOT)/config/xen-environment-scripts + cp $(XEN_ROOT)/config/xen-environment-scripts $@ .PHONY: all all: build .PHONY: build -build: genpath +build: $(HOTPLUGPATH) .PHONY: install install: all install-scripts
tools/libxl/Makefile +3 -8
@@ -97,6 +97,9 @@ TEST_PROGS += $(foreach t, $(LIBXL_TESTS),test_$t) $(LIBXL_OBJS) $(LIBXL_TEST_OBJS): CFLAGS += $(CFLAGS_LIBXL) -include $(XEN_ROOT)/tools/config.h +_paths.h: $(XEN_ROOT)/config/xen-environment-header + @cp $(XEN_ROOT)/config/xen-environment-header $@ + AUTOINCS= libxlu_cfg_y.h libxlu_cfg_l.h _libxl_list.h _paths.h \ libxlu_disk_l.h _libxl_save_msgs_callout.h _libxl_save_msgs_helper.h AUTOSRCS= libxlu_cfg_y.c libxlu_cfg_l.c
@@ -141,9 +144,6 @@ $(LIBXL_OBJS) $(LIBXLU_OBJS) $(XL_OBJS) $(SAVE_HELPER_OBJS) \ @rm -f $*.[ch] $(FLEX) --header-file=$*.h --outfile=$*.c $< -genpath-target = $(call buildmakevars2file,_paths.h.tmp) -$(eval $(genpath-target)) - libxl.api-ok: check-libxl-api-rules _libxl.api-for-check $(PERL) $^ touch $@
@@ -154,11 +154,6 @@ _%.api-for-check: %.h $(AUTOINCS) >[email protected] mv -f [email protected] $@ -_paths.h: genpath - sed -e "s/\([^=]*\)=\(.*\)/#define \1 \2/g" [email protected] >[email protected] - rm -f [email protected] - $(call move-if-changed,[email protected],$@) - _libxl_list.h: $(XEN_INCLUDE)/xen-external/bsd-sys-queue-h-seddery $(XEN_INCLUDE)/xen-external/bsd-sys-queue.h $(PERL) $^ --prefix=libxl >[email protected] $(call move-if-changed,[email protected],$@)
tools/python/Makefile +3 -3
@@ -6,11 +6,11 @@ all: build XENPATH = "xen/util/path.py" -genpath-target = $(call buildmakevars2file,$(XENPATH)) -$(eval $(genpath-target)) +$(XENPATH): $(XEN_ROOT)/config/xen-environment-scripts + cp $(XEN_ROOT)/config/xen-environment-scripts $@ .PHONY: build -build: genpath genwrap.py $(XEN_ROOT)/tools/libxl/libxl_types.idl \ +build: $(XENPATH) genwrap.py $(XEN_ROOT)/tools/libxl/libxl_types.idl \ $(XEN_ROOT)/tools/libxl/idl.py PYTHONPATH=$(XEN_ROOT)/tools/libxl $(PYTHON) genwrap.py \ $(XEN_ROOT)/tools/libxl/libxl_types.idl \
Signature · 1 line
2.0.0.rc3.18.g00a5b79
Re: [PATCH v5 11/14] autoconf: xen: move standard variables to a generic place
Quoted 19 lines · Luis R. Rodriguez
Quoted 10 lines
Quoted 10 lines
new file mode 100644
index 0000000..717fcd1m4/expand_config.m4 new file +5
-0@@ -0,0 +1,61 @@ +AC_DEFUN([AX_XEN_EXPAND_CONFIG], [ +dnl expand these early so we can use this for substitutions +test "x$prefix" = "xNONE" && prefix=$ac_default_prefix +test "x$exec_prefix" = "xNONE" && exec_prefix=$ac_default_prefix +Quoted 8 lines
m4/expand_config.m4 line 10
Quoted 5 lines
m4/expand_config.m4 new file +5
-0+BINDIR=$prefix/bin +AC_SUBST(BINDIR) + +SBINDIR=$prefix/sbin +AC_SUBST(SBINDIR)TBH I thought that after going through all this fuss --bindir and --sbindir might worl.
Quoted 4 lines
We can surely do that but that is an atomic change and I'd much prefer this was treated separately as a separate patch given that this would change existing behavior. If you want me to roll this in I can do so but do not think that's a good idea for regression analysis.
Fair enough, if you feel like doing a followup that would be fine, or else we can leave it for now.
Quoted 15 lines
Quoted 6 lines
Quoted 6 lines
stubdom/configure.ac +0
-0@@ -16,6 +16,9 @@ m4_include([../m4/features.m4]) m4_include([../m4/path_or_fail.m4])Quoted 8 lines
stubdom/configure.ac m4_include([../m4/features.m4]) · line 21
Quoted 5 lines
stubdom/configure.ac +3
-0m4_include([../m4/depends.m4]) m4_include([../m4/fetcher.m4]) +m4_include([../m4/expand_config.m4]) + +AX_XEN_EXPAND_CONFIG()Doesn't only the toplevel configure.ac need this, because you've put the things into
config/Toplevel.mk(soon to beconfig/Paths.mk).
Quoted 1 line
I had similar expectations and was equally surprised to see this didn't fly.
Possibly this will go away with moving things to config/Path.mk instead of Toplevel.mk?
Quoted 2 lines
Here's the latest version of the patch let me know what you folks think,
It's much better, thanks. Still some comments though.
Config.mk define buildmakevars2file-closure
Quoted 5 lines
Config.mk +0
-0@@ -175,10 +175,17 @@ define buildmakevars2file-closure
You should probably rename the function, both to make it match the new behaviour and to root out all the existing uses.
Quoted 4 lines
Config.mk +0
-1SBINDIR BINDIR LIBEXEC LIBDIR SHAREDIR PRIVATE_BINDIR \ XENFIRMWAREDIR XEN_CONFIG_DIR XEN_SCRIPT_DIR XEN_LOCK_DIR \ XEN_RUN_DIR XEN_PAGING_DIR, \ - echo "$(var)=\"$($(var))\"" >>$(1).tmp;) \
Config.mk define buildmakevars2file-closure · line 187
Quoted 10 lines
Config.mk +7
-0+ echo "#define $(var) \"$($(var))\"" >>$(1).tmp;) \ $(call move-if-changed,$(1).tmp,$(1)) endef +empty_genpath = $(eval $(call empty_genpath-closure)) +define empty_genpath-closure + .PHONY: genpath-skip + genpath-skip: + @# do nothing +endef
What is this for?
Quoted 9 lines
Config.mk +1
-0+ ifeq ($(debug_symbols),y) CFLAGS += -g endifMakefile +0
-0
Makefile endif · line 46
Quoted 8 lines
Makefile +5
-0@@ -39,10 +39,26 @@ endif test: $(MAKE) -C tools/python test +XEN_ENV_HEADER="$(XEN_ROOT)/config/xen-environment-header" +CONFIG_RUN="$(XEN_ROOT)/config.status" + +genpath-target = $(call buildmakevars2file,$(XEN_ENV_HEADER)) +$(eval $(genpath-target))
I intended for you to use this in each of the submakefiles which needs it rather than at the toplevel, to avoid interactions with the xen and mini-os subtrees. Is there some particular reason to put them here?
config/xen-environment-scripts.in
Quoted 5 lines
config/xen-environment-scripts.in new file +0
-0
This appears to be completely duplicating Paths.mk.
config/xen-environment-scripts.in
Quoted 3 lines
config/xen-environment-scripts.in new file +3
-0+m4_include([../m4/paths.m4]) + +AX_XEN_EXPAND_CONFIG()
I think with your latest changes you should try again removing these from all the sub-configures. If it doesn't work please show the error and we'll see if we can figure something out.
Ian.
PATCH v5 12/14 autoconf: xen: enable explicit preference option for xenstored preference
In reply to Luis R. RodriguezFrom: "Luis R. Rodriguez" <[email protected]>
As it stands oxenstored will be used by default if ocaml tools are found, the init system will also try to use oxenstored first if its found otherwise the cxenstored will be used. Lets simplify the init script and let users be explicit about the preference through configure.
This adds support to let you be explicit about the xenstored preference, you can only use one of these two options:
./configure --with-xenstored=cxenstored
./configure --with-xenstored=oxenstored
We continue with the old behaviour and default oxenstored will be used but only if you have ocaml dependencies. Since the xenstored preference is explicit now we can move it to the shared top level config and use this to simplify both the legacy init script and eventually our systemd service files. This should also make it clear on how you can still enable usage of cxenstored but still also use ocaml tools. If you have both oxenstored and cxenstored installed you can change the xenstore by a simple flip on the system configuration file.
In order to help with documentation we update the README with some details on configure usage refer to the wiki [0] [1] [2] for more elaborate details.
[0] http://wiki.xen.org/wiki/Xenstored
[1] http://wiki.xen.org/wiki/XenStore
[2] http://wiki.xen.org/wiki/XenStoreReference
---
Please run ./autgen.sh after this patch is applied.
README | 34 +++++++++++++++++++ config/Toplevel.mk.in | 3 ++ config/xen-environment-header.in | 3 ++ config/xen-environment-scripts.in | 3 ++ configure.ac | 1 + m4/expand_config.m4 | 61 +++++++++++++++++++++++++++++++++++ stubdom/configure.ac | 1 + tools/hotplug/Linux/init.d/xencommons | 6 ---- 8 files changed, 106 insertions(+), 6 deletions(-)
README +34 -0
@@ -145,6 +145,40 @@ Further documentation can be found on the wiki: http://wiki.xen.org/wiki/Category:Host_Configuration#System_wide_xen_configuration +xenstored: cxenstored and oxenstored +==================================== + +Xen uses a xenstore [0] to upkeep configuration and status information shared +between domains. A daemon is provided to help respond to queries from dom0 +and guests, details for the xenstored can be found on the wiki's xenstored [2] +page. Two xenstored daemons are supported and you can choose which xenstored +you want to enable on a system through configure: + + ./configure --with-xenstored=cxenstored + ./configure --with-xenstored=oxenstored + +By defalut oxenstored will be used if the ocaml development tools are found. +If you enable oxenstored the cxenstored will still be built and installed, +the xenstored used can be changed through the configuration file: + +/etc/xen/scripts/hotplugpath.sh + +This file has two relevant variables which are specific to the version of +xenstored used: + + * XENSTORED - specifies the full path of the xenstored binary + * XENSTORE - specifies the name of the xenstored binary + +You can change the preferred xenstored you want to use in the configuration +but since we cannot stop the daemon a reboot will be required to make the +change take effect. The original /etc/xen/scripts/hotplugpath.sh is sourced +from the general xen system configuration file documented above, which is +generated at build time after running ./configure. + +[0] http://wiki.xen.org/wiki/XenStore +[1] http://wiki.xen.org/wiki/XenStoreReference +[2] http://wiki.xen.org/wiki/Xenstored + Python Runtime Libraries ========================
config/Toplevel.mk.in +3 -0
@@ -23,3 +23,6 @@ XENFIRMWAREDIR := @XENFIRMWAREDIR@ XEN_CONFIG_DIR := @XEN_CONFIG_DIR@ XEN_SCRIPT_DIR := @XEN_SCRIPT_DIR@ + +XENSTORED := @XENSTORED@ +XENSTORE := @XENSTORE@
config/xen-environment-header.in +3 -0
@@ -11,3 +11,6 @@ #define XEN_LOCK_DIR "@XEN_LOCK_DIR@" #define XEN_RUN_DIR "@XEN_RUN_DIR@" #define XEN_PAGING_DIR "@XEN_PAGING_DIR@" + +#define XENSTORED @XENSTORED@ +#define XENSTORE @XENSTORE@
config/xen-environment-scripts.in +3 -0
@@ -13,3 +13,6 @@ XEN_LOG_DIR="@XEN_LOG_DIR@" XEN_LIB_STORED="@XEN_LIB_STORED@" XEN_RUN_DIR="@XEN_RUN_DIR@" XEN_PAGING_DIR="@XEN_PAGING_DIR@" + +XENSTORED="@XENSTORED@" +XENSTORE="@XENSTORE@"
configure.ac +1 -0
@@ -16,6 +16,7 @@ AC_CANONICAL_HOST m4_include([m4/features.m4]) m4_include([m4/subsystem.m4]) m4_include([m4/expand_config.m4]) +m4_include([m4/ocaml.m4]) AX_XEN_EXPAND_CONFIG()
m4/expand_config.m4 +61 -0
65 lines not on this page · raw message
stubdom/configure.ac +1 -0
@@ -17,6 +17,7 @@ m4_include([../m4/path_or_fail.m4]) m4_include([../m4/depends.m4]) m4_include([../m4/fetcher.m4]) m4_include([../m4/expand_config.m4]) +m4_include([../m4/ocaml.m4]) AX_XEN_EXPAND_CONFIG()
tools/hotplug/Linux/init.d/xencommons +0 -6
@@ -83,12 +83,6 @@ do_start () { if [ -n "$XENSTORED" ] ; then echo -n Starting $XENSTORED... $XENSTORED --pid-file /var/run/xenstored.pid $XENSTORED_ARGS - elif [ -x ${SBINDIR}/oxenstored ] ; then - echo -n Starting oxenstored... - ${SBINDIR}/oxenstored --pid-file /var/run/xenstored.pid $XENSTORED_ARGS - elif [ -x ${SBINDIR}/xenstored ] ; then - echo -n Starting C xenstored... - ${SBINDIR}/xenstored --pid-file /var/run/xenstored.pid $XENSTORED_ARGS else echo "No xenstored found" exit 1
Signature · 1 line
2.0.0.rc3.18.g00a5b79
Re: [PATCH v5 12/14] autoconf: xen: enable explicit preference option for xenstored preference
Quoted 58 lines · Luis R. Rodriguez
From: "Luis R. Rodriguez" <[email protected]>
As it stands oxenstored will be used by default if ocaml tools are found, the init system will also try to use oxenstored first if its found otherwise the cxenstored will be used. Lets simplify the init script and let users be explicit about the preference through configure.
This adds support to let you be explicit about the xenstored preference, you can only use one of these two options:
./configure --with-xenstored=cxenstored
./configure --with-xenstored=oxenstoredWe continue with the old behaviour and default oxenstored will be used but only if you have ocaml dependencies. Since the xenstored preference is explicit now we can move it to the shared top level config and use this to simplify both the legacy init script and eventually our systemd service files. This should also make it clear on how you can still enable usage of cxenstored but still also use ocaml tools. If you have both oxenstored and cxenstored installed you can change the xenstore by a simple flip on the system configuration file.
In order to help with documentation we update the README with some details on configure usage refer to the wiki [0] [1] [2] for more elaborate details.
[0] http://wiki.xen.org/wiki/Xenstored
[1] http://wiki.xen.org/wiki/XenStore
[2] http://wiki.xen.org/wiki/XenStoreReferenceCc Ian Campbell <[email protected]>Cc Ian Jackson <[email protected]>Cc Jan Beulich <[email protected]>Cc Keir Fraser <[email protected]>Cc Tim Deegan <[email protected]>Signed-off-by Luis R. Rodriguez <[email protected]>---
Please run ./autgen.sh after this patch is applied.
README | 34 +++++++++++++++++++ config/Toplevel.mk.in | 3 ++ config/xen-environment-header.in | 3 ++ config/xen-environment-scripts.in | 3 ++ configure.ac | 1 + m4/expand_config.m4 | 61 +++++++++++++++++++++++++++++++++++ stubdom/configure.ac | 1 + tools/hotplug/Linux/init.d/xencommons | 6 ---- 8 files changed, 106 insertions(+), 6 deletions(-)README +0
-0@@ -145,6 +145,40 @@ Further documentation can be found on the wiki:http://wiki.xen.org/wiki/Category:Host_Configuration#System_wide_xen_configuration
README Further documentation can be found on the wiki: · line 151
Quoted 4 lines
README +4
-0+xenstored: cxenstored and oxenstored +==================================== + +Xen uses a xenstore [0] to upkeep configuration and status information shared
s/a xenstore/xenstore/
or uses a configuration database (xenstore[0]).
"upkeep" is not the word you are looking for either. ...to store... is probably correct, or maintain.
README
Quoted 2 lines
README +2
-0+between domains. A daemon is provided to help respond to queries from dom0 +and guests,
Well, the daemon is provided because it is the thing which implemented the xenstore. Saying it is provided to respond to queries is a strange way to phrase it.
README Further documentation can be found on the wiki: · line 155
Quoted 3 lines
details for the xenstored can be found on the wiki's xenstored [2]
README +2
-0+page. Two xenstored daemons are supported and you can choose which xenstored +you want to enable on a system through configure:
^ by default (I hope, it should be possible to
change my mind by editing the configuration without rebuilding)
README Further documentation can be found on the wiki: · line 160
Quoted 5 lines
README +5
-0+ + ./configure --with-xenstored=cxenstored + ./configure --with-xenstored=oxenstored + +By defalut oxenstored will be used if the ocaml development tools are found.
"default"
README Further documentation can be found on the wiki: · line 164
Quoted 4 lines
README +4
-0+If you enable oxenstored the cxenstored will still be built and installed, +the xenstored used can be changed through the configuration file: + +/etc/xen/scripts/hotplugpath.sh
That's an unconventional place for such a configuration. Today it is in /etc/{sysconfig,default}/xencommons, I think, which is more expected IMHO. That comes from tools/hotplug/Linux/init.d/sysconfig.xencommons.
It might be reasonable for hotplugpath.sh to define XENSTORE_xenstored=/path/to/xenstored XENSTORE_oxenstored=/path/to/oxenstored
and use the existing XENSTORED variable in sysconfig to select which.
This would also avoid the user having to update the name and the path (as would the use of basename mind you)
m4/expand_config.m4 AC_SUBST(XEN_RUN_DIR) · line 58
Quoted 6 lines
m4/expand_config.m4 +0
-0@@ -58,4 +58,65 @@ AC_SUBST(XEN_RUN_DIR)
I'd say that most of this belongs in something which is handled from tools/configure.ac not the top level. m4/xenstored.m4 seems logical.
m4/expand_config.m4 AC_SUBST(XEN_RUN_DIR) · line 65
Quoted 7 lines
m4/expand_config.m4 +5
-0XEN_PAGING_DIR=/var/lib/xen/xenpaging AC_SUBST(XEN_PAGING_DIR) + +AC_DEFUN([AX_XEN_OCAML_XENSTORE_CHECK], [ + AC_PROG_OCAML + AC_PROG_FINDLIB + AS_IF([test "x$OCAMLC" = "xno" || test "x$OCAMLFIND" = "xno"], [
THen you could rely on m4/ocaml.m4 to have checked all this already.
m4/expand_config.m4 AC_SUBST(XEN_RUN_DIR) · line 70
Quoted 5 lines
m4/expand_config.m4 +5
-0+ AC_MSG_ERROR([Missing ocaml dependencies for oxenstored, try installing ocaml ocaml-compiler-libs ocaml-runtime ocaml-findlib]) + ]) +]) + +AC_DEFUN([AX_XEN_OCAML_XENSTORE_DEFAULTS], [
Why is this separate from CHECK? Also there can't be any need to call AC_PROG_{OCAML,FINDLIB} quite as many times as you do, surely.
Quoted 12 lines
m4/expand_config.m4 +12
-0+ xenstore="oxenstored" + xenstored=$SBINDIR/oxenstored + AC_PROG_OCAML + AC_PROG_FINDLIB + AS_IF([test "x$OCAMLC" = "xno" || test "x$OCAMLFIND" = "xno"], [ + xenstore="cxenstored" + xenstored=$SBINDIR/xenstored + ]) +]) + +AS_IF([test "x$XENSTORE" = "x"], [ +AC_ARG_WITH([xenstored],
m4/expand_config.m4 AC_SUBST(XEN_RUN_DIR) · line 92
Quoted 10 lines
m4/expand_config.m4 +10
-0+ AS_HELP_STRING([--with-xenstored@<:@=cxenstored|cxenstored@:>@], + [This lets you choose which xenstore daemon you want, you have + two options: the original xenstored written in C (cxenstored) + or the newer and robust one written in Ocaml (oxenstored). + The oxenstored daemon is the default but will but can only + be used if you have ocaml library / build dependencies solved, + if you have not specified a preference and do not have ocaml + dependencies resolved we'll enable the C xenstored for you. If + you ask for oxenstored we'll complain until you resolve those + dependencies]),
Does this not end up with an overly verbose configure --help output?
m4/expand_config.m4 AC_SUBST(XEN_RUN_DIR) · line 102
Quoted 10 lines
m4/expand_config.m4 +10
-0+ [ + AS_IF([test "x$withval" = "xcxenstored"], [ + xenstore="cxenstored" + xenstored=$SBINDIR/xenstored + ]) + AS_IF([test "x$withval" = "xoxenstored"], [ + xenstore="oxenstored" + xenstored=$SBINDIR/oxenstored + AX_XEN_OCAML_XENSTORE_CHECK() + ])
xenstore=$withval
if $xenstore = ocaml && ocaml not detected ;
AC_ERROR[].
fi
Quoted 9 lines
m4/expand_config.m4 +9
-0+ AS_IF([test "x$withval" != "xoxenstored" && test "x$withval" != "xcxenstored"], [ + AC_MSG_ERROR([Unsupported xenstored specified, supported types: oxenstored cxenstored]) + ]) + ], + [ + AX_XEN_OCAML_XENSTORE_DEFAULTS() + ]) +]) +
m4/expand_config.m4 AC_SUBST(XEN_RUN_DIR) · line 121
Quoted 10 lines
m4/expand_config.m4 +10
-0+XENSTORE=$xenstore +AC_SUBST(XENSTORE) + +AS_IF([test "x$XENSTORED" = "x"], [ + XENSTORED=$xenstored +]) +AC_SUBST(XENSTORED) + +AS_IF([test "x$XENSTORE" != "xcxenstored" && test "x$XENSTORE" != "xoxenstored"], + [AC_MSG_ERROR([Invalid xenstore: $XENSTORE])])
Didn't this already get checked above?
m4/expand_config.m4 AC_SUBST(XEN_RUN_DIR) · line 122
Quoted 1 line
m4/expand_config.m4 +0
-0])
Ian
Re: [PATCH v5 12/14] autoconf: xen: enable explicit preference option for xenstored preference
Quoted 6 lines · Ian Campbell
Quoted 4 lines · Luis R. Rodriguez
README +0
-0
Quoted 8 lines
README Further documentation can be found on the wiki: · line 164
Quoted 4 lines
README +4
-0+If you enable oxenstored the cxenstored will still be built and installed, +the xenstored used can be changed through the configuration file: + +/etc/xen/scripts/hotplugpath.shThat's an unconventional place for such a configuration. Today it is in
/etc/{sysconfig,default}/xencommons, I think, which is more expected IMHO. That comes fromtools/hotplug/Linux/init.d/sysconfig.xencommons.
Yeah good point, I had not seen that.
Quoted 5 lines
It might be reasonable for
hotplugpath.shto define XENSTORE_xenstored=/path/to/xenstored XENSTORE_oxenstored=/path/to/oxenstoredand use the existing XENSTORED variable in sysconfig to select which.
Ah but but hotplugpath.sh is one of those automatically generated files and after my last patch in this series they are all now shared in one master file, config/xen-environment-scripts.in, and since the we want to keep script file Shell / Python agnostic checking which one is set on sysconfig is not something reasonable to do on that master file.
So here's the thing:
My series of patches already deals with the old init and xencommons script to start xenstore, it used the hotplugpath.sh for deducing the xenstore daemon it should use by default and switching this to rely on the sysconfig xencommons should be easy if it wasn't already dealt with there already.
For systemd though we can't use varibles on ExecStart for the process, we however can use environment variables. We have a few options. Fedora's approach was to use two service unit files which conflicted with each other, although I'm sure we can work it out by using a target unit and let folks flip it seems rather silly to me to maintain two service unit files with identical entries. Therefore in my new approach usres would have to manually edit the service file with the differnt path / binary. Another possibility is to have a central launcher binary that just does getenv() and execve() on the desired binary. If this is agreeable I can work on it and it could even be shared by the old init as well.
Quoted 2 lines
This would also avoid the user having to update the name and the path (as would the use of basename mind you)
Agreed.
Quoted 9 lines
m4/expand_config.m4 AC_SUBST(XEN_RUN_DIR) · line 58
Quoted 6 lines
m4/expand_config.m4 +0
-0@@ -58,4 +58,65 @@ AC_SUBST(XEN_RUN_DIR)I'd say that most of this belongs in something which is handled from
tools/configure.acnot the top level. m4/xenstored.m4 seems logical.
Sure.
Quoted 9 lines
m4/expand_config.m4 AC_SUBST(XEN_RUN_DIR) · line 65
Quoted 7 lines
m4/expand_config.m4 +5
-0XEN_PAGING_DIR=/var/lib/xen/xenpaging AC_SUBST(XEN_PAGING_DIR) + +AC_DEFUN([AX_XEN_OCAML_XENSTORE_CHECK], [ + AC_PROG_OCAML + AC_PROG_FINDLIB + AS_IF([test "x$OCAMLC" = "xno" || test "x$OCAMLFIND" = "xno"], [THen you could rely on m4/ocaml.m4 to have checked all this already.
Just including m4/ocaml.m4 won't get us much, the above logic assumes that file was included so there is a bit of a trick we need to adjust in order to avoid multiple calls to the same checks.
Quoted 8 lines
m4/expand_config.m4 AC_SUBST(XEN_RUN_DIR) · line 70
Quoted 6 lines
m4/expand_config.m4 +5
-0+ AC_MSG_ERROR([Missing ocaml dependencies for oxenstored, try installing ocaml ocaml-compiler-libs ocaml-runtime ocaml-findlib]) + ]) +]) + +AC_DEFUN([AX_XEN_OCAML_XENSTORE_DEFAULTS], [Why is this separate from CHECK?
Its not a check, I should remove the double calls to AC_PROG_OCAML and AC_PROG_OCAML, what this does is it sets the defaults based on your build system without considering any flags passed.
Quoted 2 lines
Also there can't be any need to call AC_PROG_{OCAML,FINDLIB} quite as many times as you do, surely.
We can surely move the AC_PROG_OCAML and AC_PROG_FINDLIB calls outside so that the check can be done just once. We want to support not having to pass the flag for specifying the xenstore preference.
Quoted 16 lines
Quoted 16 lines
m4/expand_config.m4 +16
-0+ xenstore="oxenstored" + xenstored=$SBINDIR/oxenstored + AC_PROG_OCAML + AC_PROG_FINDLIB + AS_IF([test "x$OCAMLC" = "xno" || test "x$OCAMLFIND" = "xno"], [ + xenstore="cxenstored" + xenstored=$SBINDIR/xenstored + ]) +]) + +AS_IF([test "x$XENSTORE" = "x"], [ +AC_ARG_WITH([xenstored], + AS_HELP_STRING([--with-xenstored@<:@=cxenstored|cxenstored@:>@], + [This lets you choose which xenstore daemon you want, you have + two options: the original xenstored written in C (cxenstored) + or the newer and robust one written in Ocaml (oxenstored).
Quoted 8 lines
m4/expand_config.m4 AC_SUBST(XEN_RUN_DIR) · line 92
Quoted 6 lines
m4/expand_config.m4 +6
-0+ The oxenstored daemon is the default but will but can only + be used if you have ocaml library / build dependencies solved, + if you have not specified a preference and do not have ocaml + dependencies resolved we'll enable the C xenstored for you. If + you ask for oxenstored we'll complain until you resolve those + dependencies]),Does this not end up with an overly verbose configure --help output?
Its fine by me, check and let me know if its too much.
Quoted 4 lines
Quoted 4 lines
m4/expand_config.m4 +4
-0+ [ + AS_IF([test "x$withval" = "xcxenstored"], [ + xenstore="cxenstored" + xenstored=$SBINDIR/xenstored
Quoted 8 lines
m4/expand_config.m4 AC_SUBST(XEN_RUN_DIR) · line 102
Quoted 6 lines
m4/expand_config.m4 +6
-0+ ]) + AS_IF([test "x$withval" = "xoxenstored"], [ + xenstore="oxenstored" + xenstored=$SBINDIR/oxenstored + AX_XEN_OCAML_XENSTORE_CHECK() + ])xenstore=$withval
OK
Quoted 3 lines
if $xenstore = ocaml && ocaml not detected ;
AC_ERROR[].
fi
That's what AX_XEN_OCAML_XENSTORE_CHECK() does, but I agree this can be simplified. Will work on that.
Quoted 14 lines
Quoted 14 lines
m4/expand_config.m4 +13
-0+ AS_IF([test "x$withval" != "xoxenstored" && test "x$withval" != "xcxenstored"], [ + AC_MSG_ERROR([Unsupported xenstored specified, supported types: oxenstored cxenstored]) + ]) + ], + [ + AX_XEN_OCAML_XENSTORE_DEFAULTS() + ]) +]) + +XENSTORE=$xenstore +AC_SUBST(XENSTORE) + +AS_IF([test "x$XENSTORED" = "x"], [
Quoted 8 lines
m4/expand_config.m4 AC_SUBST(XEN_RUN_DIR) · line 121
Quoted 6 lines
m4/expand_config.m4 +6
-0+ XENSTORED=$xenstored +]) +AC_SUBST(XENSTORED) + +AS_IF([test "x$XENSTORE" != "xcxenstored" && test "x$XENSTORE" != "xoxenstored"], + [AC_MSG_ERROR([Invalid xenstore: $XENSTORE])])Didn't this already get checked above?
Yeah I went trigger happy with checks, will remove.
Luis
Re: [PATCH v5 12/14] autoconf: xen: enable explicit preference option for xenstored preference
Quoted 11 lines · Luis R. Rodriguez
Quoted 5 lines
It might be reasonable for
hotplugpath.shto define XENSTORE_xenstored=/path/to/xenstored XENSTORE_oxenstored=/path/to/oxenstoredand use the existing XENSTORED variable in sysconfig to select which.
Ah but but
hotplugpath.shis one of those automatically generated files and after my last patch in this series they are all now shared in one master file, config/xen-environment-scripts.in, and since the we want to keep script file Shell / Python agnostic checking which one is set on sysconfig is not something reasonable to do on that master file.
Well, it must be possible to change which xenstored implementation is used by editing a single setting in /etc/{sysconfig,default}/xencommons, maybe that means more code somewhere, I don't know. idieally you would be able to say
XENSTORE=xenstored # C xenstore at default path XENSTORE=oxenstored # Ocaml xenstore at default path XENSTORE=/path/to/something # xenstored at some custom path.
Quoted 5 lines
My series of patches already deals with the old init and xencommons script to start xenstore, it used the
hotplugpath.shfor deducing the xenstore daemon it should use by default and switching this to rely on the sysconfig xencommons should be easy if it wasn't already dealt with there already.
Quoted 10 lines
For systemd though we can't use varibles on ExecStart for the process, we however can use environment variables. We have a few options. Fedora's approach was to use two service unit files which conflicted with each other, although I'm sure we can work it out by using a target unit and let folks flip it seems rather silly to me to maintain two service unit files with identical entries. Therefore in my new approach usres would have to manually edit the service file with the differnt path / binary. Another possibility is to have a central launcher binary that just does
getenv()andexecve()on the desired binary. If this is agreeable I can work on it and it could even be shared by the old init as well.
Which is considered the most "systemd" approach?
Quoted 10 lines
Quoted 9 lines
m4/expand_config.m4 AC_SUBST(XEN_RUN_DIR) · line 65
Quoted 7 lines
XEN_PAGING_DIR=/var/lib/xen/xenpaging
AC_SUBST(XEN_PAGING_DIR)m4/expand_config.m4 +5
-0+ +AC_DEFUN([AX_XEN_OCAML_XENSTORE_CHECK], [ + AC_PROG_OCAML + AC_PROG_FINDLIB + AS_IF([test "x$OCAMLC" = "xno" || test "x$OCAMLFIND" = "xno"], [THen you could rely on m4/ocaml.m4 to have checked all this already.
Quoted 3 lines
Just including m4/ocaml.m4 won't get us much, the above logic assumes that file was included so there is a bit of a trick we need to adjust in order to avoid multiple calls to the same checks.
If you do/call these checks in tools/configure.ac then I think you can just arrange to sequence things correctly with the ocaml ones by the ordering in the file.
Ian.
Re: [PATCH v5 12/14] autoconf: xen: enable explicit preference option for xenstored preference
Quoted 13 lines · Ian Campbell
Quoted 11 lines · Luis R. Rodriguez
Quoted 5 lines
It might be reasonable for
hotplugpath.shto define XENSTORE_xenstored=/path/to/xenstored XENSTORE_oxenstored=/path/to/oxenstoredand use the existing XENSTORED variable in sysconfig to select which.
Ah but but
hotplugpath.shis one of those automatically generated files and after my last patch in this series they are all now shared in one master file, config/xen-environment-scripts.in, and since the we want to keep script file Shell / Python agnostic checking which one is set on sysconfig is not something reasonable to do on that master file.
Quoted 7 lines
Well, it must be possible to change which xenstored implementation is used by editing a single setting in
/etc/{sysconfig,default}/xencommons, maybe that means more code somewhere, I don't know. idieally you would be able to say
XENSTORE=xenstored # C xenstore at default path XENSTORE=oxenstored # Ocaml xenstore at default path XENSTORE=/path/to/something # xenstored at some custom path.
Agreed.
Quoted 16 lines
Quoted 5 lines
My series of patches already deals with the old init and xencommons script to start xenstore, it used the
hotplugpath.shfor deducing the xenstore daemon it should use by default and switching this to rely on the sysconfig xencommons should be easy if it wasn't already dealt with there already.Quoted 10 lines
For systemd though we can't use varibles on ExecStart for the process, we however can use environment variables. We have a few options. Fedora's approach was to use two service unit files which conflicted with each other, although I'm sure we can work it out by using a target unit and let folks flip it seems rather silly to me to maintain two service unit files with identical entries. Therefore in my new approach usres would have to manually edit the service file with the differnt path / binary. Another possibility is to have a central launcher binary that just does
getenv()andexecve()on the desired binary. If this is agreeable I can work on it and it could even be shared by the old init as well.
Quoted 1 line
Which is considered the most "systemd" approach?
Systemd tries to even recommend to shy away from sysconfig/default directory for stashing entries, one can set environment variables within the service unit itself, but if we are to maintain compatiblity with old stuff relying on sysconfig seems the reasonable and accepted way, then we'd include that file as part of the running environment, just as our systemd service unit files do now in this series.
More details here:
http://0pointer.de/blog/projects/on-etc-sysinit.html
As for dynamic use daemons, there aren't good examples but the undocumented way of doing this but as a per a conversation at the LF Linux Collaboration summit one way to deal with this is to use one service target files for defining what we do, we'd have two separate service unit files for each cxenstored and oxenstored, the services that need to depend on it would depend on the target, not the actual service unit files, the user then would have to enable one or the other. A sysconfig edit however would not trigger a change, which is what we seem to want, and the only reasonable and *clean* way I can think of supporting this on systemd is through a launcher which does getenv() and execve(). If we do that we could rename The C version of xenstored to cxenstored leave oxenstored as is and have the launcher eat up the xenstored name.
I've poked systemd-devel for more advice:
http://lists.freedesktop.org/archives/systemd-devel/2014-May/019427.html
Unfortunatley no one has provided further input than what I got at LF collaboration summit. One thought that occurs to me is to have systemd deal with these types of situations a launcher of its own, but that's work and perhaps something to consider for the future. The one thing that concerns me about the sysconfig/default variable reliance is that its not ideally what we what but hey -- I don't think we can seek for perfection right now, only a good start.
A launcher is my own preferred way to deal with this, provided I haven't gotten more input let me know all your folks thought on this. I'll also poke internally at SUSE for more thoughts.
Quoted 10 lines
Quoted 10 lines
Quoted 9 lines
m4/expand_config.m4 AC_SUBST(XEN_RUN_DIR) · line 65
Quoted 7 lines
XEN_PAGING_DIR=/var/lib/xen/xenpaging
AC_SUBST(XEN_PAGING_DIR)m4/expand_config.m4 +5
-0+ +AC_DEFUN([AX_XEN_OCAML_XENSTORE_CHECK], [ + AC_PROG_OCAML + AC_PROG_FINDLIB + AS_IF([test "x$OCAMLC" = "xno" || test "x$OCAMLFIND" = "xno"], [THen you could rely on m4/ocaml.m4 to have checked all this already.
Quoted 7 lines
Quoted 3 lines
Just including m4/ocaml.m4 won't get us much, the above logic assumes that file was included so there is a bit of a trick we need to adjust in order to avoid multiple calls to the same checks.
If you do/call these checks in
tools/configure.acthen I think you can just arrange to sequence things correctly with the ocaml ones by the ordering in the file.
OK.
Luis
Re: [PATCH v5 12/14] autoconf: xen: enable explicit preference option for xenstored preference
Quoted 40 lines · Luis R. Rodriguez
Quoted 13 lines · Ian Campbell
Quoted 11 lines · Luis R. Rodriguez
Quoted 5 lines
It might be reasonable for
hotplugpath.shto define XENSTORE_xenstored=/path/to/xenstored XENSTORE_oxenstored=/path/to/oxenstoredand use the existing XENSTORED variable in sysconfig to select which.
Ah but but
hotplugpath.shis one of those automatically generated files and after my last patch in this series they are all now shared in one master file, config/xen-environment-scripts.in, and since the we want to keep script file Shell / Python agnostic checking which one is set on sysconfig is not something reasonable to do on that master file.Quoted 7 lines
Well, it must be possible to change which xenstored implementation is used by editing a single setting in
/etc/{sysconfig,default}/xencommons, maybe that means more code somewhere, I don't know. idieally you would be able to say
XENSTORE=xenstored # C xenstore at default path XENSTORE=oxenstored # Ocaml xenstore at default path XENSTORE=/path/to/something # xenstored at some custom path.Agreed.
Quoted 16 lines
Quoted 15 lines
My series of patches already deals with the old init and xencommons script to start xenstore, it used the
hotplugpath.shfor deducing the xenstore daemon it should use by default and switching this to rely on the sysconfig xencommons should be easy if it wasn't already dealt with there already.For systemd though we can't use varibles on ExecStart for the process, we however can use environment variables. We have a few options. Fedora's approach was to use two service unit files which conflicted with each other, although I'm sure we can work it out by using a target unit and let folks flip it seems rather silly to me to maintain two service unit files with identical entries. Therefore in my new approach usres would have to manually edit the service file with the differnt path / binary. Another possibility is to have a central launcher binary that just does
getenv()andexecve()on the desired binary. If this is agreeable I can work on it and it could even be shared by the old init as well.
Quoted 7 lines
Quoted 1 line
Which is considered the most "systemd" approach?
Systemd tries to even recommend to shy away from sysconfig/default directory for stashing entries, one can set environment variables within the service unit itself, but if we are to maintain compatiblity with old stuff relying on sysconfig seems the reasonable and accepted way, then we'd include that file as part of the running environment, just as our systemd service unit files do now in this series.
I'm mostly concerned that people *not* using systemd can continue to use /etc/{default,sysconfig}/xencommons in the way which they are used to.
For people who are using systemd the question is whether it is more or less confusing to have an unused /etc/{default,sysconfig}/xencommons sitting there vs. doing things in the less "systemd" way. The compromise is perhaps to seed the defaults from /e/{d,s}/xencommons but allow them to be changed in either that file or in the unit file? Is that possible?
Quoted 5 lines
More details here:
Quoted 8 lines
As for dynamic use daemons, there aren't good examples but the undocumented way of doing this but as a per a conversation at the LF Linux Collaboration summit one way to deal with this is to use one service target files for defining what we do, we'd have two separate service unit files for each cxenstored and oxenstored, the services that need to depend on it would depend on the target, not the actual service unit files, the user then would have to enable one or the other. A sysconfig edit however would not trigger a change, which is what we seem to want,
What do you mean? I don't expect editing sysconfig will automagically do anything, some further action would be required, and since xenstored is involved that further action most likely involves a reboot.
Can a systemd unit "soft fail"? i.e. fail but not make a huge red highlighted fuss about it? Then each of the two units could check if they were configured and softfail if not (expecting that the other one is configured). Alternatively perhaps there is some sort of pre-check hook which could be used to see if the unit can/should be run?
Ian.
Re: [PATCH v5 12/14] autoconf: xen: enable explicit preference option for xenstored preference
Quoted 53 lines · On Wed, 28 May 2014 10:30:49 +0100 Ian Campbell <[email protected]> wrote:
Quoted 40 lines · Luis R. Rodriguez
Quoted 13 lines · Ian Campbell
Quoted 11 lines · Luis R. Rodriguez
Quoted 5 lines
It might be reasonable for
hotplugpath.shto define XENSTORE_xenstored=/path/to/xenstored XENSTORE_oxenstored=/path/to/oxenstoredand use the existing XENSTORED variable in sysconfig to select which.
Ah but but
hotplugpath.shis one of those automatically generated files and after my last patch in this series they are all now shared in one master file, config/xen-environment-scripts.in, and since the we want to keep script file Shell / Python agnostic checking which one is set on sysconfig is not something reasonable to do on that master file.Quoted 7 lines
Well, it must be possible to change which xenstored implementation is used by editing a single setting in
/etc/{sysconfig,default}/xencommons, maybe that means more code somewhere, I don't know. idieally you would be able to say
XENSTORE=xenstored # C xenstore at default path XENSTORE=oxenstored # Ocaml xenstore at default path XENSTORE=/path/to/something # xenstored at some custom path.Agreed.
Quoted 16 lines
Quoted 15 lines
My series of patches already deals with the old init and xencommons script to start xenstore, it used the
hotplugpath.shfor deducing the xenstore daemon it should use by default and switching this to rely on the sysconfig xencommons should be easy if it wasn't already dealt with there already.For systemd though we can't use varibles on ExecStart for the process, we however can use environment variables. We have a few options. Fedora's approach was to use two service unit files which conflicted with each other, although I'm sure we can work it out by using a target unit and let folks flip it seems rather silly to me to maintain two service unit files with identical entries. Therefore in my new approach usres would have to manually edit the service file with the differnt path / binary. Another possibility is to have a central launcher binary that just does
getenv()andexecve()on the desired binary. If this is agreeable I can work on it and it could even be shared by the old init as well.Quoted 7 lines
Quoted 1 line
Which is considered the most "systemd" approach?
Systemd tries to even recommend to shy away from sysconfig/default directory for stashing entries, one can set environment variables within the service unit itself, but if we are to maintain compatiblity with old stuff relying on sysconfig seems the reasonable and accepted way, then we'd include that file as part of the running environment, just as our systemd service unit files do now in this series.
I'm mostly concerned that people *not* using systemd can continue to use
/etc/{default,sysconfig}/xencommonsin the way which they are used to.
Quoted 5 lines
For people who are using systemd the question is whether it is more or less confusing to have an unused
/etc/{default,sysconfig}/xencommonssitting there vs. doing things in the less "systemd" way. The compromise is perhaps to seed the defaults from /e/{d,s}/xencommons but allow them to be changed in either that file or in the unit file? Is that possible?
How about moving xencommons into /etc/xen and, optionally, making a link to it from /etc/{default,sysconfig} as the distro warrants? That way we have a consistent place to find it and the user still finds it where they're used to finding it.
-d
Re: [PATCH v5 12/14] autoconf: xen: enable explicit preference option for xenstored preference
In reply to Ian CampbellI'm cc'ing a few security folks as I'd appreciate review on the ideas here, in particular that of a launcher idea on system to replace alternatives on the ExecStart= line of a systemd service unit file, alternative ideas are of course welcomed. I'm also Cc'ing systemd-devel as this subject was reviewed a little while ago with nothing concrete being recommended but instead a few options being now archived as possibilities. I'm looking for a bit wider review of the approaches and recomendations.
Some general background for non xen folks: old xen requires the launch of a daemon which implements supports of the xenstore, which is the database that xen uses for information about guests / dom0. There are two supported daemons, xenstored (C version) and oxenstored (Ocaml version) but they do the same thing. Right now old init lets you override which one you pick through an environment variable on /etc/{sysconfig,default}/xencommons, the script will use the appropriate on there. Systemd doesn't let you use variables on the ExecStart line of a service unit file so alternatives are required.
The reason I'm being very careful here this could set a precedent and at least for the launcher idea it'd require the usage of getenv() and execve(), and secure alternatives for these (secure_getenv(), execve_nosecurity()) have either been merged or suggested before for Linux. The systemd discussion is only specific to Linux but if we have a launcher we could consider it for other supported OSes. All that said I'd like proper review of the security implications of *all* strategies but obviously in particular the launcher idea. I want to tread carefuly before setting precedents.
Details below as we discuss the approach we can take on Xen.
Quoted 49 lines · Ian Campbell
Quoted 40 lines · Luis R. Rodriguez
Quoted 13 lines · Ian Campbell
Quoted 11 lines · Luis R. Rodriguez
Quoted 5 lines
It might be reasonable for
hotplugpath.shto define XENSTORE_xenstored=/path/to/xenstored XENSTORE_oxenstored=/path/to/oxenstoredand use the existing XENSTORED variable in sysconfig to select which.
Ah but but
hotplugpath.shis one of those automatically generated files and after my last patch in this series they are all now shared in one master file, config/xen-environment-scripts.in, and since the we want to keep script file Shell / Python agnostic checking which one is set on sysconfig is not something reasonable to do on that master file.Quoted 7 lines
Well, it must be possible to change which xenstored implementation is used by editing a single setting in
/etc/{sysconfig,default}/xencommons, maybe that means more code somewhere, I don't know. idieally you would be able to say
XENSTORE=xenstored # C xenstore at default path XENSTORE=oxenstored # Ocaml xenstore at default path XENSTORE=/path/to/something # xenstored at some custom path.Agreed.
Quoted 16 lines
Quoted 15 lines
My series of patches already deals with the old init and xencommons script to start xenstore, it used the
hotplugpath.shfor deducing the xenstore daemon it should use by default and switching this to rely on the sysconfig xencommons should be easy if it wasn't already dealt with there already.For systemd though we can't use varibles on ExecStart for the process, we however can use environment variables. We have a few options. Fedora's approach was to use two service unit files which conflicted with each other, although I'm sure we can work it out by using a target unit and let folks flip it seems rather silly to me to maintain two service unit files with identical entries. Therefore in my new approach usres would have to manually edit the service file with the differnt path / binary. Another possibility is to have a central launcher binary that just does
getenv()andexecve()on the desired binary. If this is agreeable I can work on it and it could even be shared by the old init as well.Quoted 7 lines
Quoted 1 line
Which is considered the most "systemd" approach?
Systemd tries to even recommend to shy away from sysconfig/default directory for stashing entries, one can set environment variables within the service unit itself, but if we are to maintain compatiblity with old stuff relying on sysconfig seems the reasonable and accepted way, then we'd include that file as part of the running environment, just as our systemd service unit files do now in this series.
Quoted 3 lines
I'm mostly concerned that people *not* using systemd can continue to use
/etc/{default,sysconfig}/xencommonsin the way which they are used to.
Ah well that is already addressed in the series of patches, I'll be sure to test flipping it with the xencommons edit on my next respin. I think in my series the xenstored variable was assumed coming from hotplug.sh and obviously we just want /etc/{default,sysconfig}/xencommons as expressed I just had missed that file.
Quoted 5 lines
For people who are using systemd the question is whether it is more or less confusing to have an unused
/etc/{default,sysconfig}/xencommonssitting there vs. doing things in the less "systemd" way. The compromise is perhaps to seed the defaults from /e/{d,s}/xencommons but allow them to be changed in either that file or in the unit file? Is that possible?
Environment variables cannot be used to replace the binary that systemd will execute on the ExecStart= line and this is why I mentioned the different possiblities available. As it stands right now then folks would have to edit the xenstored.service file and replace the full path of the binary to get a different xenstore to run, and then and reboot, right now on systemd the file /e/{d,s}/xencommons could only be used to get daemon environment variables, not change the daemon. If we can live with that as a compromise in documentation then that would require only an edit to the file /e/{d,s}/xencommons and make sure its clear that the daemon override would only work on legacy init and not systemd. That's another option then, so to be clear there are these known options:
0) *Iff* we want to loose the /e/{d,s}/xencommons behavior we just document that the /e/{d,s}/xencommons override is only for legacy init and have folks edit the service file to change the preferred daemon. They'd obviously just have to reboot.
*Iff* we want to conserve the /e/{d,s}/xencommons behaviour we have a few options:
1) two service unit files and one target file, the downside is that the service files are identical except for the ExecStart line, that seems silly then as you'd have to maintain two files or at least once installed they'd be nearly identical.
2) two service unit files and use an alias for the general service name, the same downside applies though.
3) we implement a launcher which will getenv() and execve() the appropriate daemon. To do this we can rename the C implementation to cxenstored, the Ocaml daemon remain as oxenstored, and the launcher would get the generic name xenstored. Although I had not mentioned before I am making it clear now that I'd like a bit more review on this strategy and the reasons for it.
Options 1-2 would require no changes to other OSes. Option 3 however could be considered for integration on other OSes. When evaluating these options please note that any security issues with getenv() and execve() also have to be considered in light of the current strategy for legacy init which would rely on an environment file which allows full override on the binary.
Quoted 13 lines
Quoted 4 lines
More details here:
Quoted 8 lines
As for dynamic use daemons, there aren't good examples but the undocumented way of doing this but as a per a conversation at the LF Linux Collaboration summit one way to deal with this is to use one service target files for defining what we do, we'd have two separate service unit files for each cxenstored and oxenstored, the services that need to depend on it would depend on the target, not the actual service unit files, the user then would have to enable one or the other. A sysconfig edit however would not trigger a change, which is what we seem to want,
Quoted 3 lines
What do you mean? I don't expect editing sysconfig will automagically do anything, some further action would be required, and since xenstored is involved that further action most likely involves a reboot.
Sorry dynamic was the wrong word, what I meant was a way that would not require a service unit change but rather an environment file much as with the legacy init approach.
Quoted 2 lines
Can a systemd unit "soft fail"? i.e. fail but not make a huge red highlighted fuss about it?
Not that I have seen documented.
Quoted 4 lines
Then each of the two units could check if
they were configured and softfail if not (expecting that the other one is configured). Alternatively perhaps there is some sort of pre-check hook which could be used to see if the unit can/should be run?
Option 1) and 2) can be used for something like this if we did not want to have a system administrator ever involved in selectin between the two units, but it would then require adding code on both C version of xentored and on the ocaml oxenstored to getenv() on XENSTORED and fail to load if it didn't match. I am not sure if two service units that claim the same alias (option 2) would work well in a situation where one is expected to fail though. Likewise for the target (option 1). Seems a bit hacky, but then again so do all of these options and hence the wide review.
IMHO the launcher is the cleanest solution and my preferred strategy provided of course all possible security concerns and any other concenrs check out well.
Luis
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v5 12/14] autoconf: xen: enable explicit preference option for xenstored preference
In reply to Ian CampbellI'm cc'ing a few security folks as I'd appreciate review on the ideas here, in particular that of a launcher idea on system to replace alternatives on the ExecStart= line of a systemd service unit file, alternative ideas are of course welcomed. I'm also Cc'ing systemd-devel as this subject was reviewed a little while ago with nothing concrete being recommended but instead a few options being now archived as possibilities. I'm looking for a bit wider review of the approaches and recomendations.
Some general background for non xen folks: old xen requires the launch of a daemon which implements supports of the xenstore, which is the database that xen uses for information about guests / dom0. There are two supported daemons, xenstored (C version) and oxenstored (Ocaml version) but they do the same thing. Right now old init lets you override which one you pick through an environment variable on /etc/{sysconfig,default}/xencommons, the script will use the appropriate on there. Systemd doesn't let you use variables on the ExecStart line of a service unit file so alternatives are required.
The reason I'm being very careful here this could set a precedent and at least for the launcher idea it'd require the usage of getenv() and execve(), and secure alternatives for these (secure_getenv(), execve_nosecurity()) have either been merged or suggested before for Linux. The systemd discussion is only specific to Linux but if we have a launcher we could consider it for other supported OSes. All that said I'd like proper review of the security implications of *all* strategies but obviously in particular the launcher idea. I want to tread carefuly before setting precedents.
Details below as we discuss the approach we can take on Xen.
Quoted 49 lines · Ian Campbell
Quoted 40 lines · Luis R. Rodriguez
Quoted 13 lines · Ian Campbell
Quoted 11 lines · Luis R. Rodriguez
Quoted 5 lines
It might be reasonable for
hotplugpath.shto define XENSTORE_xenstored=/path/to/xenstored XENSTORE_oxenstored=/path/to/oxenstoredand use the existing XENSTORED variable in sysconfig to select which.
Ah but but
hotplugpath.shis one of those automatically generated files and after my last patch in this series they are all now shared in one master file, config/xen-environment-scripts.in, and since the we want to keep script file Shell / Python agnostic checking which one is set on sysconfig is not something reasonable to do on that master file.Quoted 7 lines
Well, it must be possible to change which xenstored implementation is used by editing a single setting in
/etc/{sysconfig,default}/xencommons, maybe that means more code somewhere, I don't know. idieally you would be able to say
XENSTORE=xenstored # C xenstore at default path XENSTORE=oxenstored # Ocaml xenstore at default path XENSTORE=/path/to/something # xenstored at some custom path.Agreed.
Quoted 16 lines
Quoted 15 lines
My series of patches already deals with the old init and xencommons script to start xenstore, it used the
hotplugpath.shfor deducing the xenstore daemon it should use by default and switching this to rely on the sysconfig xencommons should be easy if it wasn't already dealt with there already.For systemd though we can't use varibles on ExecStart for the process, we however can use environment variables. We have a few options. Fedora's approach was to use two service unit files which conflicted with each other, although I'm sure we can work it out by using a target unit and let folks flip it seems rather silly to me to maintain two service unit files with identical entries. Therefore in my new approach usres would have to manually edit the service file with the differnt path / binary. Another possibility is to have a central launcher binary that just does
getenv()andexecve()on the desired binary. If this is agreeable I can work on it and it could even be shared by the old init as well.Quoted 7 lines
Quoted 1 line
Which is considered the most "systemd" approach?
Systemd tries to even recommend to shy away from sysconfig/default directory for stashing entries, one can set environment variables within the service unit itself, but if we are to maintain compatiblity with old stuff relying on sysconfig seems the reasonable and accepted way, then we'd include that file as part of the running environment, just as our systemd service unit files do now in this series.
Quoted 3 lines
I'm mostly concerned that people *not* using systemd can continue to use
/etc/{default,sysconfig}/xencommonsin the way which they are used to.
Ah well that is already addressed in the series of patches, I'll be sure to test flipping it with the xencommons edit on my next respin. I think in my series the xenstored variable was assumed coming from hotplug.sh and obviously we just want /etc/{default,sysconfig}/xencommons as expressed I just had missed that file.
Quoted 5 lines
For people who are using systemd the question is whether it is more or less confusing to have an unused
/etc/{default,sysconfig}/xencommonssitting there vs. doing things in the less "systemd" way. The compromise is perhaps to seed the defaults from /e/{d,s}/xencommons but allow them to be changed in either that file or in the unit file? Is that possible?
Environment variables cannot be used to replace the binary that systemd will execute on the ExecStart= line and this is why I mentioned the different possiblities available. As it stands right now then folks would have to edit the xenstored.service file and replace the full path of the binary to get a different xenstore to run, and then and reboot, right now on systemd the file /e/{d,s}/xencommons could only be used to get daemon environment variables, not change the daemon. If we can live with that as a compromise in documentation then that would require only an edit to the file /e/{d,s}/xencommons and make sure its clear that the daemon override would only work on legacy init and not systemd. That's another option then, so to be clear there are these known options:
0) *Iff* we want to loose the /e/{d,s}/xencommons behavior we just document that the /e/{d,s}/xencommons override is only for legacy init and have folks edit the service file to change the preferred daemon. They'd obviously just have to reboot.
*Iff* we want to conserve the /e/{d,s}/xencommons behaviour we have a few options:
1) two service unit files and one target file, the downside is that the service files are identical except for the ExecStart line, that seems silly then as you'd have to maintain two files or at least once installed they'd be nearly identical.
2) two service unit files and use an alias for the general service name, the same downside applies though.
3) we implement a launcher which will getenv() and execve() the appropriate daemon. To do this we can rename the C implementation to cxenstored, the Ocaml daemon remain as oxenstored, and the launcher would get the generic name xenstored. Although I had not mentioned before I am making it clear now that I'd like a bit more review on this strategy and the reasons for it.
Options 1-2 would require no changes to other OSes. Option 3 however could be considered for integration on other OSes. When evaluating these options please note that any security issues with getenv() and execve() also have to be considered in light of the current strategy for legacy init which would rely on an environment file which allows full override on the binary.
Quoted 13 lines
Quoted 4 lines
More details here:
Quoted 8 lines
As for dynamic use daemons, there aren't good examples but the undocumented way of doing this but as a per a conversation at the LF Linux Collaboration summit one way to deal with this is to use one service target files for defining what we do, we'd have two separate service unit files for each cxenstored and oxenstored, the services that need to depend on it would depend on the target, not the actual service unit files, the user then would have to enable one or the other. A sysconfig edit however would not trigger a change, which is what we seem to want,
Quoted 3 lines
What do you mean? I don't expect editing sysconfig will automagically do anything, some further action would be required, and since xenstored is involved that further action most likely involves a reboot.
Sorry dynamic was the wrong word, what I meant was a way that would not require a service unit change but rather an environment file much as with the legacy init approach.
Quoted 2 lines
Can a systemd unit "soft fail"? i.e. fail but not make a huge red highlighted fuss about it?
Not that I have seen documented.
Quoted 4 lines
Then each of the two units could check if
they were configured and softfail if not (expecting that the other one is configured). Alternatively perhaps there is some sort of pre-check hook which could be used to see if the unit can/should be run?
Option 1) and 2) can be used for something like this if we did not want to have a system administrator ever involved in selectin between the two units, but it would then require adding code on both C version of xentored and on the ocaml oxenstored to getenv() on XENSTORED and fail to load if it didn't match. I am not sure if two service units that claim the same alias (option 2) would work well in a situation where one is expected to fail though. Likewise for the target (option 1). Seems a bit hacky, but then again so do all of these options and hence the wide review.
IMHO the launcher is the cleanest solution and my preferred strategy provided of course all possible security concerns and any other concenrs check out well.
Luis
Re: [systemd-devel] [PATCH v5 12/14] autoconf: xen: enable explicit preference option for xenstored preference
Quoted 17 lines · Luis R. Rodriguez
I'm cc'ing a few security folks as I'd appreciate review on the ideas here, in particular that of a launcher idea on system to replace alternatives on the ExecStart= line of a systemd service unit file, alternative ideas are of course welcomed. I'm also Cc'ing systemd-devel as this subject was reviewed a little while ago with nothing concrete being recommended but instead a few options being now archived as possibilities. I'm looking for a bit wider review of the approaches and recomendations.
Some general background for non xen folks: old xen requires the launch of a daemon which implements supports of the xenstore, which is the database that xen uses for information about guests / dom0. There are two supported daemons, xenstored (C version) and oxenstored (Ocaml version) but they do the same thing. Right now old init lets you override which one you pick through an environment variable on
/etc/{sysconfig,default}/xencommons, the script will use the appropriate on there. Systemd doesn't let you use variables on the ExecStart line of a service unit file so alternatives are required.
Quoted 8 lines
The reason I'm being very careful here this could set a precedent and at least for the launcher idea it'd require the usage of
getenv()andexecve(), and secure alternatives for these (secure_getenv(),execve_nosecurity()) have either been merged or suggested before for Linux. The systemd discussion is only specific to Linux but if we have a launcher we could consider it for other supported OSes. All that said I'd like proper review of the security implications of *all* strategies but obviously in particular the launcher idea. I want to tread carefuly before setting precedents.
You can also just invoke a shell script from ExecStart=. I mean, we try to deemphesize them in the boot process, but there's nothing wrong with using shell, if you need to parse shell configuraiton fragments and just want to execute on ot another program...
That said, I'd certainly make a clean cut and drop support for /etc/sysconfig from any project I see, earlier rather than later, since it's just cruft, a bad idea and should really just go away. But then again, I would also just not do the thing with supporting two implementations at the same time...
Lennart
Signature · 1 line
Lennart Poettering, Red Hat
Re: [systemd-devel] [PATCH v5 12/14] autoconf: xen: enable explicit preference option for xenstored preference
In reply to Luis R. RodriguezQuoted 17 lines · Luis R. Rodriguez
I'm cc'ing a few security folks as I'd appreciate review on the ideas here, in particular that of a launcher idea on system to replace alternatives on the ExecStart= line of a systemd service unit file, alternative ideas are of course welcomed. I'm also Cc'ing systemd-devel as this subject was reviewed a little while ago with nothing concrete being recommended but instead a few options being now archived as possibilities. I'm looking for a bit wider review of the approaches and recomendations.
Some general background for non xen folks: old xen requires the launch of a daemon which implements supports of the xenstore, which is the database that xen uses for information about guests / dom0. There are two supported daemons, xenstored (C version) and oxenstored (Ocaml version) but they do the same thing. Right now old init lets you override which one you pick through an environment variable on
/etc/{sysconfig,default}/xencommons, the script will use the appropriate on there. Systemd doesn't let you use variables on the ExecStart line of a service unit file so alternatives are required.
Quoted 8 lines
The reason I'm being very careful here this could set a precedent and at least for the launcher idea it'd require the usage of
getenv()andexecve(), and secure alternatives for these (secure_getenv(),execve_nosecurity()) have either been merged or suggested before for Linux. The systemd discussion is only specific to Linux but if we have a launcher we could consider it for other supported OSes. All that said I'd like proper review of the security implications of *all* strategies but obviously in particular the launcher idea. I want to tread carefuly before setting precedents.
You can also just invoke a shell script from ExecStart=. I mean, we try to deemphesize them in the boot process, but there's nothing wrong with using shell, if you need to parse shell configuraiton fragments and just want to execute on ot another program...
That said, I'd certainly make a clean cut and drop support for /etc/sysconfig from any project I see, earlier rather than later, since it's just cruft, a bad idea and should really just go away. But then again, I would also just not do the thing with supporting two implementations at the same time...
Lennart
Signature · 1 line
Lennart Poettering, Red Hat
Re: [systemd-devel] [PATCH v5 12/14] autoconf: xen: enable explicit preference option for xenstored preference
Quoted 28 lines · Lennart Poettering
Quoted 17 lines · Luis R. Rodriguez
I'm cc'ing a few security folks as I'd appreciate review on the ideas here, in particular that of a launcher idea on system to replace alternatives on the ExecStart= line of a systemd service unit file, alternative ideas are of course welcomed. I'm also Cc'ing systemd-devel as this subject was reviewed a little while ago with nothing concrete being recommended but instead a few options being now archived as possibilities. I'm looking for a bit wider review of the approaches and recomendations.
Some general background for non xen folks: old xen requires the launch of a daemon which implements supports of the xenstore, which is the database that xen uses for information about guests / dom0. There are two supported daemons, xenstored (C version) and oxenstored (Ocaml version) but they do the same thing. Right now old init lets you override which one you pick through an environment variable on
/etc/{sysconfig,default}/xencommons, the script will use the appropriate on there. Systemd doesn't let you use variables on the ExecStart line of a service unit file so alternatives are required.Quoted 8 lines
The reason I'm being very careful here this could set a precedent and at least for the launcher idea it'd require the usage of
getenv()andexecve(), and secure alternatives for these (secure_getenv(),execve_nosecurity()) have either been merged or suggested before for Linux. The systemd discussion is only specific to Linux but if we have a launcher we could consider it for other supported OSes. All that said I'd like proper review of the security implications of *all* strategies but obviously in particular the launcher idea. I want to tread carefuly before setting precedents.
Quoted 4 lines
You can also just invoke a shell script from ExecStart=. I mean, we try to deemphesize them in the boot process, but there's nothing wrong with using shell, if you need to parse shell configuraiton fragments and just want to execute on ot another program...
I tried this and it didn't work given that systemd expects sd_notify() to be called from the parent process, in this case the shell script.
Anyway -- time has passed folks and we need to pick something, I really rather not spend any more time on this series unless a decision is made. My preference stands as the launcher with getenv() and execve() but I have also listed all other options available. Please feel free to pick one but just let me know.
Quoted 3 lines
That said, I'd certainly make a clean cut and drop support for
/etc/sysconfigfrom any project I see, earlier rather than later, since it's just cruft, a bad idea and should really just go away.
We can use for example something like:
# The RPM way
EnvironmentFile=-/etc/sysconfig/xencommons
# The Debian way
EnvironmentFile=-/etc/default/xencommons
Environment=XENSTORED=oxenstored
And with time this lets us with time get rid of EnvironmentFile.
Quoted 3 lines
But then
again, I would also just not do the thing with supporting two implementations at the same time...
:)
Luis
Re: [systemd-devel] [PATCH v5 12/14] autoconf: xen: enable explicit preference option for xenstored preference
Quoted 29 lines · Luis R. Rodriguez
Quoted 28 lines · Lennart Poettering
Quoted 25 lines · Luis R. Rodriguez
I'm cc'ing a few security folks as I'd appreciate review on the ideas here, in particular that of a launcher idea on system to replace alternatives on the ExecStart= line of a systemd service unit file, alternative ideas are of course welcomed. I'm also Cc'ing systemd-devel as this subject was reviewed a little while ago with nothing concrete being recommended but instead a few options being now archived as possibilities. I'm looking for a bit wider review of the approaches and recomendations.
Some general background for non xen folks: old xen requires the launch of a daemon which implements supports of the xenstore, which is the database that xen uses for information about guests / dom0. There are two supported daemons, xenstored (C version) and oxenstored (Ocaml version) but they do the same thing. Right now old init lets you override which one you pick through an environment variable on
/etc/{sysconfig,default}/xencommons, the script will use the appropriate on there. Systemd doesn't let you use variables on the ExecStart line of a service unit file so alternatives are required.The reason I'm being very careful here this could set a precedent and at least for the launcher idea it'd require the usage of
getenv()andexecve(), and secure alternatives for these (secure_getenv(),execve_nosecurity()) have either been merged or suggested before for Linux. The systemd discussion is only specific to Linux but if we have a launcher we could consider it for other supported OSes. All that said I'd like proper review of the security implications of *all* strategies but obviously in particular the launcher idea. I want to tread carefuly before setting precedents.
Quoted 7 lines
Quoted 4 lines
You can also just invoke a shell script from ExecStart=. I mean, we try to deemphesize them in the boot process, but there's nothing wrong with using shell, if you need to parse shell configuraiton fragments and just want to execute on ot another program...
I tried this and it didn't work given that systemd expects
sd_notify()to be called from the parent process, in this case the shell script.
Just use exec before the daemon command. I am pretty certain it can be just like this:
ExecStart=/bin/sh -c "exec $XENSTORED"
xenstored then has the same PID as the sh process, and $NOTIFY_SOCKET works just fine.
Best,
--
Cameron
Re: [systemd-devel] [PATCH v5 12/14] autoconf: xen: enable explicit preference option for xenstored preference
In reply to Luis R. RodriguezQuoted 29 lines · Luis R. Rodriguez
Quoted 28 lines · Lennart Poettering
Quoted 25 lines · Luis R. Rodriguez
I'm cc'ing a few security folks as I'd appreciate review on the ideas here, in particular that of a launcher idea on system to replace alternatives on the ExecStart= line of a systemd service unit file, alternative ideas are of course welcomed. I'm also Cc'ing systemd-devel as this subject was reviewed a little while ago with nothing concrete being recommended but instead a few options being now archived as possibilities. I'm looking for a bit wider review of the approaches and recomendations.
Some general background for non xen folks: old xen requires the launch of a daemon which implements supports of the xenstore, which is the database that xen uses for information about guests / dom0. There are two supported daemons, xenstored (C version) and oxenstored (Ocaml version) but they do the same thing. Right now old init lets you override which one you pick through an environment variable on
/etc/{sysconfig,default}/xencommons, the script will use the appropriate on there. Systemd doesn't let you use variables on the ExecStart line of a service unit file so alternatives are required.The reason I'm being very careful here this could set a precedent and at least for the launcher idea it'd require the usage of
getenv()andexecve(), and secure alternatives for these (secure_getenv(),execve_nosecurity()) have either been merged or suggested before for Linux. The systemd discussion is only specific to Linux but if we have a launcher we could consider it for other supported OSes. All that said I'd like proper review of the security implications of *all* strategies but obviously in particular the launcher idea. I want to tread carefuly before setting precedents.
Quoted 7 lines
Quoted 4 lines
You can also just invoke a shell script from ExecStart=. I mean, we try to deemphesize them in the boot process, but there's nothing wrong with using shell, if you need to parse shell configuraiton fragments and just want to execute on ot another program...
I tried this and it didn't work given that systemd expects
sd_notify()to be called from the parent process, in this case the shell script.
Just use exec before the daemon command. I am pretty certain it can be just like this:
ExecStart=/bin/sh -c "exec $XENSTORED"
xenstored then has the same PID as the sh process, and $NOTIFY_SOCKET works just fine.
Best,
--
Cameron
Re: [systemd-devel] [PATCH v5 12/14] autoconf: xen: enable explicit preference option for xenstored preference
Quoted 38 lines · Cameron Norman
Quoted 29 lines · Luis R. Rodriguez
Quoted 28 lines · Lennart Poettering
Quoted 25 lines · Luis R. Rodriguez
I'm cc'ing a few security folks as I'd appreciate review on the ideas here, in particular that of a launcher idea on system to replace alternatives on the ExecStart= line of a systemd service unit file, alternative ideas are of course welcomed. I'm also Cc'ing systemd-devel as this subject was reviewed a little while ago with nothing concrete being recommended but instead a few options being now archived as possibilities. I'm looking for a bit wider review of the approaches and recomendations.
Some general background for non xen folks: old xen requires the launch of a daemon which implements supports of the xenstore, which is the database that xen uses for information about guests / dom0. There are two supported daemons, xenstored (C version) and oxenstored (Ocaml version) but they do the same thing. Right now old init lets you override which one you pick through an environment variable on
/etc/{sysconfig,default}/xencommons, the script will use the appropriate on there. Systemd doesn't let you use variables on the ExecStart line of a service unit file so alternatives are required.The reason I'm being very careful here this could set a precedent and at least for the launcher idea it'd require the usage of
getenv()andexecve(), and secure alternatives for these (secure_getenv(),execve_nosecurity()) have either been merged or suggested before for Linux. The systemd discussion is only specific to Linux but if we have a launcher we could consider it for other supported OSes. All that said I'd like proper review of the security implications of *all* strategies but obviously in particular the launcher idea. I want to tread carefuly before setting precedents.Quoted 7 lines
Quoted 4 lines
You can also just invoke a shell script from ExecStart=. I mean, we try to deemphesize them in the boot process, but there's nothing wrong with using shell, if you need to parse shell configuraiton fragments and just want to execute on ot another program...
I tried this and it didn't work given that systemd expects
sd_notify()to be called from the parent process, in this case the shell script.
Quoted 7 lines
Just use exec before the daemon command. I am pretty certain it can be just like this:
ExecStart=/bin/sh -c "exec $XENSTORED"
xenstored then has the same PID as the sh process, and $NOTIFY_SOCKET works just fine.
Actually this does work on a test unit I just built. I'll proceed with this approach since I haven't heard back from others and I think this is the best approach now.
Luis
Re: [systemd-devel] [PATCH v5 12/14] autoconf: xen: enable explicit preference option for xenstored preference
In reply to Cameron NormanQuoted 38 lines · Cameron Norman
Quoted 29 lines · Luis R. Rodriguez
Quoted 28 lines · Lennart Poettering
Quoted 25 lines · Luis R. Rodriguez
I'm cc'ing a few security folks as I'd appreciate review on the ideas here, in particular that of a launcher idea on system to replace alternatives on the ExecStart= line of a systemd service unit file, alternative ideas are of course welcomed. I'm also Cc'ing systemd-devel as this subject was reviewed a little while ago with nothing concrete being recommended but instead a few options being now archived as possibilities. I'm looking for a bit wider review of the approaches and recomendations.
Some general background for non xen folks: old xen requires the launch of a daemon which implements supports of the xenstore, which is the database that xen uses for information about guests / dom0. There are two supported daemons, xenstored (C version) and oxenstored (Ocaml version) but they do the same thing. Right now old init lets you override which one you pick through an environment variable on
/etc/{sysconfig,default}/xencommons, the script will use the appropriate on there. Systemd doesn't let you use variables on the ExecStart line of a service unit file so alternatives are required.The reason I'm being very careful here this could set a precedent and at least for the launcher idea it'd require the usage of
getenv()andexecve(), and secure alternatives for these (secure_getenv(),execve_nosecurity()) have either been merged or suggested before for Linux. The systemd discussion is only specific to Linux but if we have a launcher we could consider it for other supported OSes. All that said I'd like proper review of the security implications of *all* strategies but obviously in particular the launcher idea. I want to tread carefuly before setting precedents.Quoted 7 lines
Quoted 4 lines
You can also just invoke a shell script from ExecStart=. I mean, we try to deemphesize them in the boot process, but there's nothing wrong with using shell, if you need to parse shell configuraiton fragments and just want to execute on ot another program...
I tried this and it didn't work given that systemd expects
sd_notify()to be called from the parent process, in this case the shell script.
Quoted 7 lines
Just use exec before the daemon command. I am pretty certain it can be just like this:
ExecStart=/bin/sh -c "exec $XENSTORED"
xenstored then has the same PID as the sh process, and $NOTIFY_SOCKET works just fine.
Actually this does work on a test unit I just built. I'll proceed with this approach since I haven't heard back from others and I think this is the best approach now.
Luis
Re: [systemd-devel] [PATCH v5 12/14] autoconf: xen: enable explicit preference option for xenstored preference
In reply to Luis R. RodriguezQuoted 29 lines · Luis R. Rodriguez
Quoted 28 lines · Lennart Poettering
Quoted 25 lines · Luis R. Rodriguez
I'm cc'ing a few security folks as I'd appreciate review on the ideas here, in particular that of a launcher idea on system to replace alternatives on the ExecStart= line of a systemd service unit file, alternative ideas are of course welcomed. I'm also Cc'ing systemd-devel as this subject was reviewed a little while ago with nothing concrete being recommended but instead a few options being now archived as possibilities. I'm looking for a bit wider review of the approaches and recomendations.
Some general background for non xen folks: old xen requires the launch of a daemon which implements supports of the xenstore, which is the database that xen uses for information about guests / dom0. There are two supported daemons, xenstored (C version) and oxenstored (Ocaml version) but they do the same thing. Right now old init lets you override which one you pick through an environment variable on
/etc/{sysconfig,default}/xencommons, the script will use the appropriate on there. Systemd doesn't let you use variables on the ExecStart line of a service unit file so alternatives are required.The reason I'm being very careful here this could set a precedent and at least for the launcher idea it'd require the usage of
getenv()andexecve(), and secure alternatives for these (secure_getenv(),execve_nosecurity()) have either been merged or suggested before for Linux. The systemd discussion is only specific to Linux but if we have a launcher we could consider it for other supported OSes. All that said I'd like proper review of the security implications of *all* strategies but obviously in particular the launcher idea. I want to tread carefuly before setting precedents.
Quoted 7 lines
Quoted 4 lines
You can also just invoke a shell script from ExecStart=. I mean, we try to deemphesize them in the boot process, but there's nothing wrong with using shell, if you need to parse shell configuraiton fragments and just want to execute on ot another program...
I tried this and it didn't work given that systemd expects
sd_notify()to be called from the parent process, in this case the shell script.
Hmm? You should "exec" the real daemon binary at the end, not just fork it off. That wait the shell script process is replaced by the daemon binary, which is what you want.
Lennart
Signature · 1 line
Lennart Poettering, Red Hat
Re: [systemd-devel] [PATCH v5 12/14] autoconf: xen: enable explicit preference option for xenstored preference
In reply to Luis R. RodriguezQuoted 29 lines · Luis R. Rodriguez
Quoted 28 lines · Lennart Poettering
Quoted 25 lines · Luis R. Rodriguez
I'm cc'ing a few security folks as I'd appreciate review on the ideas here, in particular that of a launcher idea on system to replace alternatives on the ExecStart= line of a systemd service unit file, alternative ideas are of course welcomed. I'm also Cc'ing systemd-devel as this subject was reviewed a little while ago with nothing concrete being recommended but instead a few options being now archived as possibilities. I'm looking for a bit wider review of the approaches and recomendations.
Some general background for non xen folks: old xen requires the launch of a daemon which implements supports of the xenstore, which is the database that xen uses for information about guests / dom0. There are two supported daemons, xenstored (C version) and oxenstored (Ocaml version) but they do the same thing. Right now old init lets you override which one you pick through an environment variable on
/etc/{sysconfig,default}/xencommons, the script will use the appropriate on there. Systemd doesn't let you use variables on the ExecStart line of a service unit file so alternatives are required.The reason I'm being very careful here this could set a precedent and at least for the launcher idea it'd require the usage of
getenv()andexecve(), and secure alternatives for these (secure_getenv(),execve_nosecurity()) have either been merged or suggested before for Linux. The systemd discussion is only specific to Linux but if we have a launcher we could consider it for other supported OSes. All that said I'd like proper review of the security implications of *all* strategies but obviously in particular the launcher idea. I want to tread carefuly before setting precedents.
Quoted 7 lines
Quoted 4 lines
You can also just invoke a shell script from ExecStart=. I mean, we try to deemphesize them in the boot process, but there's nothing wrong with using shell, if you need to parse shell configuraiton fragments and just want to execute on ot another program...
I tried this and it didn't work given that systemd expects
sd_notify()to be called from the parent process, in this case the shell script.
Hmm? You should "exec" the real daemon binary at the end, not just fork it off. That wait the shell script process is replaced by the daemon binary, which is what you want.
Lennart
Signature · 1 line
Lennart Poettering, Red Hat
Re: [systemd-devel] [PATCH v5 12/14] autoconf: xen: enable explicit preference option for xenstored preference
Quoted 36 lines · Lennart Poettering
Quoted 34 lines · Luis R. Rodriguez
Quoted 32 lines · Lennart Poettering
Quoted 17 lines · Luis R. Rodriguez
I'm cc'ing a few security folks as I'd appreciate review on the ideas here, in particular that of a launcher idea on system to replace alternatives on the ExecStart= line of a systemd service unit file, alternative ideas are of course welcomed. I'm also Cc'ing systemd-devel as this subject was reviewed a little while ago with nothing concrete being recommended but instead a few options being now archived as possibilities. I'm looking for a bit wider review of the approaches and recomendations.
Some general background for non xen folks: old xen requires the launch of a daemon which implements supports of the xenstore, which is the database that xen uses for information about guests / dom0. There are two supported daemons, xenstored (C version) and oxenstored (Ocaml version) but they do the same thing. Right now old init lets you override which one you pick through an environment variable on
/etc/{sysconfig,default}/xencommons, the script will use the appropriate on there. Systemd doesn't let you use variables on the ExecStart line of a service unit file so alternatives are required.Quoted 8 lines
The reason I'm being very careful here this could set a precedent and at least for the launcher idea it'd require the usage of
getenv()andexecve(), and secure alternatives for these (secure_getenv(),execve_nosecurity()) have either been merged or suggested before for Linux. The systemd discussion is only specific to Linux but if we have a launcher we could consider it for other supported OSes. All that said I'd like proper review of the security implications of *all* strategies but obviously in particular the launcher idea. I want to tread carefuly before setting precedents.You can also just invoke a shell script from ExecStart=. I mean, we try to deemphesize them in the boot process, but there's nothing wrong with using shell, if you need to parse shell configuraiton fragments and just want to execute on ot another program...
Quoted 6 lines
Quoted 2 lines
I tried this and it didn't work given that systemd expects
sd_notify()to be called from the parent process, in this case the shell script.Hmm? You should "exec" the real daemon binary at the end, not just fork it off. That wait the shell script process is replaced by the daemon binary, which is what you want.
I tried both just running it and also running exec foo; both presented the same issue given that shell exec does not really execve.
Luis
Re: [systemd-devel] [PATCH v5 12/14] autoconf: xen: enable explicit preference option for xenstored preference
In reply to Lennart PoetteringQuoted 36 lines · Lennart Poettering
Quoted 34 lines · Luis R. Rodriguez
Quoted 32 lines · Lennart Poettering
Quoted 17 lines · Luis R. Rodriguez
I'm cc'ing a few security folks as I'd appreciate review on the ideas here, in particular that of a launcher idea on system to replace alternatives on the ExecStart= line of a systemd service unit file, alternative ideas are of course welcomed. I'm also Cc'ing systemd-devel as this subject was reviewed a little while ago with nothing concrete being recommended but instead a few options being now archived as possibilities. I'm looking for a bit wider review of the approaches and recomendations.
Some general background for non xen folks: old xen requires the launch of a daemon which implements supports of the xenstore, which is the database that xen uses for information about guests / dom0. There are two supported daemons, xenstored (C version) and oxenstored (Ocaml version) but they do the same thing. Right now old init lets you override which one you pick through an environment variable on
/etc/{sysconfig,default}/xencommons, the script will use the appropriate on there. Systemd doesn't let you use variables on the ExecStart line of a service unit file so alternatives are required.Quoted 8 lines
The reason I'm being very careful here this could set a precedent and at least for the launcher idea it'd require the usage of
getenv()andexecve(), and secure alternatives for these (secure_getenv(),execve_nosecurity()) have either been merged or suggested before for Linux. The systemd discussion is only specific to Linux but if we have a launcher we could consider it for other supported OSes. All that said I'd like proper review of the security implications of *all* strategies but obviously in particular the launcher idea. I want to tread carefuly before setting precedents.You can also just invoke a shell script from ExecStart=. I mean, we try to deemphesize them in the boot process, but there's nothing wrong with using shell, if you need to parse shell configuraiton fragments and just want to execute on ot another program...
Quoted 6 lines
Quoted 2 lines
I tried this and it didn't work given that systemd expects
sd_notify()to be called from the parent process, in this case the shell script.Hmm? You should "exec" the real daemon binary at the end, not just fork it off. That wait the shell script process is replaced by the daemon binary, which is what you want.
I tried both just running it and also running exec foo; both presented the same issue given that shell exec does not really execve.
Luis
Re: [systemd-devel] [PATCH v5 12/14] autoconf: xen: enable explicit preference option for xenstored preference
Quoted 6 lines · Luis R. Rodriguez
Quoted 3 lines
Hmm? You should "exec" the real daemon binary at the end, not just fork it off. That wait the shell script process is replaced by the daemon binary, which is what you want.
I tried both just running it and also running exec foo; both presented the same issue given that shell exec does not really execve.
Hmmm? You shell's "exec" command doesn't actually execve()? What are you using? This doesn't sound very accurate...
Lennart
Signature · 1 line
Lennart Poettering, Red Hat
Re: [systemd-devel] [PATCH v5 12/14] autoconf: xen: enable explicit preference option for xenstored preference
In reply to Luis R. RodriguezQuoted 6 lines · Luis R. Rodriguez
Quoted 3 lines
Hmm? You should "exec" the real daemon binary at the end, not just fork it off. That wait the shell script process is replaced by the daemon binary, which is what you want.
I tried both just running it and also running exec foo; both presented the same issue given that shell exec does not really execve.
Hmmm? You shell's "exec" command doesn't actually execve()? What are you using? This doesn't sound very accurate...
Lennart
Signature · 1 line
Lennart Poettering, Red Hat
Re: [systemd-devel] [PATCH v5 12/14] autoconf: xen: enable explicit preference option for xenstored preference
Quoted 11 lines · Lennart Poettering
Quoted 6 lines · Luis R. Rodriguez
Quoted 3 lines
Hmm? You should "exec" the real daemon binary at the end, not just fork it off. That wait the shell script process is replaced by the daemon binary, which is what you want.
I tried both just running it and also running exec foo; both presented the same issue given that shell exec does not really execve.
Hmmm? You shell's "exec" command doesn't actually
execve()? What are you using? This doesn't sound very accurate...
$ strace -e execve /bin/sh -c 'exec /bin/echo test'
execve("/bin/sh", ["/bin/sh", "-c", "exec /bin/echo test"], [/* 54 vars */]) = 0
execve("/bin/echo", ["/bin/echo", "test"], [/* 54 vars */]) = 0
test
+++ exited with 0 +++I get similar results on Ubuntu using dash.
--Andy
Re: [systemd-devel] [PATCH v5 12/14] autoconf: xen: enable explicit preference option for xenstored preference
In reply to Lennart PoetteringQuoted 11 lines · Lennart Poettering
Quoted 6 lines · Luis R. Rodriguez
Quoted 3 lines
Hmm? You should "exec" the real daemon binary at the end, not just fork it off. That wait the shell script process is replaced by the daemon binary, which is what you want.
I tried both just running it and also running exec foo; both presented the same issue given that shell exec does not really execve.
Hmmm? You shell's "exec" command doesn't actually
execve()? What are you using? This doesn't sound very accurate...
$ strace -e execve /bin/sh -c 'exec /bin/echo test'
execve("/bin/sh", ["/bin/sh", "-c", "exec /bin/echo test"], [/* 54 vars */]) = 0
execve("/bin/echo", ["/bin/echo", "test"], [/* 54 vars */]) = 0
test
+++ exited with 0 +++I get similar results on Ubuntu using dash.
--Andy
Re: [systemd-devel] [PATCH v5 12/14] autoconf: xen: enable explicit preference option for xenstored preference
In reply to Lennart PoetteringQuoted 28 lines · Lennart Poettering
Quoted 17 lines · Luis R. Rodriguez
I'm cc'ing a few security folks as I'd appreciate review on the ideas here, in particular that of a launcher idea on system to replace alternatives on the ExecStart= line of a systemd service unit file, alternative ideas are of course welcomed. I'm also Cc'ing systemd-devel as this subject was reviewed a little while ago with nothing concrete being recommended but instead a few options being now archived as possibilities. I'm looking for a bit wider review of the approaches and recomendations.
Some general background for non xen folks: old xen requires the launch of a daemon which implements supports of the xenstore, which is the database that xen uses for information about guests / dom0. There are two supported daemons, xenstored (C version) and oxenstored (Ocaml version) but they do the same thing. Right now old init lets you override which one you pick through an environment variable on
/etc/{sysconfig,default}/xencommons, the script will use the appropriate on there. Systemd doesn't let you use variables on the ExecStart line of a service unit file so alternatives are required.Quoted 8 lines
The reason I'm being very careful here this could set a precedent and at least for the launcher idea it'd require the usage of
getenv()andexecve(), and secure alternatives for these (secure_getenv(),execve_nosecurity()) have either been merged or suggested before for Linux. The systemd discussion is only specific to Linux but if we have a launcher we could consider it for other supported OSes. All that said I'd like proper review of the security implications of *all* strategies but obviously in particular the launcher idea. I want to tread carefuly before setting precedents.
Quoted 4 lines
You can also just invoke a shell script from ExecStart=. I mean, we try to deemphesize them in the boot process, but there's nothing wrong with using shell, if you need to parse shell configuraiton fragments and just want to execute on ot another program...
I tried this and it didn't work given that systemd expects sd_notify() to be called from the parent process, in this case the shell script.
Anyway -- time has passed folks and we need to pick something, I really rather not spend any more time on this series unless a decision is made. My preference stands as the launcher with getenv() and execve() but I have also listed all other options available. Please feel free to pick one but just let me know.
Quoted 3 lines
That said, I'd certainly make a clean cut and drop support for
/etc/sysconfigfrom any project I see, earlier rather than later, since it's just cruft, a bad idea and should really just go away.
We can use for example something like:
# The RPM way
EnvironmentFile=-/etc/sysconfig/xencommons
# The Debian way
EnvironmentFile=-/etc/default/xencommons
Environment=XENSTORED=oxenstored
And with time this lets us with time get rid of EnvironmentFile.
Quoted 3 lines
But then
again, I would also just not do the thing with supporting two implementations at the same time...
:)
Luis
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
PATCH v5 13/14 xencommons: move module list into a generic place
In reply to Luis R. RodriguezFrom: "Luis R. Rodriguez" <[email protected]>
This will allows us to share the same module list with sysemd, and lets us upkeep it in one place. Document this while at it on the top level README and expand on the wiki:
http://wiki.xen.org/wiki/Category:Host_Configuration#Linux_kernel_modules
In order to upkeep parallelism builds be explicit about the requirement to complete all actions before any installation targets.
---
Please run ./autgen.sh after this patch is applied.
README | 18 +++++++++++
config/modules | 16 ++++++++++
tools/hotplug/Linux/Makefile | 36 +++++++++++++++++++---
.../Linux/init.d/{xencommons => xencommons.in} | 16 +---------
4 files changed, 67 insertions(+), 19 deletions(-)
create mode 100644 config/modules
rename tools/hotplug/Linux/init.d/{xencommons => xencommons.in} (88%)README +18 -0
@@ -179,6 +179,24 @@ generated at build time after running ./configure. [1] http://wiki.xen.org/wiki/XenStoreReference [2] http://wiki.xen.org/wiki/Xenstored +Required Linux modules +====================== + +Xen has a set of Linux modules which the init scripts ensure to load before +enablement of xen guests. The list of modules are upkept in one place: + + * config/modules + +The file supports a simple language, comments are ignored, and if you there +are module replacements this can be listed by using a pipe to show preference +for the first module, followed by the older module. + +We should strive to not require statically loading modules but it seems some +systems have had issues with automatically loading some Linux kernel modules. +For more details refer to: + +http://wiki.xen.org/wiki/Category:Host_Configuration#Linux_kernel_modules + Python Runtime Libraries ========================
config/modules new file +16 -0
@@ -0,0 +1,16 @@ +xen-evtchn +xen-gntdev +xen-gntalloc +xen-blkback +xen-netback +xen-pciback +evtchn +gntdev +netbk +blkbk +xen-scsibk +usbbk +pciback +xen-acpi-processor +# Prefer to load blktap2 if found, otherwise load blktap +blktap2|blktap
tools/hotplug/Linux/Makefile +32 -4
@@ -33,17 +33,45 @@ UDEV_RULES_DIR = $(CONFIG_DIR)/udev UDEV_RULES = xen-backend.rules $(UDEV_RULES-y) .PHONY: all -all: +all: $(XENCOMMONS_INITD) + +$(XENCOMMONS_INITD): $(XEN_ROOT)/config/modules $(XENCOMMONS_INITD).in + @set -e ; \ + IFS='' ;\ + cat $(XEN_ROOT)/config/modules | ( \ + while read l ; do \ + if echo $${l} | egrep -q "^#" ; then \ + continue ;\ + fi ;\ + if echo "$${l}" | egrep -q "\|" ; then \ + m1=$${l%%|*} ;\ + m2=$${l#*|} ;\ + echo " modprobe $$m1 2>/dev/null || modprobe $$m2 2>/dev/null" ;\ + else \ + echo " modprobe $$l 2>/dev/null" ;\ + fi ;\ + done \ + ) > $(XENCOMMONS_INITD).modules ;\ + cat $(XENCOMMONS_INITD).in | ( \ + while read l ; do \ + if echo "$${l}" | egrep -q "@LOAD_MODULES@" ; then \ + cat $(XENCOMMONS_INITD).modules ;\ + else \ + echo $$l ;\ + fi ;\ + done \ + ) > $@ + @rm -f $(XENCOMMONS_INITD).modules .PHONY: build -build: +build: all .PHONY: install install: all install-initd install-scripts install-udev # See docs/misc/distro_mapping.txt for INITD_DIR location .PHONY: install-initd -install-initd: +install-initd: all [ -d $(DESTDIR)$(INITD_DIR) ] || $(INSTALL_DIR) $(DESTDIR)$(INITD_DIR) [ -d $(DESTDIR)$(SYSCONFIG_DIR) ] || $(INSTALL_DIR) $(DESTDIR)$(SYSCONFIG_DIR) [ -d $(DESTDIR)$(LIBEXEC) ] || $(INSTALL_DIR) $(DESTDIR)$(LIBEXEC)
@@ -55,7 +83,7 @@ install-initd: $(INSTALL_PROG) init.d/xen-watchdog $(DESTDIR)$(INITD_DIR) .PHONY: install-scripts -install-scripts: +install-scripts: all [ -d $(DESTDIR)$(XEN_SCRIPT_DIR) ] || \ $(INSTALL_DIR) $(DESTDIR)$(XEN_SCRIPT_DIR) set -e; for i in $(XEN_SCRIPTS); \
tools/hotplug/Linux/init.d/xencommons.in renamed from tools/hotplug/Linux/init.d/xencommons +1 -15
@@ -57,21 +57,7 @@ do_start () { local time=0 local timeout=30 - modprobe xen-evtchn 2>/dev/null - modprobe xen-gntdev 2>/dev/null - modprobe xen-gntalloc 2>/dev/null - modprobe xen-blkback 2>/dev/null - modprobe xen-netback 2>/dev/null - modprobe xen-pciback 2>/dev/null - modprobe evtchn 2>/dev/null - modprobe gntdev 2>/dev/null - modprobe netbk 2>/dev/null - modprobe blkbk 2>/dev/null - modprobe xen-scsibk 2>/dev/null - modprobe usbbk 2>/dev/null - modprobe pciback 2>/dev/null - modprobe xen-acpi-processor 2>/dev/null - modprobe blktap2 2>/dev/null || modprobe blktap 2>/dev/null + @LOAD_MODULES@ mkdir -p /var/run/xen if ! `${BINDIR}/xenstore-read -s / >/dev/null 2>&1`
Signature · 1 line
2.0.0.rc3.18.g00a5b79
Re: [PATCH v5 13/14] xencommons: move module list into a generic place
Quoted 5 lines
Quoted 1 line
Quoted 1 line · On 20.05.14 at 14:31, <[email protected]> wrote:
From: "Luis R. Rodriguez" <[email protected]>
This will allows us to share the same module list with sysemd, and lets us upkeep it in one place.
Hmm - do we really want to further play with this module loading, which for at least two releases was scheduled to be removed in favor of having the tool stack load modules on demand?
Jan
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH v5 13/14] xencommons: move module list into a generic place
Quoted 7 lines · Jan Beulich
Quoted 5 lines
Quoted 1 line
Quoted 1 line · On 20.05.14 at 14:31, <[email protected]> wrote:
From: "Luis R. Rodriguez" <[email protected]>
This will allows us to share the same module list with sysemd, and lets us upkeep it in one place.
Hmm - do we really want to further play with this module loading,
That seems to be orthogonal as I'm not adding or removing extensions to it but simply preserving the existing behavior for both old init and systemd, if anything just documenting the existing behavior.
In the last series the modules stuff was discussed and it was pointed out a desire to share and retain only one source for the list of modules, this is why I addressed this in this series. A few regressions were mentioned that seemed to still exist with auto module loading on Linux, this is why this is preserved.
Quoted 2 lines
which for at least two releases was scheduled to be removed in favor of having the tool stack load modules on demand?
If this support gets added to the tool stack then both systemd and old init can just remove this part, however the modules xen.conf service unit file might to then be replaced by an ExecStartPre. The *right* solution at least for Linux, as documented in the README is to really fix auto module loading. For Linux at least it would help have documented on the wiki the exact bug numbers for those issues that exist where auto module loading does not work.
Luis
PATCH v5 14/14 systemd: add xen systemd service and module files
In reply to Luis R. RodriguezFrom: "Luis R. Rodriguez" <[email protected]>
This adds the systemd xen service / module files. All of this is disabled for now, and won't install / build until we hook up proper support for systemd into the build system.
This goes in with AX_AVAILABLE_SYSTEMD() which will enable systemd if development libraries have been found on your build system. If you don't have systemd on target systems things should still work as we use the dynamic linker loader through dlopen() and dlsym(). Only systems that have booted into systemd as its init system are expected to have systemd libraries present at run time. Binaries built with systemd support enabled do not need systemd libaries present unless they actually booted with systemd as their init.
These are originally based on the Fedora systemd files.
Changes made from Fedora's systemd files:
* enables systemd socket activation for C xenstored and Ocaml oxenstored, this uses the dynamic link loader to enable support for one binary under both systemd and non systemd systems.
* use sd_notify(), so change the service to Type=notify, because of this we remove the PIDFile spefification as we don't care, and let systemd do its magic for us, this also means we don't have to fork so we use --no-fork
* defines a modules-load.d, its original source file will be shared between systemd and old init systems
* simplify service files with ConditionVirtualization=xen which uses the built in systemd virtualization backend detection, these service files will not be available to start on systems that do not boot with xen as a hypervisor
* use autoconf to replace @variable@ paths for us which piggy backs on top of the latest autoconf changes to xen
* removes oxenstored service file in favor of a system variable which controls which which xentored to use at run time, we avoid multiple service files this way. It is technically possible to support multiple service files to the two different xenstored's but this is rather pointless right now specially since we cannot stop [co]xenstored. We instead strive for simplicity with one direct target build service file.
* simplifies startup to not require polling on the sockets
as initial socket management is handled by systemd, we just take on the socket later once anything pokes at it, a simple nc -U (as root) on the socket files can activate the service for example. Anything queued up will be sent to us once we start. Socket activation should in theory also let us dynamically switch between xenstores but more importantly we could upgrade xenstored while keeping all active socket communication queued up, but in order to take advantage of this we eventually would need to remove the requirement of not being able to bring down the xenstored. Even though active sockets are supported since most libxl communication doesn't triggger a check on the unix socket first administrators are encouraged to enable the xenstored.service to triggger an initialization of the xenstored upon bring up. Some systems also never use unix sockets for communication with the xenstored and as such active sockets will not be used there.
* allow for xenstored configuration through *either* of these configuration files:
- /etc/sysconfig/xenstored
- /etc/default/xenstored
The /etc/default/xenstored will let debian based systems do the same, while SUSE/OpenSUSE/Fedora/RedHat can keep on chugging with sysconfig
* ensures we create the run directory as most systems will likely be using a tmpfs for run dirs for the pid files
* Some systems define the selinux context in the systemd Option for the /var/lib/xenstored tmpfs:
Options=mode=755,context="system_u:object_r:xenstored_var_lib_t:s0"
For the upstream version we remove that and let systems specify the context on their system /etc/default/xenstored or /etc/sysconfig/xenstored $XENSTORED_MOUNT_CTX variable, with a default to none.
* takes advantage of the shared xendomains helper for the xendomains service
* Add the new dom0 that gets kicked off for disk backend access into its own systemd service associated to xen
We end up with these systemd files:
General requirements:
* proc-xen.mount
* var-lib-xenstored.mount
xenstored:
* xenstored.service
* xenstored.socket
* xenconsoled.service
* xen-qemu-dom0-disk-backend.service.in
Optional:
* xendomains.service
* xen-watchdog.service
As for integration with xen, we house keep all the systemd files under a new directory tools/hotplug/Linux/systemd/ and will be targetted by default when building on Linux systems if systemd enabled at build time, which is only required on the build box, not the user system.
The systemd files will be sanitized for meta @VARIABLES@ upon configuration and installed upon the install target. Systems that do not use systemd can still get systemd service unit files installed if the build system enabled systemd support, this however does not mandate a requirement of having systemd libraries present. Old init scripts are always installed.
If you don't specify a prefix you will end up with the services files under /usr/local/lib/systemd/system/ by default, and systemd modules-load.d conf files under /usr/local/lib/modules-load.d/ which systemd does look for (although it seems this is not documented).
Distributions are expected to provide their /usr/ prefix to end up in the more generic location upon distribution install at /usr/lib/systemd/system/ and /usr/lib/modules-load.d/ respectively.
---
Please run ./autgen.sh after this patch is applied.
.gitignore | 5 + Makefile | 6 +- README | 28 +++++ config/Tools.mk.in | 6 ++ m4/README.source | 7 ++ m4/systemd.m4 | 120 +++++++++++++++++++++ tools/configure.ac | 14 ++- tools/hotplug/Linux/Makefile | 8 +- tools/hotplug/Linux/systemd/Makefile | 70 ++++++++++++ tools/hotplug/Linux/systemd/proc-xen.mount.in | 9 ++ .../Linux/systemd/var-lib-xenstored.mount.in | 13 +++ .../systemd/xen-qemu-dom0-disk-backend.service.in | 22 ++++ .../hotplug/Linux/systemd/xen-watchdog.service.in | 13 +++ tools/hotplug/Linux/systemd/xenconsoled.service.in | 20 ++++ tools/hotplug/Linux/systemd/xendomains.service.in | 16 +++ tools/hotplug/Linux/systemd/xenstored.service.in | 27 +++++ tools/hotplug/Linux/systemd/xenstored.socket.in | 11 ++ 17 files changed, 390 insertions(+), 5 deletions(-) create mode 100644 m4/systemd.m4 create mode 100644 tools/hotplug/Linux/systemd/Makefile create mode 100644 tools/hotplug/Linux/systemd/proc-xen.mount.in create mode 100644 tools/hotplug/Linux/systemd/var-lib-xenstored.mount.in create mode 100644 tools/hotplug/Linux/systemd/xen-qemu-dom0-disk-backend.service.in create mode 100644 tools/hotplug/Linux/systemd/xen-watchdog.service.in create mode 100644 tools/hotplug/Linux/systemd/xenconsoled.service.in create mode 100644 tools/hotplug/Linux/systemd/xendomains.service.in create mode 100644 tools/hotplug/Linux/systemd/xenstored.service.in create mode 100644 tools/hotplug/Linux/systemd/xenstored.socket.in
.gitignore +5 -0
@@ -390,3 +390,8 @@ tools/xenstore/xenstore-watch docs/txt/misc/*.txt docs/txt/man/*.txt docs/figs/*.png + +tools/hotplug/Linux/systemd/*.conf +tools/hotplug/Linux/systemd/*.mount +tools/hotplug/Linux/systemd/*.socket +tools/hotplug/Linux/systemd/*.service
Makefile +5 -1
@@ -216,8 +216,12 @@ uninstall: rm -f $(D)$(CONFIG_DIR)/udev/rules.d/xen-backend.rules rm -f $(D)$(CONFIG_DIR)/udev/rules.d/xend.rules rm -f $(D)$(SYSCONFIG_DIR)/xendomains + rm -f $(D)$(SBINDIR)/xendomains rm -f $(D)$(SYSCONFIG_DIR)/xencommons - rm -rf $(D)/var/run/xen* $(D)/var/lib/xen* + rm -f $(D)$(XEN_SYSTEMD_DIR)/*.service + rm -f $(D)$(XEN_SYSTEMD_DIR)/*.mount + rm -f $(D)$(XEN_SYSTEMD_MODULES_LOAD)/*.conf + rm -rf $(D)${XEN_RUN_DIR}* $(D)/var/lib/xen* make -C tools uninstall rm -rf $(D)/boot/tboot*
README +28 -0
@@ -72,6 +72,7 @@ disabled at compile time: * cmake (if building vtpm stub domains) * markdown * figlet (for generating the traditional Xen start of day banner) + * systemd daemon development files Second, you need to acquire a suitable kernel for use in domain 0. If possible you should use a kernel provided by your OS distributor. If
@@ -197,6 +198,33 @@ For more details refer to: http://wiki.xen.org/wiki/Category:Host_Configuration#Linux_kernel_modules +Systemd and legacy init support +=============================== + +If you have systemd development packages installed you can build binaries +that will work for both old init systems and also for systems booted with the +systemd init replacement by using the configure --enable-systemd flag. When +systemd is enabled all systemd support gets tucked away under a the shared +xenstore library libxenstore.so. Systemd support is provided in libxenstore.so +though the dynamic linking loader (dlopen(), dlsym()) by run time checking +of the library libsystemd-daemon.so. Only systems that we can verify that +booted with systemd as its init are expected to work with systemd, otherwise +the old socket are initialization mechanism is used. If a system has +libsystemd-daemon.so but it did not boot with systemd the old socket +initialization mechanism is used. Systems that do not have libsystemd-daemon.so +will end up using the old socket initialization mechanism. Systemd enables +active socket activation for the xenstored unix sockets, which can be +claimed by cxenstored or oxenstored during initialization. + +For now even if you have systemd libararies present systemd enablement +is left disabled, to enable systemd you must use --enable-systemd on +configure. Systemd may be enabled by default in the future if systemd +development libraries are present after thorough testing. + +For more details refer to the xen xenstored systemd wiki page [3]. + +[3] http://wiki.xen.org/wiki/Xenstored#xenstored_systemd_support + Python Runtime Libraries ========================
config/Tools.mk.in +6 -0
@@ -57,6 +57,12 @@ CONFIG_BLKTAP1 := @blktap1@ CONFIG_VTPM := @vtpm@ CONFIG_QEMUU_EXTRA_ARGS:= @EXTRA_QEMUU_CONFIGURE_ARGS@ +CONFIG_SYSTEMD := @systemd@ +SYSTEMD_CFLAGS := @SYSTEMD_CFLAGS@ +SYSTEMD_LIBS := @SYSTEMD_LIBS@ +XEN_SYSTEMD_DIR := @SYSTEMD_DIR@ +XEN_SYSTEMD_MODULES_LOAD := @SYSTEMD_MODULES_LOAD@ + #System options ZLIB := @zlib@ CONFIG_LIBICONV := @libiconv@
m4/README.source +7 -0
@@ -26,3 +26,10 @@ Date: Mon Feb 3 15:59:18 2014 -0800 With the newly added glib.mk, some of the noinst_* variables need to use += in the evaluation to avoid multiple definition warnings from automake. + +systemd.m4 +========== + +systemd.m4 was contributed to by Luis R. Rodriguez <[email protected]>, +it has no home project but the goal is to generalize this and actually +upstream it into systemd.
m4/systemd.m4 new file +120 -0
120 lines not on this page · raw message
tools/configure.ac +13 -1
@@ -5,7 +5,17 @@ AC_PREREQ([2.67]) AC_INIT([Xen Hypervisor Tools], m4_esyscmd([../version.sh ../xen/Makefile]), [[email protected]], [xen], [http://www.xen.org/]) AC_CONFIG_SRCDIR([libxl/libxl.c]) -AC_CONFIG_FILES([../config/Tools.mk]) +AC_CONFIG_FILES([ +../config/Tools.mk +hotplug/Linux/systemd/proc-xen.mount +hotplug/Linux/systemd/var-lib-xenstored.mount +hotplug/Linux/systemd/xenstored.socket +hotplug/Linux/systemd/xenstored.service +hotplug/Linux/systemd/xenconsoled.service +hotplug/Linux/systemd/xen-qemu-dom0-disk-backend.service +hotplug/Linux/systemd/xendomains.service +hotplug/Linux/systemd/xen-watchdog.service +]) AC_CONFIG_HEADERS([config.h]) AC_CONFIG_AUX_DIR([../])
@@ -48,6 +58,7 @@ m4_include([../m4/extfs.m4]) m4_include([../m4/fetcher.m4]) m4_include([../m4/ax_compare_version.m4]) m4_include([../m4/expand_config.m4]) +m4_include([../m4/systemd.m4]) AX_XEN_EXPAND_CONFIG()
@@ -250,5 +261,6 @@ esac # Checks for header files. AC_CHECK_HEADERS([yajl/yajl_version.h sys/eventfd.h]) +AX_AVAILABLE_SYSTEMD() AC_OUTPUT()
tools/hotplug/Linux/Makefile +5 -3
@@ -25,6 +25,8 @@ XEN_SCRIPTS += vscsi XEN_SCRIPTS += block-iscsi XEN_SCRIPTS += $(XEN_SCRIPTS-y) +SUBDIRS-$(CONFIG_SYSTEMD) += systemd + XEN_SCRIPT_DATA = xen-script-common.sh locking.sh logging.sh XEN_SCRIPT_DATA += xen-hotplug-common.sh xen-network-common.sh vif-common.sh XEN_SCRIPT_DATA += block-common.sh
@@ -33,7 +35,7 @@ UDEV_RULES_DIR = $(CONFIG_DIR)/udev UDEV_RULES = xen-backend.rules $(UDEV_RULES-y) .PHONY: all -all: $(XENCOMMONS_INITD) +all: $(XENCOMMONS_INITD) subdirs-all $(XENCOMMONS_INITD): $(XEN_ROOT)/config/modules $(XENCOMMONS_INITD).in @set -e ; \
@@ -67,7 +69,7 @@ $(XENCOMMONS_INITD): $(XEN_ROOT)/config/modules $(XENCOMMONS_INITD).in build: all .PHONY: install -install: all install-initd install-scripts install-udev +install: all install-initd install-scripts install-udev subdirs-install # See docs/misc/distro_mapping.txt for INITD_DIR location .PHONY: install-initd
@@ -105,4 +107,4 @@ install-udev: done .PHONY: clean -clean: +clean: subdirs-clean
tools/hotplug/Linux/systemd/Makefile new file +70 -0
70 lines not on this page · raw message
tools/hotplug/Linux/systemd/proc-xen.mount.in new file +9 -0
@@ -0,0 +1,9 @@ +[Unit] +Description=Mount /proc/xen files +ConditionVirtualization=xen +RefuseManualStop=true + +[Mount] +What=xenfs +Where=/proc/xen +Type=xenfs
tools/hotplug/Linux/systemd/var-lib-xenstored.mount.in new file +13 -0
@@ -0,0 +1,13 @@ +[Unit] +Description=mount xenstore file system +ConditionVirtualization=xen +RefuseManualStop=true + +[Mount] +Environment=XENSTORED_MOUNT_CTX= +EnvironmentFile=-/etc/sysconfig/xenstored +EnvironmentFile=-/etc/default/xenstored +What=xenstore +Where=@XEN_LIB_STORED@ +Type=tmpfs +Options=mode=755,context="$XENSTORED_MOUNT_CTX"
tools/hotplug/Linux/systemd/xen-qemu-dom0-disk-backend.service.in new file +22 -0
@@ -0,0 +1,22 @@ +[Unit] +Description=qemu for xen dom0 disk backend +Requires=proc-xen.mount var-lib-xenstored.mount xenstored.socket +After=xenstored.service xenconsoled.service +Before=xendomains.service libvirtd.service libvirt-guests.service +RefuseManualStop=true +ConditionVirtualization=xen + +[Service] +Type=simple +EnvironmentFile=-/etc/default/xenstored +EnvironmentFile=-/etc/sysconfig/xenstored +PIDFile=@XEN_RUN_DIR@/qemu-dom0.pid +ExecStartPre=/bin/grep -q control_d /proc/xen/capabilities +ExecStartPre=/bin/mkdir -p /var/run/xen +ExecStart=@LIBEXEC@/qemu-system-i386 -xen-domid 0 \ + -xen-attach -name dom0 -nographic -M xenpv -daemonize \ + -monitor /dev/null -serial /dev/null -parallel /dev/null \ + -pidfile @XEN_RUN_DIR@/qemu-dom0.pid + +[Install] +WantedBy=multi-user.target
tools/hotplug/Linux/systemd/xen-watchdog.service.in new file +13 -0
@@ -0,0 +1,13 @@ +[Unit] +Description=Xen-watchdog - run xen watchdog daemon +Requires=proc-xen.mount +After=proc-xen.mount xendomains.service +ConditionVirtualization=xen + +[Service] +Type=forking +ExecStart=@SBINDIR@/xenwatchdogd 30 15 +KillSignal=USR1 + +[Install] +WantedBy=multi-user.target
tools/hotplug/Linux/systemd/xenconsoled.service.in new file +20 -0
@@ -0,0 +1,20 @@ +[Unit] +Description=Xenconsoled - handles logging from guest consoles and hypervisor +Requires=xenstored.socket +After=xenstored.service +ConditionVirtualization=xen + +[Service] +Type=simple +Environment=XENCONSOLED_ARGS= +Environment=XENCONSOLED_LOG=none +Environment=XENCONSOLED_LOG_DIR=@XEN_LOG_DIR@/console +EnvironmentFile=-/etc/default/xenconsoled +EnvironmentFile=-/etc/sysconfig/xenconsoled +PIDFile=@XEN_RUN_DIR@/xenconsoled.pid +ExecStartPre=/bin/grep -q control_d /proc/xen/capabilities +ExecStartPre=/bin/mkdir -p ${XENCONSOLED_LOG_DIR} +ExecStart=@SBINDIR@/xenconsoled --pid-file @XEN_RUN_DIR@/xenconsoled.pid --log=${XENCONSOLED_LOG} --log-dir=${XENCONSOLED_LOG_DIR} $XENCONSOLED_ARGS + +[Install] +WantedBy=multi-user.target
tools/hotplug/Linux/systemd/xendomains.service.in new file +16 -0
@@ -0,0 +1,16 @@ +[Unit] +Description=Xendomains - start and stop guests on boot and shutdown +Requires=xenstored.socket +After=xenstored.service xenconsoled.service +ConditionVirtualization=xen + +[Service] +Type=oneshot +RemainAfterExit=true +ExecStartPre=/bin/grep -q control_d /proc/xen/capabilities +ExecStart=-@LIBEXEC@/xendomains start +ExecStop=@LIBEXEC@/xendomains stop +ExecReload=@LIBEXEC@/xendomains restart + +[Install] +WantedBy=multi-user.target
tools/hotplug/Linux/systemd/xenstored.service.in new file +27 -0
@@ -0,0 +1,27 @@ +[Unit] +Description=Xenstored - daemon managing xenstore file system +Requires=xenstored.socket proc-xen.mount var-lib-xenstored.mount +After=proc-xen.mount var-lib-xenstored.mount +Before=libvirtd.service libvirt-guests.service +RefuseManualStop=true +ConditionVirtualization=xen +ConditionFileIsExecutable=@XENSTORED@ + +[Service] +Type=notify +Environment=XENSTORED_ARGS= +Environment=XENSTORED_ROOTDIR=@XEN_LIB_STORED@ +EnvironmentFile=-/etc/default/xenstored +EnvironmentFile=-/etc/sysconfig/xenstored +ExecStartPre=/bin/grep -q control_d /proc/xen/capabilities +ExecStartPre=-/bin/rm -f @XEN_LIB_STORED@/tdb* +ExecStartPre=/bin/mkdir -p @XEN_RUN_DIR@ +ExecStart=@XENSTORED@ --no-fork $XENSTORED_ARGS +ExecStartPost=-@BINDIR@/xenstore-write "/local/domain/0/name" "Domain-0" +ExecStartPost=-@BINDIR@/xenstore-write "/local/domain/0/domid" 0 + +[Install] +WantedBy=multi-user.target +Also=xenstored.socket +Also=proc-xen.mount +Also=var-lib-xenstored.mount
tools/hotplug/Linux/systemd/xenstored.socket.in new file +11 -0
@@ -0,0 +1,11 @@ +[Unit] +Description=Xen xenstored / oxenstored Activation Socket +ConditionVirtualization=xen + +[Socket] +ListenStream=/var/run/xenstored/socket +ListenStream=/var/run/xenstored/socket_ro +SocketMode=0600 + +[Install] +WantedBy=sockets.target
Signature · 7 lines
2.0.0.rc3.18.g00a5b79 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
Re: [PATCH v5 14/14] systemd: add xen systemd service and module files
Quoted 5 lines · Luis R. Rodriguez
From: "Luis R. Rodriguez" <[email protected]>
This adds the systemd xen service / module files. All of this is disabled for now, and won't install / build until we hook up proper support for systemd into the build system.
You can ignore the above paragraph except hte first sentence as this added the autconf stuff too. It could be split up but I guess I decided to merge it. It should be easy to tell how to split it up though, just the autconf stuff is what would be left out and moved to a separate patch.
Luis