All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/7] xen: add systemd files
@ 2014-03-19 20:58 Luis R. Rodriguez
  2014-03-19 20:58 ` [PATCH v2 1/7] xenstore-read: add support for a retry open limit on xenstored Luis R. Rodriguez
                   ` (6 more replies)
  0 siblings, 7 replies; 37+ messages in thread
From: Luis R. Rodriguez @ 2014-03-19 20:58 UTC (permalink / raw)
  To: xen-devel
  Cc: Ian Campbell, Stefano Stabellini, Luis R. Rodriguez,
	Jan Rękorajski, Ian Jackson, Jacek Konieczny, M A Young

From: "Luis R. Rodriguez" <mcgrof@suse.com>

This adds systemd files to xen based on the last discussions from
the initial attempt. Its best we all work on these upstream rather
than chugging on our own. It addresses the meta variable changes
for paths and also adds a lot more service files / mount / modules
socket files missing. In order to match the existing init script
behaviour I also added a small retry socket helper to xenstore-read.
We may be able to just rely on systemd's socket monitor instead of
the xenstore-read -l but we keep it as-is for now.

As discussed I ended up moving the old LSB init script for xendomains
to sbin to share it with systemd and created a simple wrapper for
init. The new wrapper gets a new -init postfix to distinguish it
but also to help enable us to keep the history of the original
file after the move within git.

Luis R. Rodriguez (7):
  xenstore-read: add support for a retry open limit on xenstored
  xencommons: use the retry limit instead of implementing our own
    timeout
  tools/xendomains: make xl the default
  tools/xendomains: remove old redhat check
  tools/xendomains: do space cleanups
  tools/xendomains: move to sbin and use init helper
  systemd: add support initial xen systemd service files

 .gitignore                                         |  5 ++
 Config.mk                                          |  9 ++-
 Makefile                                           | 11 ++-
 config/StdGNU.mk                                   |  4 +
 tools/hotplug/Linux/Makefile                       | 13 +++-
 tools/hotplug/Linux/init.d/xencommons              | 19 ++---
 tools/hotplug/Linux/init.d/xendomains-init         | 33 +++++++++
 tools/hotplug/Linux/systemd/Makefile               | 72 ++++++++++++++++++
 tools/hotplug/Linux/systemd/oxenstored.service.in  | 23 ++++++
 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 ++++
 .../Linux/systemd/xen.conf.modules-load.d.in       | 16 ++++
 tools/hotplug/Linux/systemd/xenconsoled.service.in | 20 +++++
 tools/hotplug/Linux/systemd/xendomains.service.in  | 16 ++++
 tools/hotplug/Linux/systemd/xenstored.service.in   | 24 ++++++
 tools/hotplug/Linux/systemd/xenstored.socket.in    |  9 +++
 tools/hotplug/Linux/{init.d => }/xendomains        | 86 ++++++++++------------
 tools/xenstore/xenstore_client.c                   | 31 ++++++--
 20 files changed, 373 insertions(+), 75 deletions(-)
 create mode 100644 tools/hotplug/Linux/init.d/xendomains-init
 create mode 100644 tools/hotplug/Linux/systemd/Makefile
 create mode 100644 tools/hotplug/Linux/systemd/oxenstored.service.in
 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/xen.conf.modules-load.d.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 (92%)

Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: Jan Rękorajski <baggins@pld-linux.org>
Cc: M A Young <m.a.young@durham.ac.uk>
Cc: Jacek Konieczny <jajcus@jajcus.net>
Cc: xen-devel@lists.xenproject.org
-- 
1.9.0


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [PATCH v2 1/7] xenstore-read: add support for a retry open limit on xenstored
  2014-03-19 20:58 [PATCH v2 0/7] xen: add systemd files Luis R. Rodriguez
@ 2014-03-19 20:58 ` Luis R. Rodriguez
  2014-03-21 15:21   ` Ian Campbell
  2014-03-21 15:40   ` David Vrabel
  2014-03-19 20:58 ` [PATCH v2 2/7] xencommons: use the retry limit instead of implementing our own timeout Luis R. Rodriguez
                   ` (5 subsequent siblings)
  6 siblings, 2 replies; 37+ messages in thread
From: Luis R. Rodriguez @ 2014-03-19 20:58 UTC (permalink / raw)
  To: xen-devel
  Cc: Ian Campbell, Stefano Stabellini, Luis R. Rodriguez,
	Jan Rękorajski, Ian Jackson, Jacek Konieczny, M A Young

From: "Luis R. Rodriguez" <mcgrof@suse.com>

This adds support for a customizable retry limit on trying to open
the xenstored, each retry is separated by 1 second. This should allow
us to simplify both our LSB init scripts and eventually our systemd
service files for starting the xenstored.

Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: Jan Rękorajski <baggins@pld-linux.org>
Cc: M A Young <m.a.young@durham.ac.uk>
Cc: Jacek Konieczny <jajcus@jajcus.net>
Cc: xen-devel@lists.xenproject.org
Signed-off-by: Luis R. Rodriguez <mcgrof@suse.com>
---
 tools/xenstore/xenstore_client.c | 31 +++++++++++++++++++++++++------
 1 file changed, 25 insertions(+), 6 deletions(-)

diff --git a/tools/xenstore/xenstore_client.c b/tools/xenstore/xenstore_client.c
index 0ec103f..87972b7 100644
--- a/tools/xenstore/xenstore_client.c
+++ b/tools/xenstore/xenstore_client.c
@@ -77,7 +77,8 @@ usage(enum mode mode, int incl_mode, const char *progname)
 	errx(1, "Usage: %s <mode> [-h] [...]", progname);
     case MODE_read:
 	mstr = incl_mode ? "read " : "";
-	errx(1, "Usage: %s %s[-h] [-p] [-s] key [...]", progname, mstr);
+	errx(1, "Usage: %s %s[-h] [-p] [-s] [ -l <num_open_tries> ] key [...]",
+	     progname, mstr);
     case MODE_write:
 	mstr = incl_mode ? "write " : "";
 	errx(1, "Usage: %s %s[-h] [-s] key value [...]", progname, mstr);
@@ -493,9 +494,9 @@ static enum mode lookup_mode(const char *m)
 int
 main(int argc, char **argv)
 {
-    struct xs_handle *xsh;
+    struct xs_handle *xsh = NULL;
     xs_transaction_t xth = XBT_NULL;
-    int ret = 0, socket = 0;
+    int ret = 0, socket = 0, limit = 1, open_tries;
     int prefix = 0;
     int tidy = 0;
     int upto = 0;
@@ -535,10 +536,11 @@ main(int argc, char **argv)
 	    {"upto",    0, 0, 'u'}, /* MODE_chmod */
 	    {"recurse", 0, 0, 'r'}, /* MODE_chmod */
 	    {"number",  1, 0, 'n'}, /* MODE_watch */
+	    {"limit",   1, 0, 'l'}, /* MODE_read */
 	    {0, 0, 0, 0}
 	};
 
-	c = getopt_long(argc - switch_argv, argv + switch_argv, "hfspturn:",
+	c = getopt_long(argc - switch_argv, argv + switch_argv, "hfspturn:l:",
 			long_options, &index);
 	if (c == -1)
 	    break;
@@ -589,6 +591,16 @@ main(int argc, char **argv)
 	    else
 		usage(mode, switch_argv, argv[0]);
 	    break;
+	case 'l':
+	    if (mode == MODE_read)
+		limit = atoi(optarg);
+	    else
+		usage(mode, switch_argv, argv[0]);
+	    if (limit < 0) {
+		limit = 1;
+		usage(mode, switch_argv, argv[0]);
+	    }
+	    break;
 	}
     }
 
@@ -632,8 +644,15 @@ main(int argc, char **argv)
 	    max_width = ws.ws_col - 2;
     }
 
-    xsh = xs_open(socket ? XS_OPEN_SOCKETONLY : 0);
-    if (xsh == NULL) err(1, "xs_open");
+    for (open_tries = 0; open_tries < limit; open_tries++) {
+	    xsh = xs_open(socket ? XS_OPEN_SOCKETONLY : 0);
+	    if (xsh)
+		    break;
+	    if (limit > 1)
+		    sleep(1);
+    }
+    if (!xsh)
+	    err(1, "xs_open");
 
 again:
     if (transaction) {
-- 
1.9.0


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH v2 2/7] xencommons: use the retry limit instead of implementing our own timeout
  2014-03-19 20:58 [PATCH v2 0/7] xen: add systemd files Luis R. Rodriguez
  2014-03-19 20:58 ` [PATCH v2 1/7] xenstore-read: add support for a retry open limit on xenstored Luis R. Rodriguez
@ 2014-03-19 20:58 ` Luis R. Rodriguez
  2014-03-21 15:24   ` Ian Campbell
  2014-03-19 20:58 ` [PATCH v2 3/7] tools/xendomains: make xl the default Luis R. Rodriguez
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 37+ messages in thread
From: Luis R. Rodriguez @ 2014-03-19 20:58 UTC (permalink / raw)
  To: xen-devel
  Cc: Ian Campbell, Stefano Stabellini, Luis R. Rodriguez,
	Jan Rękorajski, Ian Jackson, Jacek Konieczny, M A Young

From: "Luis R. Rodriguez" <mcgrof@suse.com>

xenstore-read now has support to retry opening the xenstored a certain
amount of times, once each second, use that instead of implementing our
own timeout.

Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: Jan Rękorajski <baggins@pld-linux.org>
Cc: M A Young <m.a.young@durham.ac.uk>
Cc: Jacek Konieczny <jajcus@jajcus.net>
Cc: xen-devel@lists.xenproject.org
Signed-off-by: Luis R. Rodriguez <mcgrof@suse.com>
---
 tools/hotplug/Linux/init.d/xencommons | 19 +++++--------------
 1 file changed, 5 insertions(+), 14 deletions(-)

diff --git a/tools/hotplug/Linux/init.d/xencommons b/tools/hotplug/Linux/init.d/xencommons
index 4ebd636..68d874e 100644
--- a/tools/hotplug/Linux/init.d/xencommons
+++ b/tools/hotplug/Linux/init.d/xencommons
@@ -54,9 +54,6 @@ if test -f /proc/xen/capabilities && \
 fi
 
 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
@@ -93,17 +90,11 @@ do_start () {
 		    echo "No xenstored found"
 		    exit 1
 		fi
-
-		# Wait for xenstored to actually come up, timing out after 30 seconds
-                while [ $time -lt $timeout ] && ! `${BINDIR}/xenstore-read -s / >/dev/null 2>&1` ; do
-                    echo -n .
-		    time=$(($time+1))
-                    sleep 1
-                done
-		echo
-
-		# Exit if we timed out
-		if ! [ $time -lt $timeout ] ; then
+		# We try opening the xenstored socket every second up to the
+		# limit specified, if it hasn't opened by then assume
+		# failure.
+                ${BINDIR}/xenstore-read -l 30 -s / >/dev/null 2>&1
+		if [ $? -ne 0 ] ; then
 		    echo Could not start xenstored
 		    exit 1
 		fi
-- 
1.9.0


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH v2 3/7] tools/xendomains: make xl the default
  2014-03-19 20:58 [PATCH v2 0/7] xen: add systemd files Luis R. Rodriguez
  2014-03-19 20:58 ` [PATCH v2 1/7] xenstore-read: add support for a retry open limit on xenstored Luis R. Rodriguez
  2014-03-19 20:58 ` [PATCH v2 2/7] xencommons: use the retry limit instead of implementing our own timeout Luis R. Rodriguez
@ 2014-03-19 20:58 ` Luis R. Rodriguez
  2014-03-21 15:26   ` Ian Campbell
  2014-03-19 20:58 ` [PATCH v2 4/7] tools/xendomains: remove old redhat check Luis R. Rodriguez
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 37+ messages in thread
From: Luis R. Rodriguez @ 2014-03-19 20:58 UTC (permalink / raw)
  To: xen-devel
  Cc: Ian Campbell, Stefano Stabellini, Luis R. Rodriguez,
	Jan Rękorajski, Ian Jackson, Jacek Konieczny, M A Young

From: "Luis R. Rodriguez" <mcgrof@suse.com>

If that fails backoff to using xm.

Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: Jan Rękorajski <baggins@pld-linux.org>
Cc: M A Young <m.a.young@durham.ac.uk>
Cc: Jacek Konieczny <jajcus@jajcus.net>
Cc: xen-devel@lists.xenproject.org
Signed-off-by: Luis R. Rodriguez <mcgrof@suse.com>
---
 tools/hotplug/Linux/init.d/xendomains | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/hotplug/Linux/init.d/xendomains b/tools/hotplug/Linux/init.d/xendomains
index 59f1e3d..6cb1032 100644
--- a/tools/hotplug/Linux/init.d/xendomains
+++ b/tools/hotplug/Linux/init.d/xendomains
@@ -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
-- 
1.9.0


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH v2 4/7] tools/xendomains: remove old redhat check
  2014-03-19 20:58 [PATCH v2 0/7] xen: add systemd files Luis R. Rodriguez
                   ` (2 preceding siblings ...)
  2014-03-19 20:58 ` [PATCH v2 3/7] tools/xendomains: make xl the default Luis R. Rodriguez
@ 2014-03-19 20:58 ` Luis R. Rodriguez
  2014-03-21 15:28   ` Ian Campbell
  2014-03-19 20:58 ` [PATCH v2 5/7] tools/xendomains: do space cleanups Luis R. Rodriguez
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 37+ messages in thread
From: Luis R. Rodriguez @ 2014-03-19 20:58 UTC (permalink / raw)
  To: xen-devel
  Cc: Ian Campbell, Stefano Stabellini, Luis R. Rodriguez,
	Jan Rękorajski, Ian Jackson, Jacek Konieczny, M A Young

From: "Luis R. Rodriguez" <mcgrof@suse.com>

Fedora already changes their script to skip this check, so
just fold these upstream already to the more LSB compliant set.

Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: Jan Rękorajski <baggins@pld-linux.org>
Cc: M A Young <m.a.young@durham.ac.uk>
Cc: Jacek Konieczny <jajcus@jajcus.net>
Cc: xen-devel@lists.xenproject.org
Signed-off-by: Luis R. Rodriguez <mcgrof@suse.com>
---
 tools/hotplug/Linux/init.d/xendomains | 14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)

diff --git a/tools/hotplug/Linux/init.d/xendomains b/tools/hotplug/Linux/init.d/xendomains
index 6cb1032..fac85ba 100644
--- a/tools/hotplug/Linux/init.d/xendomains
+++ b/tools/hotplug/Linux/init.d/xendomains
@@ -84,19 +84,7 @@ else
 	_SMSG=(done failed failed missed failed skipped unused failed failed)
 	_RC_UNUSED=6
     fi
-    if test -e /etc/init.d/functions; then
-	# REDHAT
-	. /etc/init.d/functions
-	echo_rc()
-	{
-	    #echo -n "  [${_SMSG[${_RC_RV}]}] "
-	    if test ${_RC_RV} = 0; then
-		success "  [${_SMSG[${_RC_RV}]}] "
-	    else
-		failure "  [${_SMSG[${_RC_RV}]}] "
-	    fi
-	}
-    elif test -e /lib/lsb/init-functions; then
+    if test -e /lib/lsb/init-functions; then
 	# LSB    
     	. /lib/lsb/init-functions
         if alias log_success_msg >/dev/null 2>/dev/null; then
-- 
1.9.0


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH v2 5/7] tools/xendomains: do space cleanups
  2014-03-19 20:58 [PATCH v2 0/7] xen: add systemd files Luis R. Rodriguez
                   ` (3 preceding siblings ...)
  2014-03-19 20:58 ` [PATCH v2 4/7] tools/xendomains: remove old redhat check Luis R. Rodriguez
@ 2014-03-19 20:58 ` Luis R. Rodriguez
  2014-03-21 15:29   ` Ian Campbell
  2014-03-19 20:58 ` [PATCH v2 6/7] tools/xendomains: move to sbin and use init helper Luis R. Rodriguez
  2014-03-19 20:58 ` [PATCH v2 7/7] systemd: add support initial xen systemd service files Luis R. Rodriguez
  6 siblings, 1 reply; 37+ messages in thread
From: Luis R. Rodriguez @ 2014-03-19 20:58 UTC (permalink / raw)
  To: xen-devel
  Cc: Ian Campbell, Stefano Stabellini, Luis R. Rodriguez,
	Jan Rękorajski, Ian Jackson, Jacek Konieczny, M A Young

From: "Luis R. Rodriguez" <mcgrof@suse.com>

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.

Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: Jan Rękorajski <baggins@pld-linux.org>
Cc: M A Young <m.a.young@durham.ac.uk>
Cc: Jacek Konieczny <jajcus@jajcus.net>
Cc: xen-devel@lists.xenproject.org
Signed-off-by: Luis R. Rodriguez <mcgrof@suse.com>
---
 tools/hotplug/Linux/init.d/xendomains | 64 +++++++++++++++++------------------
 1 file changed, 32 insertions(+), 32 deletions(-)

diff --git a/tools/hotplug/Linux/init.d/xendomains b/tools/hotplug/Linux/init.d/xendomains
index fac85ba..3d68e07 100644
--- a/tools/hotplug/Linux/init.d/xendomains
+++ b/tools/hotplug/Linux/init.d/xendomains
@@ -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
@@ -85,8 +85,8 @@ else
 	_RC_UNUSED=6
     fi
     if test -e /lib/lsb/init-functions; then
-	# LSB    
-    	. /lib/lsb/init-functions
+	# LSB
+	. /lib/lsb/init-functions
         if alias log_success_msg >/dev/null 2>/dev/null; then
 	  echo_rc()
 	  {
@@ -102,7 +102,7 @@ else
 	    fi
 	  }
         fi
-    else    
+    else
 	# emulate it
 	echo_rc()
 	{
@@ -112,17 +112,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 $?
@@ -134,7 +134,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
@@ -181,13 +181,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
@@ -220,7 +220,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
 		;;
@@ -229,11 +229,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=" "
@@ -273,10 +273,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##*/}"
@@ -337,14 +337,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
@@ -368,7 +368,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
@@ -401,7 +401,7 @@ stop()
 		kill $WDOG_PID >/dev/null 2>&1
 	    else
 		kill $WDOG_PID >/dev/null 2>&1
-		
+
 		echo -e .
 		usleep 1000
 		continue
@@ -460,7 +460,7 @@ stop()
 
     # Unconditionally delete lock file
     rm -f $LOCKFILE
-    
+
     exec 2>&3
 }
 
@@ -470,7 +470,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
 		;;
@@ -489,9 +489,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
@@ -504,7 +504,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
@@ -551,8 +551,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
-- 
1.9.0


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH v2 6/7] tools/xendomains: move to sbin and use init helper
  2014-03-19 20:58 [PATCH v2 0/7] xen: add systemd files Luis R. Rodriguez
                   ` (4 preceding siblings ...)
  2014-03-19 20:58 ` [PATCH v2 5/7] tools/xendomains: do space cleanups Luis R. Rodriguez
@ 2014-03-19 20:58 ` Luis R. Rodriguez
  2014-03-19 22:03   ` Olaf Hering
  2014-03-21 15:34   ` Ian Campbell
  2014-03-19 20:58 ` [PATCH v2 7/7] systemd: add support initial xen systemd service files Luis R. Rodriguez
  6 siblings, 2 replies; 37+ messages in thread
From: Luis R. Rodriguez @ 2014-03-19 20:58 UTC (permalink / raw)
  To: xen-devel
  Cc: Ian Campbell, Stefano Stabellini, Luis R. Rodriguez,
	Jan Rękorajski, Ian Jackson, Jacek Konieczny, M A Young

From: "Luis R. Rodriguez" <mcgrof@suse.com>

The xendomains script can be resued 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 resue it.

Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: Jan Rękorajski <baggins@pld-linux.org>
Cc: M A Young <m.a.young@durham.ac.uk>
Cc: Jacek Konieczny <jajcus@jajcus.net>
Cc: xen-devel@lists.xenproject.org
Signed-off-by: Luis R. Rodriguez <mcgrof@suse.com>
---
 tools/hotplug/Linux/Makefile                |  4 +++-
 tools/hotplug/Linux/init.d/xendomains-init  | 33 +++++++++++++++++++++++++++++
 tools/hotplug/Linux/{init.d => }/xendomains |  0
 3 files changed, 36 insertions(+), 1 deletion(-)
 create mode 100644 tools/hotplug/Linux/init.d/xendomains-init
 rename tools/hotplug/Linux/{init.d => }/xendomains (100%)

diff --git a/tools/hotplug/Linux/Makefile b/tools/hotplug/Linux/Makefile
index 47655f6..0be2e8a 100644
--- a/tools/hotplug/Linux/Makefile
+++ b/tools/hotplug/Linux/Makefile
@@ -3,7 +3,8 @@ include $(XEN_ROOT)/tools/Rules.mk
 
 # Init scripts.
 XEND_INITD = init.d/xend
-XENDOMAINS_INITD = init.d/xendomains
+XENDOMAINS_INITD = init.d/xendomains-init
+XENDOMAINS_SBIN = xendomains
 XENDOMAINS_SYSCONFIG = init.d/sysconfig.xendomains
 
 XENCOMMONS_INITD = init.d/xencommons
@@ -50,6 +51,7 @@ install-initd:
 ifeq ($(CONFIG_XEND),y)
 	$(INSTALL_PROG) $(XEND_INITD) $(DESTDIR)$(INITD_DIR)
 endif
+	$(INSTALL_PROG) $(XENDOMAINS_SBIN) $(DESTDIR)$(SBINDIR)
 	$(INSTALL_PROG) $(XENDOMAINS_INITD) $(DESTDIR)$(INITD_DIR)
 	$(INSTALL_DATA) $(XENDOMAINS_SYSCONFIG) $(DESTDIR)$(SYSCONFIG_DIR)/xendomains
 	$(INSTALL_PROG) $(XENCOMMONS_INITD) $(DESTDIR)$(INITD_DIR)
diff --git a/tools/hotplug/Linux/init.d/xendomains-init b/tools/hotplug/Linux/init.d/xendomains-init
new file mode 100644
index 0000000..da55932
--- /dev/null
+++ b/tools/hotplug/Linux/init.d/xendomains-init
@@ -0,0 +1,33 @@
+#!/bin/bash
+#
+# /etc/init.d/xendomains-init
+#
+# wrapper for starting / stopping domains automatically when domain
+# 0 boots / shuts down on systems using init. The $SBINDIR/xendomains
+# helper is shared between init and systemd systems.
+#
+
+. /etc/xen/scripts/hotplugpath.sh
+
+case "$1" in
+    start)
+	$SBINDIR/xendomains start
+	;;
+    stop)
+	$SBINDIR/xendomains stop
+	;;
+    restart)
+	$SBINDIR/xendomains restart
+	;;
+    reload)
+	$SBINDIR/xendomains reload
+	;;
+    status)
+	$SBINDIR/xendomains status
+	;;
+    *)
+	echo "Usage: $0 {start|stop|restart|reload|status}"
+	exit 3
+	;;
+esac
+exit $?
diff --git a/tools/hotplug/Linux/init.d/xendomains b/tools/hotplug/Linux/xendomains
similarity index 100%
rename from tools/hotplug/Linux/init.d/xendomains
rename to tools/hotplug/Linux/xendomains
-- 
1.9.0


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH v2 7/7] systemd: add support initial xen systemd service files
  2014-03-19 20:58 [PATCH v2 0/7] xen: add systemd files Luis R. Rodriguez
                   ` (5 preceding siblings ...)
  2014-03-19 20:58 ` [PATCH v2 6/7] tools/xendomains: move to sbin and use init helper Luis R. Rodriguez
@ 2014-03-19 20:58 ` Luis R. Rodriguez
  2014-03-19 21:05   ` Luis R. Rodriguez
  2014-03-21 10:08   ` Ian Campbell
  6 siblings, 2 replies; 37+ messages in thread
From: Luis R. Rodriguez @ 2014-03-19 20:58 UTC (permalink / raw)
  To: xen-devel
  Cc: Ian Campbell, Stefano Stabellini, Luis R. Rodriguez,
	Jan Rękorajski, Ian Jackson, Jacek Konieczny, M A Young

From: "Luis R. Rodriguez" <mcgrof@suse.com>

These are originally based on the Fedora systemd files.

Changes made:

  * 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
  * generalized path meta @VARIABLES@ which are configuration specific
  * uses new xenstore-read -l 30 -s prior to doing letting things rip
  * defines systemd socket for xenstored
  * 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
  * defines a modules-load.d for us
  * 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.socket
  * oxenstored.service
  * 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 (CONFIG_Linux) given the low
overhead of only having to only sed the meta @VARIABLES@. The systemd
files will be sanitized for meta @VARIABLES@ upon the all make target by
default, and installed upon the install target. Systems that do not use
systemd will still have these files installed but can still just use the
old LSB init scripts; if they happen to get systemd they can easily
switch to it. The changes above only apply to systems that use systemd.

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.

Since we have a systemd socket defined for xenstored we may be able to
eventually remove our sanity check of tesing access to xenstored with
'xenstore-read -l 30 -s' but we keep it for now.

Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: Jan Rękorajski <baggins@pld-linux.org>
Cc: M A Young <m.a.young@durham.ac.uk>
Cc: Jacek Konieczny <jajcus@jajcus.net>
Cc: xen-devel@lists.xenproject.org
Signed-off-by: Luis R. Rodriguez <mcgrof@suse.com>
---
 .gitignore                                         |  5 ++
 Config.mk                                          |  9 ++-
 Makefile                                           | 11 +++-
 config/StdGNU.mk                                   |  4 ++
 tools/hotplug/Linux/Makefile                       |  9 ++-
 tools/hotplug/Linux/systemd/Makefile               | 72 ++++++++++++++++++++++
 tools/hotplug/Linux/systemd/oxenstored.service.in  | 23 +++++++
 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 ++++
 .../Linux/systemd/xen.conf.modules-load.d.in       | 16 +++++
 tools/hotplug/Linux/systemd/xenconsoled.service.in | 20 ++++++
 tools/hotplug/Linux/systemd/xendomains.service.in  | 16 +++++
 tools/hotplug/Linux/systemd/xenstored.service.in   | 24 ++++++++
 tools/hotplug/Linux/systemd/xenstored.socket.in    |  9 +++
 16 files changed, 270 insertions(+), 5 deletions(-)
 create mode 100644 tools/hotplug/Linux/systemd/Makefile
 create mode 100644 tools/hotplug/Linux/systemd/oxenstored.service.in
 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/xen.conf.modules-load.d.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

diff --git a/.gitignore b/.gitignore
index db3b083..4d77d16 100644
--- a/.gitignore
+++ b/.gitignore
@@ -400,3 +400,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
diff --git a/Config.mk b/Config.mk
index 84c558b..24f9463 100644
--- a/Config.mk
+++ b/Config.mk
@@ -153,7 +153,12 @@ endef
 define buildmakevars2shellvars
     export PREFIX="$(PREFIX)";                                            \
     export XEN_SCRIPT_DIR="$(XEN_SCRIPT_DIR)";                            \
-    export XEN_ROOT="$(XEN_ROOT)"
+    export XEN_SYSTEMD_DIR="$(XEN_SYSTEMD_DIR)";                          \
+    export XEN_SYSTEMD_MODULES_LOAD="$(XEN_SYSTEMD_MODULES_LOAD=)";       \
+    export XEN_ROOT="$(XEN_ROOT)";                                        \
+    export XEN_RUN_DIR="$(XEN_RUN_DIR)";                                  \
+    export XEN_LOG_DIR="$(XEN_LOG_DIR)";                                  \
+    export XEN_LIB_STORED="$(XEN_LIB_STORED)"
 endef
 
 #
@@ -174,6 +179,8 @@ define buildmakevars2file-closure
 	$(foreach var,                                                      \
 	          SBINDIR BINDIR LIBEXEC LIBDIR SHAREDIR PRIVATE_BINDIR     \
 	          XENFIRMWAREDIR XEN_CONFIG_DIR XEN_SCRIPT_DIR XEN_LOCK_DIR \
+		  XEN_SYSTEMD_MODULES_LOAD				    \
+		  XEN_SYSTEMD_DIR XEN_LOG_DIR XEN_LIB_STORED                \
 	          XEN_RUN_DIR XEN_PAGING_DIR,                               \
 	          echo "$(var)=\"$($(var))\"" >>$(1).tmp;)        \
 	$(call move-if-changed,$(1).tmp,$(1))
diff --git a/Makefile b/Makefile
index 4e48457..8f6d479 100644
--- a/Makefile
+++ b/Makefile
@@ -243,8 +243,17 @@ 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)/xenconsoled.service
+	rm -f  $(D)$(XEN_SYSTEMD_DIR)/xendomains.service
+	rm -f  $(D)$(XEN_SYSTEMD_DIR)/xenstored.service
+	rm -f  $(D)$(XEN_SYSTEMD_DIR)/oxenstored.service
+	rm -f  $(D)$(XEN_SYSTEMD_DIR)/xen-watchdog.service
+	rm -f  $(D)$(XEN_SYSTEMD_DIR)/proc-xen.mount
+	rm -f  $(D)$(XEN_SYSTEMD_DIR)/var-lib-xenstored.mount
+	rm -f  $(D)$(XEN_SYSTEMD_MODULES_LOAD)/xen.conf
+	rm -rf $(D)${XEN_RUN_DIR}* $(D)/var/lib/xen*
 	make -C tools uninstall
 	rm -rf $(D)/boot/tboot*
 
diff --git a/config/StdGNU.mk b/config/StdGNU.mk
index 25fc594..70e1a40 100644
--- a/config/StdGNU.mk
+++ b/config/StdGNU.mk
@@ -44,12 +44,16 @@ PRIVATE_BINDIR = $(PRIVATE_PREFIX)/bin
 CONFIG_DIR = /etc
 XEN_LOCK_DIR = /var/lock
 XEN_RUN_DIR = /var/run/xen
+XEN_LOG_DIR = /var/log/xen
+XEN_LIB_STORED = /var/lib/xenstored
 XEN_PAGING_DIR = /var/lib/xen/xenpaging
 
 SYSCONFIG_DIR = $(CONFIG_DIR)/$(CONFIG_LEAF_DIR)
 
 XEN_CONFIG_DIR = $(CONFIG_DIR)/xen
 XEN_SCRIPT_DIR = $(XEN_CONFIG_DIR)/scripts
+XEN_SYSTEMD_DIR = $(PREFIX)/lib/systemd/system/
+XEN_SYSTEMD_MODULES_LOAD = $(PREFIX)/lib/modules-load.d/
 
 SOCKET_LIBS =
 UTIL_LIBS = -lutil
diff --git a/tools/hotplug/Linux/Makefile b/tools/hotplug/Linux/Makefile
index 0be2e8a..99eb33f 100644
--- a/tools/hotplug/Linux/Makefile
+++ b/tools/hotplug/Linux/Makefile
@@ -26,6 +26,8 @@ XEN_SCRIPTS += vscsi
 XEN_SCRIPTS += block-iscsi
 XEN_SCRIPTS += $(XEN_SCRIPTS-y)
 
+SUBDIRS-y += 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
@@ -35,13 +37,13 @@ UDEV_RULES-$(CONFIG_XEND) = xend.rules
 UDEV_RULES = xen-backend.rules $(UDEV_RULES-y)
 
 .PHONY: all
-all:
+all: subdirs-all
 
 .PHONY: build
 build:
 
 .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
@@ -54,6 +56,7 @@ endif
 	$(INSTALL_PROG) $(XENDOMAINS_SBIN) $(DESTDIR)$(SBINDIR)
 	$(INSTALL_PROG) $(XENDOMAINS_INITD) $(DESTDIR)$(INITD_DIR)
 	$(INSTALL_DATA) $(XENDOMAINS_SYSCONFIG) $(DESTDIR)$(SYSCONFIG_DIR)/xendomains
+	ln -sf $(XENDOMAINS_SYSCONFIG) $(SBINDIR)/xendomains
 	$(INSTALL_PROG) $(XENCOMMONS_INITD) $(DESTDIR)$(INITD_DIR)
 	$(INSTALL_DATA) $(XENCOMMONS_SYSCONFIG) $(DESTDIR)$(SYSCONFIG_DIR)/xencommons
 	$(INSTALL_PROG) init.d/xen-watchdog $(DESTDIR)$(INITD_DIR)
@@ -81,4 +84,4 @@ install-udev:
 	done
 
 .PHONY: clean
-clean:
+clean: subdirs-clean
diff --git a/tools/hotplug/Linux/systemd/Makefile b/tools/hotplug/Linux/systemd/Makefile
new file mode 100644
index 0000000..cf898d5
--- /dev/null
+++ b/tools/hotplug/Linux/systemd/Makefile
@@ -0,0 +1,72 @@
+XEN_ROOT = $(CURDIR)/../../../..
+include $(XEN_ROOT)/tools/Rules.mk
+
+XEN_SYSTEMD_MODULES = xen.conf
+
+XEN_SYSTEMD_MOUNT =  proc-xen.mount
+XEN_SYSTEMD_MOUNT += var-lib-xenstored.mount
+
+XEN_SYSTEMD_SOCKET += xenstored.socket
+
+XEN_SYSTEMD_SERVICE  = xenstored.service
+XEN_SYSTEMD_SERVICE += oxenstored.service
+XEN_SYSTEMD_SERVICE += xenconsoled.service
+XEN_SYSTEMD_SERVICE += xen-qemu-dom0-disk-backend.service
+XEN_SYSTEMD_SERVICE += xendomains.service
+XEN_SYSTEMD_SERVICE += xen-watchdog.service
+
+ALL_XEN_SYSTEMD =	$(XEN_SYSTEMD_MODULES) \
+			$(XEN_SYSTEMD_MOUNT)	\
+			$(XEN_SYSTEMD_SOCKET)	\
+			$(XEN_SYSTEMD_SERVICE)
+
+.PHONY: all
+all:	$(ALL_XEN_SYSTEMD)
+
+.PHONY: clean
+clean:
+	rm -f *.service *.mount *.conf
+
+.PHONY: install
+install: $(ALL_XEN_SYSTEMD)
+	[ -d $(DESTDIR)$(XEN_SYSTEMD_DIR) ] || \
+		$(INSTALL_DIR) $(DESTDIR)$(XEN_SYSTEMD_DIR)
+	[ -d $(DESTDIR)$(XEN_SYSTEMD_MODULES_LOAD) ] || \
+		$(INSTALL_DIR) $(DESTDIR)$(XEN_SYSTEMD_MODULES_LOAD)
+	$(INSTALL_DATA) *.socket $(DESTDIR)$(XEN_SYSTEMD_DIR)
+	$(INSTALL_DATA) *.service $(DESTDIR)$(XEN_SYSTEMD_DIR)
+	$(INSTALL_DATA) *.mount $(DESTDIR)$(XEN_SYSTEMD_DIR)
+	$(INSTALL_DATA) *.conf $(DESTDIR)$(XEN_SYSTEMD_MODULES_LOAD)
+
+%.socket: %.socket.in
+	cp $< $@
+	@sed -i -e 's|\@SBINDIR\@|$(SBINDIR)|g'                $@
+	@sed -i -e 's|\@BINDIR\@|$(BINDIR)|g'                  $@
+	@sed -i -e 's|\@XEN_RUN_DIR\@|$(XEN_RUN_DIR)|g'        $@
+	@sed -i -e 's|\@XEN_LOG_DIR\@|$(XEN_LOG_DIR)|g'        $@
+	@sed -i -e 's|\@XEN_LIB_STORED\@|$(XEN_LIB_STORED)|g'  $@
+	@sed -i -e 's|\@LIBEXEC\@|$(LIBEXEC)|g'                $@
+
+%.service: %.service.in
+	cp $< $@
+	@sed -i -e 's|\@SBINDIR\@|$(SBINDIR)|g'                $@
+	@sed -i -e 's|\@BINDIR\@|$(BINDIR)|g'                  $@
+	@sed -i -e 's|\@XEN_RUN_DIR\@|$(XEN_RUN_DIR)|g'        $@
+	@sed -i -e 's|\@XEN_LOG_DIR\@|$(XEN_LOG_DIR)|g'        $@
+	@sed -i -e 's|\@XEN_LIB_STORED\@|$(XEN_LIB_STORED)|g'  $@
+	@sed -i -e 's|\@LIBEXEC\@|$(LIBEXEC)|g'                $@
+
+%.mount: %.mount.in
+	cp $< $@
+	@sed -i -e 's|\@SBINDIR\@|$(SBINDIR)|g'                $@
+	@sed -i -e 's|\@BINDIR\@|$(BINDIR)|g'                  $@
+	@sed -i -e 's|\@XEN_RUN_DIR\@|$(XEN_RUN_DIR)|g'        $@
+	@sed -i -e 's|\@XEN_LOG_DIR\@|$(XEN_LOG_DIR)|g'        $@
+	@sed -i -e 's|\@XEN_LIB_STORED\@|$(XEN_LIB_STORED)|g'  $@
+	@sed -i -e 's|\@LIBEXEC\@|$(LIBEXEC)|g'                $@
+
+%.conf: %.conf.modules-load.d.in
+	cp $< $@
+
+.PHONY: clean
+clean:
diff --git a/tools/hotplug/Linux/systemd/oxenstored.service.in b/tools/hotplug/Linux/systemd/oxenstored.service.in
new file mode 100644
index 0000000..f9bd272
--- /dev/null
+++ b/tools/hotplug/Linux/systemd/oxenstored.service.in
@@ -0,0 +1,23 @@
+[Unit]
+Description=Oxenstored - ocaml version of daemon managing xenstore file system
+Requires=proc-xen.mount var-lib-xenstored.mount xenstored.socket
+After=proc-xen.mount var-lib-xenstored.mount
+Before=libvirtd.service libvirt-guests.service
+Conflicts=xenstored.service
+RefuseManualStop=true
+ConditionPathIsDirectory=/proc/xen
+
+[Service]
+Type=forking
+Environment=XENSTORED_ARGS=
+EnvironmentFile=-/etc/default/xenstored
+EnvironmentFile=-/etc/sysconfig/xenstored
+PIDFile=@XEN_RUN_DIR@/xenstored.pid
+ExecStartPre=/bin/grep -q control_d /proc/xen/capabilities
+ExecStartPre=/bin/mkdir -p @XEN_RUN_DIR@
+ExecStart=@SBINDIR@/oxenstored --pid-file @XEN_RUN_DIR@/xenstored.pid $XENSTORED_ARGS
+ExecStartPost=@BINDIR@/xenstore-read -l 30 -s /
+ExecStartPost=-@BINDIR@/xenstore-write "/local/domain/0/name" "Domain-0"
+
+[Install]
+WantedBy=multi-user.target
diff --git a/tools/hotplug/Linux/systemd/proc-xen.mount.in b/tools/hotplug/Linux/systemd/proc-xen.mount.in
new file mode 100644
index 0000000..6eb61b2
--- /dev/null
+++ b/tools/hotplug/Linux/systemd/proc-xen.mount.in
@@ -0,0 +1,9 @@
+[Unit]
+Description=Mount /proc/xen files
+ConditionPathIsDirectory=/proc/xen
+RefuseManualStop=true
+
+[Mount]
+What=xenfs
+Where=/proc/xen
+Type=xenfs
diff --git a/tools/hotplug/Linux/systemd/var-lib-xenstored.mount.in b/tools/hotplug/Linux/systemd/var-lib-xenstored.mount.in
new file mode 100644
index 0000000..a393b06
--- /dev/null
+++ b/tools/hotplug/Linux/systemd/var-lib-xenstored.mount.in
@@ -0,0 +1,13 @@
+[Unit]
+Description=mount xenstore file system
+ConditionPathIsDirectory=/proc/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"
diff --git a/tools/hotplug/Linux/systemd/xen-qemu-dom0-disk-backend.service.in b/tools/hotplug/Linux/systemd/xen-qemu-dom0-disk-backend.service.in
new file mode 100644
index 0000000..39a82bc
--- /dev/null
+++ b/tools/hotplug/Linux/systemd/xen-qemu-dom0-disk-backend.service.in
@@ -0,0 +1,22 @@
+[Unit]
+Description=qemu for xen dom0 disk backend
+Requires=proc-xen.mount var-lib-xenstored.mount xenstored.socket
+After=proc-xen.mount xenstored.service oxenstored.service xenconsoled.service
+Before=xendomains.service libvirtd.service libvirt-guests.service
+RefuseManualStop=true
+ConditionPathIsDirectory=/proc/xen
+
+[Service]
+Type=forking
+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
diff --git a/tools/hotplug/Linux/systemd/xen-watchdog.service.in b/tools/hotplug/Linux/systemd/xen-watchdog.service.in
new file mode 100644
index 0000000..063fefb
--- /dev/null
+++ b/tools/hotplug/Linux/systemd/xen-watchdog.service.in
@@ -0,0 +1,13 @@
+[Unit]
+Description=Xen-watchdog - run xen watchdog daemon
+Requires=proc-xen.mount
+After=proc-xen.mount xend.service
+ConditionPathIsDirectory=/proc/xen
+
+[Service]
+Type=forking
+ExecStart=@SBINDIR@/xenwatchdogd 30 15
+KillSignal=USR1
+
+[Install]
+WantedBy=multi-user.target
diff --git a/tools/hotplug/Linux/systemd/xen.conf.modules-load.d.in b/tools/hotplug/Linux/systemd/xen.conf.modules-load.d.in
new file mode 100644
index 0000000..3fbd59b
--- /dev/null
+++ b/tools/hotplug/Linux/systemd/xen.conf.modules-load.d.in
@@ -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
+blktap2
+blktap
diff --git a/tools/hotplug/Linux/systemd/xenconsoled.service.in b/tools/hotplug/Linux/systemd/xenconsoled.service.in
new file mode 100644
index 0000000..77c3965
--- /dev/null
+++ b/tools/hotplug/Linux/systemd/xenconsoled.service.in
@@ -0,0 +1,20 @@
+[Unit]
+Description=Xenconsoled - handles logging from guest consoles and hypervisor
+Requires=proc-xen.mount
+After=proc-xen.mount xenstored.service oxenstored.service
+ConditionPathIsDirectory=/proc/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 @XEN_RUN_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
diff --git a/tools/hotplug/Linux/systemd/xendomains.service.in b/tools/hotplug/Linux/systemd/xendomains.service.in
new file mode 100644
index 0000000..35beeaf
--- /dev/null
+++ b/tools/hotplug/Linux/systemd/xendomains.service.in
@@ -0,0 +1,16 @@
+[Unit]
+Description=Xendomains - start and stop guests on boot and shutdown
+Requires=proc-xen.mount
+After=proc-xen.mount xenstored.service xenconsoled.service oxenstored.service
+ConditionPathIsDirectory=/proc/xen
+
+[Service]
+Type=oneshot
+RemainAfterExit=true
+ExecStartPre=/bin/grep -q control_d /proc/xen/capabilities
+ExecStart=-@SBINDIR@/xendomains start
+ExecStop=@SBINDIR@/xendomains stop
+ExecReload=@SBINDIR@/xendomains restart
+
+[Install]
+WantedBy=multi-user.target
diff --git a/tools/hotplug/Linux/systemd/xenstored.service.in b/tools/hotplug/Linux/systemd/xenstored.service.in
new file mode 100644
index 0000000..6a45020
--- /dev/null
+++ b/tools/hotplug/Linux/systemd/xenstored.service.in
@@ -0,0 +1,24 @@
+[Unit]
+Description=Xenstored - daemon managing xenstore file system
+Requires=proc-xen.mount var-lib-xenstored.mount xenstored.socket
+After=proc-xen.mount var-lib-xenstored.mount
+Before=libvirtd.service libvirt-guests.service
+RefuseManualStop=true
+ConditionPathIsDirectory=/proc/xen
+
+[Service]
+Type=forking
+Environment=XENSTORED_ARGS=
+Environment=XENSTORED_ROOTDIR=@XEN_LIB_STORED@
+EnvironmentFile=-/etc/default/xenstored
+EnvironmentFile=-/etc/sysconfig/xenstored
+PIDFile=@XEN_RUN_DIR@/xenstored.pid
+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=@SBINDIR@/xenstored --pid-file @XEN_RUN_DIR@/xenstored.pid $XENSTORED_ARGS
+ExecStartPost=@BINDIR@/xenstore-read -l 30 -s /
+ExecStartPost=@BINDIR@/xenstore-write "/local/domain/0/name" "Domain-0"
+
+[Install]
+WantedBy=multi-user.target
diff --git a/tools/hotplug/Linux/systemd/xenstored.socket.in b/tools/hotplug/Linux/systemd/xenstored.socket.in
new file mode 100644
index 0000000..2091b82
--- /dev/null
+++ b/tools/hotplug/Linux/systemd/xenstored.socket.in
@@ -0,0 +1,9 @@
+[Unit]
+Description=Xen xenstored / oxenstored Activation Socket
+
+[Socket]
+ListenStream=@XEN_LIB_STORED@/socket
+ListenStream=@XEN_LIB_STORED@/socket_ro
+
+[Install]
+WantedBy=sockets.target
-- 
1.9.0


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* Re: [PATCH v2 7/7] systemd: add support initial xen systemd service files
  2014-03-19 20:58 ` [PATCH v2 7/7] systemd: add support initial xen systemd service files Luis R. Rodriguez
@ 2014-03-19 21:05   ` Luis R. Rodriguez
  2014-03-21 10:08   ` Ian Campbell
  1 sibling, 0 replies; 37+ messages in thread
From: Luis R. Rodriguez @ 2014-03-19 21:05 UTC (permalink / raw)
  To: xen-devel
  Cc: Ian Campbell, Stefano Stabellini, Luis R. Rodriguez,
	Jan Rękorajski, Ian Jackson, Jacek Konieczny, M A Young

On Wed, Mar 19, 2014 at 1:58 PM, Luis R. Rodriguez
<mcgrof@do-not-panic.com> wrote:
> @@ -54,6 +56,7 @@ endif
>         $(INSTALL_PROG) $(XENDOMAINS_SBIN) $(DESTDIR)$(SBINDIR)
>         $(INSTALL_PROG) $(XENDOMAINS_INITD) $(DESTDIR)$(INITD_DIR)
>         $(INSTALL_DATA) $(XENDOMAINS_SYSCONFIG) $(DESTDIR)$(SYSCONFIG_DIR)/xendomains
> +       ln -sf $(XENDOMAINS_SYSCONFIG) $(SBINDIR)/xendomains
>         $(INSTALL_PROG) $(XENCOMMONS_INITD) $(DESTDIR)$(INITD_DIR)
>         $(INSTALL_DATA) $(XENCOMMONS_SYSCONFIG) $(DESTDIR)$(SYSCONFIG_DIR)/xencommons
>         $(INSTALL_PROG) init.d/xen-watchdog $(DESTDIR)$(INITD_DIR)


Sorry I forgot to remove this hunk, will send a v3 for this one alone.

 Luis

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH v2 6/7] tools/xendomains: move to sbin and use init helper
  2014-03-19 20:58 ` [PATCH v2 6/7] tools/xendomains: move to sbin and use init helper Luis R. Rodriguez
@ 2014-03-19 22:03   ` Olaf Hering
  2014-03-22  2:00     ` Luis R. Rodriguez
  2014-03-21 15:34   ` Ian Campbell
  1 sibling, 1 reply; 37+ messages in thread
From: Olaf Hering @ 2014-03-19 22:03 UTC (permalink / raw)
  To: Luis R. Rodriguez
  Cc: Ian Campbell, Stefano Stabellini, Luis R. Rodriguez,
	Jan Rękorajski, Ian Jackson, Jacek Konieczny, M A Young,
	xen-devel

On Wed, Mar 19, Luis R. Rodriguez wrote:

> +XENDOMAINS_SBIN = xendomains

I think this is not a user/admin callable binary, like many many other
installed binaries. It should be in some libexec dir, outside of PATH.

Olaf

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH v2 7/7] systemd: add support initial xen systemd service files
  2014-03-19 20:58 ` [PATCH v2 7/7] systemd: add support initial xen systemd service files Luis R. Rodriguez
  2014-03-19 21:05   ` Luis R. Rodriguez
@ 2014-03-21 10:08   ` Ian Campbell
  2014-03-22  2:26     ` Luis R. Rodriguez
  1 sibling, 1 reply; 37+ messages in thread
From: Ian Campbell @ 2014-03-21 10:08 UTC (permalink / raw)
  To: Luis R. Rodriguez
  Cc: Stefano Stabellini, Luis R. Rodriguez, Jan Rękorajski,
	Ian Jackson, Jacek Konieczny, M A Young, xen-devel

On Wed, 2014-03-19 at 13:58 -0700, Luis R. Rodriguez wrote:
> [...]
> diff --git a/tools/hotplug/Linux/systemd/oxenstored.service.in b/tools/hotplug/Linux/systemd/oxenstored.service.in
> [...]
> +ExecStartPost=-@BINDIR@/xenstore-write "/local/domain/0/name" "Domain-0"
> diff --git a/tools/hotplug/Linux/systemd/xenstored.service.in b/tools/hotplug/Linux/systemd/xenstored.service.in
[...]
> +ExecStartPost=@BINDIR@/xenstore-write "/local/domain/0/name" "Domain-0"

I accidentally deleted the subthread about writing domid here too, but I
was wondering if it might be better to have a common xenstore service
which depends on oxenstore.service || cxenstore.service and then does
this kind of common implementation agnostic setup in one place where it
can't get out of sync easily?

(not sure if that is the "systemd way" but thought I'd throw it out
there)

Ian.

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH v2 1/7] xenstore-read: add support for a retry open limit on xenstored
  2014-03-19 20:58 ` [PATCH v2 1/7] xenstore-read: add support for a retry open limit on xenstored Luis R. Rodriguez
@ 2014-03-21 15:21   ` Ian Campbell
  2014-03-21 15:22     ` Ian Jackson
  2014-03-22  1:33     ` Luis R. Rodriguez
  2014-03-21 15:40   ` David Vrabel
  1 sibling, 2 replies; 37+ messages in thread
From: Ian Campbell @ 2014-03-21 15:21 UTC (permalink / raw)
  To: Luis R. Rodriguez
  Cc: Stefano Stabellini, Luis R. Rodriguez, Jan Rękorajski,
	Ian Jackson, Jacek Konieczny, M A Young, xen-devel

On Wed, 2014-03-19 at 13:58 -0700, Luis R. Rodriguez wrote:
> From: "Luis R. Rodriguez" <mcgrof@suse.com>
> 
> This adds support for a customizable retry limit on trying to open
> the xenstored, each retry is separated by 1 second. This should allow
> us to simplify both our LSB init scripts and eventually our systemd
> service files for starting the xenstored.
> 
> Cc: Ian Jackson <ian.jackson@eu.citrix.com>
> Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
> Cc: Ian Campbell <ian.campbell@citrix.com>
> Cc: Jan Rękorajski <baggins@pld-linux.org>
> Cc: M A Young <m.a.young@durham.ac.uk>
> Cc: Jacek Konieczny <jajcus@jajcus.net>
> Cc: xen-devel@lists.xenproject.org
> Signed-off-by: Luis R. Rodriguez <mcgrof@suse.com>
> ---
>  tools/xenstore/xenstore_client.c | 31 +++++++++++++++++++++++++------

Please update docs/man/xenstore* too.

> @@ -535,10 +536,11 @@ main(int argc, char **argv)
>  	    {"upto",    0, 0, 'u'}, /* MODE_chmod */
>  	    {"recurse", 0, 0, 'r'}, /* MODE_chmod */
>  	    {"number",  1, 0, 'n'}, /* MODE_watch */
> +	    {"limit",   1, 0, 'l'}, /* MODE_read */

Limit is an odd name for this options, --retries seems more plausible.

Since this only impacts the xc_open, is there any reason to limit it to
read? I might want to retry on any of the operations.

>  	    {0, 0, 0, 0}
>  	};
>  
> -	c = getopt_long(argc - switch_argv, argv + switch_argv, "hfspturn:",
> +	c = getopt_long(argc - switch_argv, argv + switch_argv, "hfspturn:l:",
>  			long_options, &index);
>  	if (c == -1)
>  	    break;
> @@ -589,6 +591,16 @@ main(int argc, char **argv)
>  	    else
>  		usage(mode, switch_argv, argv[0]);
>  	    break;
> +	case 'l':
> +	    if (mode == MODE_read)
> +		limit = atoi(optarg);
> +	    else
> +		usage(mode, switch_argv, argv[0]);
> +	    if (limit < 0) {
> +		limit = 1;

Pointless?

> +		usage(mode, switch_argv, argv[0]);
> +	    }
> +	    break;
>  	}
>      }
>  
> @@ -632,8 +644,15 @@ main(int argc, char **argv)
>  	    max_width = ws.ws_col - 2;
>      }
>  
> -    xsh = xs_open(socket ? XS_OPEN_SOCKETONLY : 0);

It occurs to me that retrying might be incompatible with the ring base
(i.e. non-socket) method of talking to xenstored. Harmless to retry
though  I suppose.

> -    if (xsh == NULL) err(1, "xs_open");
> +    for (open_tries = 0; open_tries < limit; open_tries++) {

"while(limit--)" (well, retries--) and the adjustments inside the loop
which this implies would be more natural I think.

> +	    xsh = xs_open(socket ? XS_OPEN_SOCKETONLY : 0);
> +	    if (xsh)
> +		    break;
> +	    if (limit > 1)
> +		    sleep(1);
> +    }
> +    if (!xsh)
> +	    err(1, "xs_open");
>  
>  again:
>      if (transaction) {



_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH v2 1/7] xenstore-read: add support for a retry open limit on xenstored
  2014-03-21 15:21   ` Ian Campbell
@ 2014-03-21 15:22     ` Ian Jackson
  2014-03-22  1:36       ` Luis R. Rodriguez
  2014-03-22  1:33     ` Luis R. Rodriguez
  1 sibling, 1 reply; 37+ messages in thread
From: Ian Jackson @ 2014-03-21 15:22 UTC (permalink / raw)
  To: Ian Campbell
  Cc: Stefano Stabellini, Luis R. Rodriguez, Jan Rękorajski,
	Jacek Konieczny, M A Young, xen-devel, Luis R. Rodriguez

Ian Campbell writes ("Re: [Xen-devel] [PATCH v2 1/7] xenstore-read: add support for a retry open limit on xenstored"):
> On Wed, 2014-03-19 at 13:58 -0700, Luis R. Rodriguez wrote:
> > From: "Luis R. Rodriguez" <mcgrof@suse.com>
> > 
> > This adds support for a customizable retry limit on trying to open
> > the xenstored, each retry is separated by 1 second. This should allow
> > us to simplify both our LSB init scripts and eventually our systemd
> > service files for starting the xenstored.

Surely the advantage of fancy new init systems is that we don't have
to have sleeps and polling in our startup scripts ?

Ian.

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH v2 2/7] xencommons: use the retry limit instead of implementing our own timeout
  2014-03-19 20:58 ` [PATCH v2 2/7] xencommons: use the retry limit instead of implementing our own timeout Luis R. Rodriguez
@ 2014-03-21 15:24   ` Ian Campbell
  0 siblings, 0 replies; 37+ messages in thread
From: Ian Campbell @ 2014-03-21 15:24 UTC (permalink / raw)
  To: Luis R. Rodriguez
  Cc: Stefano Stabellini, Luis R. Rodriguez, Jan Rękorajski,
	Ian Jackson, Jacek Konieczny, M A Young, xen-devel

On Wed, 2014-03-19 at 13:58 -0700, Luis R. Rodriguez wrote:
> +		# We try opening the xenstored socket every second up to the
> +		# limit specified, if it hasn't opened by then assume
> +		# failure.
> +                ${BINDIR}/xenstore-read -l 30 -s / >/dev/null 2>&1
> +		if [ $? -ne 0 ] ; then

Mixture of hard and soft tabs? Other than that, 

Acked-by: Ian Campbell <ian.campbell@citrix.com>

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH v2 3/7] tools/xendomains: make xl the default
  2014-03-19 20:58 ` [PATCH v2 3/7] tools/xendomains: make xl the default Luis R. Rodriguez
@ 2014-03-21 15:26   ` Ian Campbell
  0 siblings, 0 replies; 37+ messages in thread
From: Ian Campbell @ 2014-03-21 15:26 UTC (permalink / raw)
  To: Luis R. Rodriguez
  Cc: Stefano Stabellini, Luis R. Rodriguez, Jan Rękorajski,
	Ian Jackson, Jacek Konieczny, M A Young, xen-devel

On Wed, 2014-03-19 at 13:58 -0700, Luis R. Rodriguez wrote:
> From: "Luis R. Rodriguez" <mcgrof@suse.com>
> 
> If that fails backoff to using xm.

Good idea.

> 
> Cc: Ian Jackson <ian.jackson@eu.citrix.com>
> Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>

> Cc: Jan Rękorajski <baggins@pld-linux.org>
> Cc: M A Young <m.a.young@durham.ac.uk>
> Cc: Jacek Konieczny <jajcus@jajcus.net>
> Cc: xen-devel@lists.xenproject.org
> Signed-off-by: Luis R. Rodriguez <mcgrof@suse.com>

Acked-by: Ian Campbell <ian.campbell@citrix.com>



_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH v2 4/7] tools/xendomains: remove old redhat check
  2014-03-19 20:58 ` [PATCH v2 4/7] tools/xendomains: remove old redhat check Luis R. Rodriguez
@ 2014-03-21 15:28   ` Ian Campbell
  2014-03-22  1:56     ` Luis R. Rodriguez
  0 siblings, 1 reply; 37+ messages in thread
From: Ian Campbell @ 2014-03-21 15:28 UTC (permalink / raw)
  To: Luis R. Rodriguez
  Cc: Stefano Stabellini, Luis R. Rodriguez, Jan Rękorajski,
	Ian Jackson, Jacek Konieczny, M A Young, xen-devel

On Wed, 2014-03-19 at 13:58 -0700, Luis R. Rodriguez wrote:
> From: "Luis R. Rodriguez" <mcgrof@suse.com>
> 
> Fedora already changes their script to skip this check, so
> just fold these upstream already to the more LSB compliant set.

We still care (at least a little) about RHEL5 hosts I think, and we
certainly care about RHEL6, so this needs confirming for more than
Fedora.

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH v2 5/7] tools/xendomains: do space cleanups
  2014-03-19 20:58 ` [PATCH v2 5/7] tools/xendomains: do space cleanups Luis R. Rodriguez
@ 2014-03-21 15:29   ` Ian Campbell
  0 siblings, 0 replies; 37+ messages in thread
From: Ian Campbell @ 2014-03-21 15:29 UTC (permalink / raw)
  To: Luis R. Rodriguez
  Cc: Stefano Stabellini, Luis R. Rodriguez, Jan Rękorajski,
	Ian Jackson, Jacek Konieczny, M A Young, xen-devel

On Wed, 2014-03-19 at 13:58 -0700, Luis R. Rodriguez wrote:
> From: "Luis R. Rodriguez" <mcgrof@suse.com>
> 
> 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.
> 
> Cc: Ian Jackson <ian.jackson@eu.citrix.com>
> Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
> Cc: Jan Rękorajski <baggins@pld-linux.org>
> Cc: M A Young <m.a.young@durham.ac.uk>
> Cc: Jacek Konieczny <jajcus@jajcus.net>
> Cc: xen-devel@lists.xenproject.org
> Signed-off-by: Luis R. Rodriguez <mcgrof@suse.com>

Taking it on trust that "git diff -b" would be silent:
Acked-by: Ian Campbell <ian.campbell@citrix.com>



_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH v2 6/7] tools/xendomains: move to sbin and use init helper
  2014-03-19 20:58 ` [PATCH v2 6/7] tools/xendomains: move to sbin and use init helper Luis R. Rodriguez
  2014-03-19 22:03   ` Olaf Hering
@ 2014-03-21 15:34   ` Ian Campbell
  2014-03-22  2:17     ` Luis R. Rodriguez
  1 sibling, 1 reply; 37+ messages in thread
From: Ian Campbell @ 2014-03-21 15:34 UTC (permalink / raw)
  To: Luis R. Rodriguez
  Cc: Stefano Stabellini, Luis R. Rodriguez, Jan Rękorajski,
	Ian Jackson, Jacek Konieczny, M A Young, xen-devel

On Wed, 2014-03-19 at 13:58 -0700, Luis R. Rodriguez wrote:
> From: "Luis R. Rodriguez" <mcgrof@suse.com>
> 
> The xendomains script can be resued with systemd systems as it

"reused"
> 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 resue it.

"reuse"

This strikes me as more of a $libexec thing, what to people think (or
does anyone want to quote LSB at me)

> Cc: Ian Jackson <ian.jackson@eu.citrix.com>
> Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
> Cc: Ian Campbell <ian.campbell@citrix.com>
> Cc: Jan Rękorajski <baggins@pld-linux.org>
> Cc: M A Young <m.a.young@durham.ac.uk>
> Cc: Jacek Konieczny <jajcus@jajcus.net>
> Cc: xen-devel@lists.xenproject.org
> Signed-off-by: Luis R. Rodriguez <mcgrof@suse.com>
> ---
>  tools/hotplug/Linux/Makefile                |  4 +++-
>  tools/hotplug/Linux/init.d/xendomains-init  | 33 +++++++++++++++++++++++++++++
>  tools/hotplug/Linux/{init.d => }/xendomains |  0

For some reason we also have tools/hotplug/NetBSD/rc.d/xendomains. I
presume there is a non-zero chance that it could call this new tool as
well.

>  3 files changed, 36 insertions(+), 1 deletion(-)
>  create mode 100644 tools/hotplug/Linux/init.d/xendomains-init
>  rename tools/hotplug/Linux/{init.d => }/xendomains (100%)
> 
> diff --git a/tools/hotplug/Linux/Makefile b/tools/hotplug/Linux/Makefile
> index 47655f6..0be2e8a 100644
> --- a/tools/hotplug/Linux/Makefile
> +++ b/tools/hotplug/Linux/Makefile
> @@ -3,7 +3,8 @@ include $(XEN_ROOT)/tools/Rules.mk
>  
>  # Init scripts.
>  XEND_INITD = init.d/xend
> -XENDOMAINS_INITD = init.d/xendomains
> +XENDOMAINS_INITD = init.d/xendomains-init

The suffix is unnecessary given the directory, isn't it? Plus it avoids
upgrade hassle by not changing the name of the initscript.

> +XENDOMAINS_SBIN = xendomains
>  XENDOMAINS_SYSCONFIG = init.d/sysconfig.xendomains
>  
>  XENCOMMONS_INITD = init.d/xencommons
> @@ -50,6 +51,7 @@ install-initd:
>  ifeq ($(CONFIG_XEND),y)
>  	$(INSTALL_PROG) $(XEND_INITD) $(DESTDIR)$(INITD_DIR)
>  endif
> +	$(INSTALL_PROG) $(XENDOMAINS_SBIN) $(DESTDIR)$(SBINDIR)
>  	$(INSTALL_PROG) $(XENDOMAINS_INITD) $(DESTDIR)$(INITD_DIR)
>  	$(INSTALL_DATA) $(XENDOMAINS_SYSCONFIG) $(DESTDIR)$(SYSCONFIG_DIR)/xendomains
>  	$(INSTALL_PROG) $(XENCOMMONS_INITD) $(DESTDIR)$(INITD_DIR)
> diff --git a/tools/hotplug/Linux/init.d/xendomains-init b/tools/hotplug/Linux/init.d/xendomains-init
> new file mode 100644
> index 0000000..da55932
> --- /dev/null
> +++ b/tools/hotplug/Linux/init.d/xendomains-init
> @@ -0,0 +1,33 @@
> +#!/bin/bash
> +#
> +# /etc/init.d/xendomains-init
> +#
> +# wrapper for starting / stopping domains automatically when domain
> +# 0 boots / shuts down on systems using init. The $SBINDIR/xendomains
> +# helper is shared between init and systemd systems.

Shouldn't all the LSB headers from the original sit around here
somewhere?

Ian.


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH v2 1/7] xenstore-read: add support for a retry open limit on xenstored
  2014-03-19 20:58 ` [PATCH v2 1/7] xenstore-read: add support for a retry open limit on xenstored Luis R. Rodriguez
  2014-03-21 15:21   ` Ian Campbell
@ 2014-03-21 15:40   ` David Vrabel
  2014-03-21 16:01     ` Ian Campbell
  2014-03-22  1:41     ` Luis R. Rodriguez
  1 sibling, 2 replies; 37+ messages in thread
From: David Vrabel @ 2014-03-21 15:40 UTC (permalink / raw)
  To: Luis R. Rodriguez
  Cc: Ian Campbell, Stefano Stabellini, Luis R. Rodriguez,
	Jan Rękorajski, Ian Jackson, Jacek Konieczny, M A Young,
	xen-devel

On 19/03/14 20:58, Luis R. Rodriguez wrote:
> From: "Luis R. Rodriguez" <mcgrof@suse.com>
> 
> This adds support for a customizable retry limit on trying to open
> the xenstored, each retry is separated by 1 second. This should allow
> us to simplify both our LSB init scripts and eventually our systemd
> service files for starting the xenstored.


This seems odd. Surely the point of systemd is that you only start
services once their dependencies are up?  It doesn't seem right to have
a service poll for another.

> 
> Cc: Ian Jackson <ian.jackson@eu.citrix.com>
> Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
> Cc: Ian Campbell <ian.campbell@citrix.com>
> Cc: Jan Rękorajski <baggins@pld-linux.org>
> Cc: M A Young <m.a.young@durham.ac.uk>
> Cc: Jacek Konieczny <jajcus@jajcus.net>
> Cc: xen-devel@lists.xenproject.org
> Signed-off-by: Luis R. Rodriguez <mcgrof@suse.com>
> ---
>  tools/xenstore/xenstore_client.c | 31 +++++++++++++++++++++++++------
>  1 file changed, 25 insertions(+), 6 deletions(-)
> 
> diff --git a/tools/xenstore/xenstore_client.c b/tools/xenstore/xenstore_client.c
> index 0ec103f..87972b7 100644
> --- a/tools/xenstore/xenstore_client.c
> +++ b/tools/xenstore/xenstore_client.c
> @@ -77,7 +77,8 @@ usage(enum mode mode, int incl_mode, const char *progname)
>  	errx(1, "Usage: %s <mode> [-h] [...]", progname);
>      case MODE_read:
>  	mstr = incl_mode ? "read " : "";
> -	errx(1, "Usage: %s %s[-h] [-p] [-s] key [...]", progname, mstr);
> +	errx(1, "Usage: %s %s[-h] [-p] [-s] [ -l <num_open_tries> ] key [...]",
> +	     progname, mstr);

The command line option would be better as a time out value (in seconds).

David

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH v2 1/7] xenstore-read: add support for a retry open limit on xenstored
  2014-03-21 15:40   ` David Vrabel
@ 2014-03-21 16:01     ` Ian Campbell
  2014-03-22  1:43       ` Luis R. Rodriguez
  2014-03-22  1:41     ` Luis R. Rodriguez
  1 sibling, 1 reply; 37+ messages in thread
From: Ian Campbell @ 2014-03-21 16:01 UTC (permalink / raw)
  To: David Vrabel
  Cc: Stefano Stabellini, Luis R. Rodriguez, Jan Rękorajski,
	Ian Jackson, Jacek Konieczny, M A Young, xen-devel,
	Luis R. Rodriguez

On Fri, 2014-03-21 at 15:40 +0000, David Vrabel wrote:
> On 19/03/14 20:58, Luis R. Rodriguez wrote:
> > From: "Luis R. Rodriguez" <mcgrof@suse.com>
> > 
> > This adds support for a customizable retry limit on trying to open
> > the xenstored, each retry is separated by 1 second. This should allow
> > us to simplify both our LSB init scripts and eventually our systemd
> > service files for starting the xenstored.
> 
> 
> This seems odd. Surely the point of systemd is that you only start
> services once their dependencies are up?  It doesn't seem right to have
> a service poll for another.

Isn't this trying to decide when xenstored is up, for use in the
xenstored.service itself?

But now I think of it -- isn't this exactly what the socket activation
stuff is for?

Ian.

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH v2 1/7] xenstore-read: add support for a retry open limit on xenstored
  2014-03-21 15:21   ` Ian Campbell
  2014-03-21 15:22     ` Ian Jackson
@ 2014-03-22  1:33     ` Luis R. Rodriguez
  2014-03-24  9:57       ` Ian Campbell
  1 sibling, 1 reply; 37+ messages in thread
From: Luis R. Rodriguez @ 2014-03-22  1:33 UTC (permalink / raw)
  To: Ian Campbell
  Cc: Stefano Stabellini, Jan Rękorajski, Ian Jackson,
	Jacek Konieczny, M A Young, xen-devel, Luis R. Rodriguez

On Fri, Mar 21, 2014 at 03:21:10PM +0000, Ian Campbell wrote:
> On Wed, 2014-03-19 at 13:58 -0700, Luis R. Rodriguez wrote:
> > From: "Luis R. Rodriguez" <mcgrof@suse.com>
> > 
> > This adds support for a customizable retry limit on trying to open
> > the xenstored, each retry is separated by 1 second. This should allow
> > us to simplify both our LSB init scripts and eventually our systemd
> > service files for starting the xenstored.
> > 
> > Cc: Ian Jackson <ian.jackson@eu.citrix.com>
> > Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
> > Cc: Ian Campbell <ian.campbell@citrix.com>
> > Cc: Jan Rękorajski <baggins@pld-linux.org>
> > Cc: M A Young <m.a.young@durham.ac.uk>
> > Cc: Jacek Konieczny <jajcus@jajcus.net>
> > Cc: xen-devel@lists.xenproject.org
> > Signed-off-by: Luis R. Rodriguez <mcgrof@suse.com>
> > ---
> >  tools/xenstore/xenstore_client.c | 31 +++++++++++++++++++++++++------
> 
> Please update docs/man/xenstore* too.

docs/man/xenstore.pod.1 has no documentation yet on any arguments passed.
I can't see why this would be a requirement for -l if none of the others
are documented yet. Documenting only one argument would likely be pretty
confusing.

> > @@ -535,10 +536,11 @@ main(int argc, char **argv)
> >  	    {"upto",    0, 0, 'u'}, /* MODE_chmod */
> >  	    {"recurse", 0, 0, 'r'}, /* MODE_chmod */
> >  	    {"number",  1, 0, 'n'}, /* MODE_watch */
> > +	    {"limit",   1, 0, 'l'}, /* MODE_read */
> 
> Limit is an odd name for this options, --retries seems more plausible.

--retries is perfect but the --recurse option takes on the -r smaller version
flag so I went with that. Let me know how you'd like to proceed. I'd prefer
to call it --socket-retries as that would remove ambiguation from ioctl()
open retries or transaaction retries, etc, but again, s is taken for socket
only mode.

> Since this only impacts the xc_open, is there any reason to limit it to
> read? I might want to retry on any of the operations.

Technically no, we need to open the socket for any other mode of operation.

> >  	    {0, 0, 0, 0}
> >  	};
> >  
> > -	c = getopt_long(argc - switch_argv, argv + switch_argv, "hfspturn:",
> > +	c = getopt_long(argc - switch_argv, argv + switch_argv, "hfspturn:l:",
> >  			long_options, &index);
> >  	if (c == -1)
> >  	    break;
> > @@ -589,6 +591,16 @@ main(int argc, char **argv)
> >  	    else
> >  		usage(mode, switch_argv, argv[0]);
> >  	    break;
> > +	case 'l':
> > +	    if (mode == MODE_read)
> > +		limit = atoi(optarg);
> > +	    else
> > +		usage(mode, switch_argv, argv[0]);
> > +	    if (limit < 0) {
> > +		limit = 1;
> 
> Pointless?

No, limit is an int, so it can be negative. That implies nr_watches
could be negative as it didn't have this check, I can add that if you like
as part of my series. Fortunately I see no issues with a negative
nr_watches though as in the loop that its used it will always be less
than 0, so a fix technically wouldn't do anything, but it would be correct
to add it.

> > +		usage(mode, switch_argv, argv[0]);
> > +	    }
> > +	    break;
> >  	}
> >      }
> >  
> > @@ -632,8 +644,15 @@ main(int argc, char **argv)
> >  	    max_width = ws.ws_col - 2;
> >      }
> >  
> > -    xsh = xs_open(socket ? XS_OPEN_SOCKETONLY : 0);
> 
> It occurs to me that retrying might be incompatible with the ring base
> (i.e. non-socket) method of talking to xenstored. Harmless to retry
> though  I suppose.

How so, I mean, if it can only succeed or not, and if it didn't I don't
see how retrying to open the same path would be incompatible?

> > -    if (xsh == NULL) err(1, "xs_open");
> > +    for (open_tries = 0; open_tries < limit; open_tries++) {
> 
> "while(limit--)" (well, retries--)

Yeah that saves us an int.

>  and the adjustments inside the loop
> which this implies would be more natural I think.

Which adjustment? If you mean the branch check on if (limit > 1) -- that
is still needed otherwise we sleep(1) even if it worked.

> > +	    xsh = xs_open(socket ? XS_OPEN_SOCKETONLY : 0);
> > +	    if (xsh)
> > +		    break;
> > +	    if (limit > 1)
> > +		    sleep(1);
> > +    }
> > +    if (!xsh)
> > +	    err(1, "xs_open");
> >  
> >  again:
> >      if (transaction) {
> 
> 
> 

  Luis

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH v2 1/7] xenstore-read: add support for a retry open limit on xenstored
  2014-03-21 15:22     ` Ian Jackson
@ 2014-03-22  1:36       ` Luis R. Rodriguez
  0 siblings, 0 replies; 37+ messages in thread
From: Luis R. Rodriguez @ 2014-03-22  1:36 UTC (permalink / raw)
  To: Ian Jackson
  Cc: Ian Campbell, Stefano Stabellini, Jan Rękorajski,
	Jacek Konieczny, M A Young, xen-devel, Luis R. Rodriguez


[-- Attachment #1.1: Type: text/plain, Size: 1117 bytes --]

On Fri, Mar 21, 2014 at 03:22:49PM +0000, Ian Jackson wrote:
> Ian Campbell writes ("Re: [Xen-devel] [PATCH v2 1/7] xenstore-read: add support for a retry open limit on xenstored"):
> > On Wed, 2014-03-19 at 13:58 -0700, Luis R. Rodriguez wrote:
> > > From: "Luis R. Rodriguez" <mcgrof@suse.com>
> > > 
> > > This adds support for a customizable retry limit on trying to open
> > > the xenstored, each retry is separated by 1 second. This should allow
> > > us to simplify both our LSB init scripts and eventually our systemd
> > > service files for starting the xenstored.
> 
> Surely the advantage of fancy new init systems is that we don't have
> to have sleeps and polling in our startup scripts ?

It was unclear to me from the systemd documentation *exactly* what the socket
service file would do with regards to letting systemd claim it has completed
so although I was hoping for what you wrote I was unable to confirm it and
as such I think we can leave it in the systemd respective scripts for now.
The retry open limit thing could still be used to simplify the old LSB
scripts.

  Luis

[-- Attachment #1.2: Type: application/pgp-signature, Size: 835 bytes --]

[-- Attachment #2: Type: text/plain, Size: 126 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH v2 1/7] xenstore-read: add support for a retry open limit on xenstored
  2014-03-21 15:40   ` David Vrabel
  2014-03-21 16:01     ` Ian Campbell
@ 2014-03-22  1:41     ` Luis R. Rodriguez
  1 sibling, 0 replies; 37+ messages in thread
From: Luis R. Rodriguez @ 2014-03-22  1:41 UTC (permalink / raw)
  To: David Vrabel
  Cc: Ian Campbell, Stefano Stabellini, Jan Rękorajski,
	Ian Jackson, Jacek Konieczny, M A Young, xen-devel,
	Luis R. Rodriguez


[-- Attachment #1.1: Type: text/plain, Size: 1688 bytes --]

On Fri, Mar 21, 2014 at 03:40:05PM +0000, David Vrabel wrote:
> On 19/03/14 20:58, Luis R. Rodriguez wrote:
> > From: "Luis R. Rodriguez" <mcgrof@suse.com>
> > 
> > This adds support for a customizable retry limit on trying to open
> > the xenstored, each retry is separated by 1 second. This should allow
> > us to simplify both our LSB init scripts and eventually our systemd
> > service files for starting the xenstored.
> 
> 
> This seems odd. Surely the point of systemd is that you only start
> services once their dependencies are up?  It doesn't seem right to have
> a service poll for another.

I was unable to verify the dogs will be let loose only once a service
which claims a socket is available, so I left the check for now but
I think once we do confirm this we should remove it. This retry is
also useful for the old LSB scripts though too, it just shaves off
of the existing shell script.

> > diff --git a/tools/xenstore/xenstore_client.c b/tools/xenstore/xenstore_client.c
> > index 0ec103f..87972b7 100644
> > --- a/tools/xenstore/xenstore_client.c
> > +++ b/tools/xenstore/xenstore_client.c
> > @@ -77,7 +77,8 @@ usage(enum mode mode, int incl_mode, const char *progname)
> >  	errx(1, "Usage: %s <mode> [-h] [...]", progname);
> >      case MODE_read:
> >  	mstr = incl_mode ? "read " : "";
> > -	errx(1, "Usage: %s %s[-h] [-p] [-s] key [...]", progname, mstr);
> > +	errx(1, "Usage: %s %s[-h] [-p] [-s] [ -l <num_open_tries> ] key [...]",
> > +	     progname, mstr);
> 
> The command line option would be better as a time out value (in seconds).

-t for "tidy" is taken, let me know what you guys decide for preference.

  Luis

[-- Attachment #1.2: Type: application/pgp-signature, Size: 835 bytes --]

[-- Attachment #2: Type: text/plain, Size: 126 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH v2 1/7] xenstore-read: add support for a retry open limit on xenstored
  2014-03-21 16:01     ` Ian Campbell
@ 2014-03-22  1:43       ` Luis R. Rodriguez
  2014-03-24 10:01         ` Ian Campbell
  0 siblings, 1 reply; 37+ messages in thread
From: Luis R. Rodriguez @ 2014-03-22  1:43 UTC (permalink / raw)
  To: Ian Campbell
  Cc: Stefano Stabellini, Jan Rękorajski, Ian Jackson,
	Jacek Konieczny, David Vrabel, M A Young, xen-devel,
	Luis R. Rodriguez


[-- Attachment #1.1: Type: text/plain, Size: 1328 bytes --]

On Fri, Mar 21, 2014 at 04:01:30PM +0000, Ian Campbell wrote:
> On Fri, 2014-03-21 at 15:40 +0000, David Vrabel wrote:
> > On 19/03/14 20:58, Luis R. Rodriguez wrote:
> > > From: "Luis R. Rodriguez" <mcgrof@suse.com>
> > > 
> > > This adds support for a customizable retry limit on trying to open
> > > the xenstored, each retry is separated by 1 second. This should allow
> > > us to simplify both our LSB init scripts and eventually our systemd
> > > service files for starting the xenstored.
> > 
> > 
> > This seems odd. Surely the point of systemd is that you only start
> > services once their dependencies are up?  It doesn't seem right to have
> > a service poll for another.
> 
> Isn't this trying to decide when xenstored is up, for use in the
> xenstored.service itself?
> 
> But now I think of it -- isn't this exactly what the socket activation
> stuff is for?

Strangely enough the socket file gets systemd to kick off the socket 
prior to xenstored activation, I was baffled by this and since the
documentation is shy about the details I could not trust what I assumed
and everyone else is assuming systemd *should* be doing. We'll have to
dive into the code and verify before knowing for sure we won't let through
an attempt to access xenstored without the old legacy retry.

  Luis

[-- Attachment #1.2: Type: application/pgp-signature, Size: 835 bytes --]

[-- Attachment #2: Type: text/plain, Size: 126 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH v2 4/7] tools/xendomains: remove old redhat check
  2014-03-21 15:28   ` Ian Campbell
@ 2014-03-22  1:56     ` Luis R. Rodriguez
  0 siblings, 0 replies; 37+ messages in thread
From: Luis R. Rodriguez @ 2014-03-22  1:56 UTC (permalink / raw)
  To: Ian Campbell
  Cc: Stefano Stabellini, Jan Rękorajski, Ian Jackson,
	Jacek Konieczny, M A Young, xen-devel, Luis R. Rodriguez

On Fri, Mar 21, 2014 at 03:28:12PM +0000, Ian Campbell wrote:
> On Wed, 2014-03-19 at 13:58 -0700, Luis R. Rodriguez wrote:
> > From: "Luis R. Rodriguez" <mcgrof@suse.com>
> > 
> > Fedora already changes their script to skip this check, so
> > just fold these upstream already to the more LSB compliant set.
> 
> We still care (at least a little) about RHEL5 hosts I think, and we
> certainly care about RHEL6, so this needs confirming for more than
> Fedora.

OK -- I'll drop this from my series.

  Luis

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH v2 6/7] tools/xendomains: move to sbin and use init helper
  2014-03-19 22:03   ` Olaf Hering
@ 2014-03-22  2:00     ` Luis R. Rodriguez
  0 siblings, 0 replies; 37+ messages in thread
From: Luis R. Rodriguez @ 2014-03-22  2:00 UTC (permalink / raw)
  To: Olaf Hering
  Cc: Ian Campbell, Stefano Stabellini, Jan Rękorajski,
	Ian Jackson, Jacek Konieczny, M A Young, xen-devel,
	Luis R. Rodriguez

On Wed, Mar 19, 2014 at 11:03:53PM +0100, Olaf Hering wrote:
> On Wed, Mar 19, Luis R. Rodriguez wrote:
> 
> > +XENDOMAINS_SBIN = xendomains
> 
> I think this is not a user/admin callable binary, like many many other
> installed binaries. It should be in some libexec dir, outside of PATH.

Thanks for the review, will ammend as part of a new series.

  Luis

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH v2 6/7] tools/xendomains: move to sbin and use init helper
  2014-03-21 15:34   ` Ian Campbell
@ 2014-03-22  2:17     ` Luis R. Rodriguez
  2014-03-24 10:09       ` Ian Campbell
  0 siblings, 1 reply; 37+ messages in thread
From: Luis R. Rodriguez @ 2014-03-22  2:17 UTC (permalink / raw)
  To: Ian Campbell
  Cc: Stefano Stabellini, Jan Rękorajski, Ian Jackson,
	Jacek Konieczny, M A Young, xen-devel, Luis R. Rodriguez

On Fri, Mar 21, 2014 at 03:34:10PM +0000, Ian Campbell wrote:
> On Wed, 2014-03-19 at 13:58 -0700, Luis R. Rodriguez wrote:
> > From: "Luis R. Rodriguez" <mcgrof@suse.com>
> This strikes me as more of a $libexec thing, what to people think (or
> does anyone want to quote LSB at me)

I see two votes in a week, enough for me to use it, will ammend.

> > Cc: Ian Jackson <ian.jackson@eu.citrix.com>
> > Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
> > Cc: Ian Campbell <ian.campbell@citrix.com>
> > Cc: Jan Rękorajski <baggins@pld-linux.org>
> > Cc: M A Young <m.a.young@durham.ac.uk>
> > Cc: Jacek Konieczny <jajcus@jajcus.net>
> > Cc: xen-devel@lists.xenproject.org
> > Signed-off-by: Luis R. Rodriguez <mcgrof@suse.com>
> > ---
> >  tools/hotplug/Linux/Makefile                |  4 +++-
> >  tools/hotplug/Linux/init.d/xendomains-init  | 33 +++++++++++++++++++++++++++++
> >  tools/hotplug/Linux/{init.d => }/xendomains |  0
> 
> For some reason we also have tools/hotplug/NetBSD/rc.d/xendomains. I
> presume there is a non-zero chance that it could call this new tool as
> well.

I rather have someone with NetBSD verify and then make that change.

> >  3 files changed, 36 insertions(+), 1 deletion(-)
> >  create mode 100644 tools/hotplug/Linux/init.d/xendomains-init
> >  rename tools/hotplug/Linux/{init.d => }/xendomains (100%)
> > 
> > diff --git a/tools/hotplug/Linux/Makefile b/tools/hotplug/Linux/Makefile
> > index 47655f6..0be2e8a 100644
> > --- a/tools/hotplug/Linux/Makefile
> > +++ b/tools/hotplug/Linux/Makefile
> > @@ -3,7 +3,8 @@ include $(XEN_ROOT)/tools/Rules.mk
> >  
> >  # Init scripts.
> >  XEND_INITD = init.d/xend
> > -XENDOMAINS_INITD = init.d/xendomains
> > +XENDOMAINS_INITD = init.d/xendomains-init
> 
> The suffix is unnecessary given the directory, isn't it? Plus it avoids
> upgrade hassle by not changing the name of the initscript.

It does and I tried to use the same name but if one does a git mv of a file
git adds that old file name and path to a temporary .gitignore requiring you
to use git add -f on that file. It does this because if you insist you loose
the history of the file after the move. Its also why I changed the name of
this modified init.

If you don't want to keep the history I can move forward with a mv but the
history will be lost. I did explain this in the commit log so hope is that
anyone with the same WTF reaction would understand why this as done, I know
I said WTF as well, I tried to avoid this at all costs, let me know if anyone
thinks of a better way.

What I mean by keeping the history is you can do git log --follow on the
script after the move.

> > diff --git a/tools/hotplug/Linux/init.d/xendomains-init b/tools/hotplug/Linux/init.d/xendomains-init
> > new file mode 100644
> > index 0000000..da55932
> > --- /dev/null
> > +++ b/tools/hotplug/Linux/init.d/xendomains-init
> > @@ -0,0 +1,33 @@
> > +#!/bin/bash
> > +#
> > +# /etc/init.d/xendomains-init
> > +#
> > +# wrapper for starting / stopping domains automatically when domain
> > +# 0 boots / shuts down on systems using init. The $SBINDIR/xendomains
> > +# helper is shared between init and systemd systems.
> 
> Shouldn't all the LSB headers from the original sit around here
> somewhere?

OK, will ammend.

  Luis

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH v2 7/7] systemd: add support initial xen systemd service files
  2014-03-21 10:08   ` Ian Campbell
@ 2014-03-22  2:26     ` Luis R. Rodriguez
  2014-03-24 10:11       ` Ian Campbell
  0 siblings, 1 reply; 37+ messages in thread
From: Luis R. Rodriguez @ 2014-03-22  2:26 UTC (permalink / raw)
  To: Ian Campbell
  Cc: Stefano Stabellini, Jan Rękorajski, Ian Jackson,
	Jacek Konieczny, M A Young, xen-devel, Luis R. Rodriguez


[-- Attachment #1.1: Type: text/plain, Size: 1831 bytes --]

On Fri, Mar 21, 2014 at 10:08:14AM +0000, Ian Campbell wrote:
> On Wed, 2014-03-19 at 13:58 -0700, Luis R. Rodriguez wrote:
> > [...]
> > diff --git a/tools/hotplug/Linux/systemd/oxenstored.service.in b/tools/hotplug/Linux/systemd/oxenstored.service.in
> > [...]
> > +ExecStartPost=-@BINDIR@/xenstore-write "/local/domain/0/name" "Domain-0"
> > diff --git a/tools/hotplug/Linux/systemd/xenstored.service.in b/tools/hotplug/Linux/systemd/xenstored.service.in
> [...]
> > +ExecStartPost=@BINDIR@/xenstore-write "/local/domain/0/name" "Domain-0"
> 
> I accidentally deleted the subthread about writing domid here too, but I
> was wondering if it might be better to have a common xenstore service
> which depends on oxenstore.service || cxenstore.service and then does
> this kind of common implementation agnostic setup in one place where it
> can't get out of sync easily?

That's what I was hoping for to achieve with the socket file but that
seems to not work as expected, even if you claim the socket explicitly
as part of both oxenstored and xenstored. To me this could likely be
an enhancement to systemd but not sure.

systemd does not allow one to use || as part of the language for requirements,
it also does not let you use || to exec stuff for services which are of type
"Forking".

This means we either do some sort of meta @VARIABLE@ substitution or a common
init routine which will do the or checking for us. The only problem with this
is systemd will treat the Forking type service ExecStart as the process to care
for, and if we add a wrapper that'd be dead. I haven't tried to implement one
but I think this could confuse systemd or administrators.

> (not sure if that is the "systemd way" but thought I'd throw it out
> there)

Its what I wanted to do as well. I tried.

  Luis

[-- Attachment #1.2: Type: application/pgp-signature, Size: 835 bytes --]

[-- Attachment #2: Type: text/plain, Size: 126 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH v2 1/7] xenstore-read: add support for a retry open limit on xenstored
  2014-03-22  1:33     ` Luis R. Rodriguez
@ 2014-03-24  9:57       ` Ian Campbell
  0 siblings, 0 replies; 37+ messages in thread
From: Ian Campbell @ 2014-03-24  9:57 UTC (permalink / raw)
  To: Luis R. Rodriguez
  Cc: Stefano Stabellini, Jan Rękorajski, Ian Jackson,
	Jacek Konieczny, M A Young, xen-devel, Luis R. Rodriguez

On Sat, 2014-03-22 at 02:33 +0100, Luis R. Rodriguez wrote:
> On Fri, Mar 21, 2014 at 03:21:10PM +0000, Ian Campbell wrote:
> > On Wed, 2014-03-19 at 13:58 -0700, Luis R. Rodriguez wrote:
> > > From: "Luis R. Rodriguez" <mcgrof@suse.com>
> > > 
> > > This adds support for a customizable retry limit on trying to open
> > > the xenstored, each retry is separated by 1 second. This should allow
> > > us to simplify both our LSB init scripts and eventually our systemd
> > > service files for starting the xenstored.
> > > 
> > > Cc: Ian Jackson <ian.jackson@eu.citrix.com>
> > > Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
> > > Cc: Ian Campbell <ian.campbell@citrix.com>
> > > Cc: Jan Rękorajski <baggins@pld-linux.org>
> > > Cc: M A Young <m.a.young@durham.ac.uk>
> > > Cc: Jacek Konieczny <jajcus@jajcus.net>
> > > Cc: xen-devel@lists.xenproject.org
> > > Signed-off-by: Luis R. Rodriguez <mcgrof@suse.com>
> > > ---
> > >  tools/xenstore/xenstore_client.c | 31 +++++++++++++++++++++++++------
> > 
> > Please update docs/man/xenstore* too.
> 
> docs/man/xenstore.pod.1 has no documentation yet on any arguments passed.
> I can't see why this would be a requirement for -l if none of the others
> are documented yet. Documenting only one argument would likely be pretty
> confusing.

We have to start somewhere and the policy is to try not to make things
worse.

(obviously if you want to document some of the other options then feel
free, it would be most appreciated, but I'll only insist on the new one)

> > > @@ -535,10 +536,11 @@ main(int argc, char **argv)
> > >  	    {"upto",    0, 0, 'u'}, /* MODE_chmod */
> > >  	    {"recurse", 0, 0, 'r'}, /* MODE_chmod */
> > >  	    {"number",  1, 0, 'n'}, /* MODE_watch */
> > > +	    {"limit",   1, 0, 'l'}, /* MODE_read */
> > 
> > Limit is an odd name for this options, --retries seems more plausible.
> 
> --retries is perfect but the --recurse option takes on the -r smaller version
> flag so I went with that. Let me know how you'd like to proceed. I'd prefer
> to call it --socket-retries as that would remove ambiguation from ioctl()
> open retries or transaaction retries, etc, but again, s is taken for socket
> only mode.

I think it would be fine to have this option be a long-option only one,
its mainly for a pretty specific use case.

> > Since this only impacts the xc_open, is there any reason to limit it to
> > read? I might want to retry on any of the operations.
> 
> Technically no, we need to open the socket for any other mode of operation.
> 
> > >  	    {0, 0, 0, 0}
> > >  	};
> > >  
> > > -	c = getopt_long(argc - switch_argv, argv + switch_argv, "hfspturn:",
> > > +	c = getopt_long(argc - switch_argv, argv + switch_argv, "hfspturn:l:",
> > >  			long_options, &index);
> > >  	if (c == -1)
> > >  	    break;
> > > @@ -589,6 +591,16 @@ main(int argc, char **argv)
> > >  	    else
> > >  		usage(mode, switch_argv, argv[0]);
> > >  	    break;
> > > +	case 'l':
> > > +	    if (mode == MODE_read)
> > > +		limit = atoi(optarg);
> > > +	    else
> > > +		usage(mode, switch_argv, argv[0]);
> > > +	    if (limit < 0) {
> > > +		limit = 1;
> > 
> > Pointless?
> 
> No, limit is an int, so it can be negative.

I meant the assignment, not the if. Since the next thing you do is call
usage() which always exits.

> 
> > > +		usage(mode, switch_argv, argv[0]);
> > > +	    }
> > > +	    break;
> > >  	}
> > >      }
> > >  
> > > @@ -632,8 +644,15 @@ main(int argc, char **argv)
> > >  	    max_width = ws.ws_col - 2;
> > >      }
> > >  
> > > -    xsh = xs_open(socket ? XS_OPEN_SOCKETONLY : 0);
> > 
> > It occurs to me that retrying might be incompatible with the ring base
> > (i.e. non-socket) method of talking to xenstored. Harmless to retry
> > though  I suppose.
> 
> How so, I mean, if it can only succeed or not, and if it didn't I don't
> see how retrying to open the same path would be incompatible?

IIRC opening (or maybe using) the ring based interface while the daemon
isn't running will hang not fail. But retrying is rather moot in that
case.

> > > -    if (xsh == NULL) err(1, "xs_open");
> > > +    for (open_tries = 0; open_tries < limit; open_tries++) {
> > 
> > "while(limit--)" (well, retries--)
> 
> Yeah that saves us an int.
> 
> >  and the adjustments inside the loop
> > which this implies would be more natural I think.
> 
> Which adjustment? If you mean the branch check on if (limit > 1) -- that
> is still needed otherwise we sleep(1) even if it worked.

I meant any necessary adjustments implied by changing from a for over
open_tries to a while over limit, maybe there aren't any, or maybe that
if (limit) sleep needs adjusting I wasn't sure.

Ian.


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH v2 1/7] xenstore-read: add support for a retry open limit on xenstored
  2014-03-22  1:43       ` Luis R. Rodriguez
@ 2014-03-24 10:01         ` Ian Campbell
  0 siblings, 0 replies; 37+ messages in thread
From: Ian Campbell @ 2014-03-24 10:01 UTC (permalink / raw)
  To: Luis R. Rodriguez
  Cc: Stefano Stabellini, Jan Rękorajski, Ian Jackson,
	Jacek Konieczny, David Vrabel, M A Young, xen-devel,
	Luis R. Rodriguez

On Sat, 2014-03-22 at 02:43 +0100, Luis R. Rodriguez wrote:
> On Fri, Mar 21, 2014 at 04:01:30PM +0000, Ian Campbell wrote:
> > On Fri, 2014-03-21 at 15:40 +0000, David Vrabel wrote:
> > > On 19/03/14 20:58, Luis R. Rodriguez wrote:
> > > > From: "Luis R. Rodriguez" <mcgrof@suse.com>
> > > > 
> > > > This adds support for a customizable retry limit on trying to open
> > > > the xenstored, each retry is separated by 1 second. This should allow
> > > > us to simplify both our LSB init scripts and eventually our systemd
> > > > service files for starting the xenstored.
> > > 
> > > 
> > > This seems odd. Surely the point of systemd is that you only start
> > > services once their dependencies are up?  It doesn't seem right to have
> > > a service poll for another.
> > 
> > Isn't this trying to decide when xenstored is up, for use in the
> > xenstored.service itself?
> > 
> > But now I think of it -- isn't this exactly what the socket activation
> > stuff is for?
> 
> Strangely enough the socket file gets systemd to kick off the socket 
> prior to xenstored activation, I was baffled by this

My understanding was that this was the whole point.

>  and since the
> documentation is shy about the details I could not trust what I assumed
> and everyone else is assuming systemd *should* be doing. We'll have to
> dive into the code and verify before knowing for sure we won't let through
> an attempt to access xenstored without the old legacy retry.

Right, please can you confirm with someone who understands systemd
socket activation what we should be doing here instead of guessing.

Ian.

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH v2 6/7] tools/xendomains: move to sbin and use init helper
  2014-03-22  2:17     ` Luis R. Rodriguez
@ 2014-03-24 10:09       ` Ian Campbell
  2014-04-28  5:11         ` Luis R. Rodriguez
  0 siblings, 1 reply; 37+ messages in thread
From: Ian Campbell @ 2014-03-24 10:09 UTC (permalink / raw)
  To: Luis R. Rodriguez
  Cc: Stefano Stabellini, Jan Rękorajski, Ian Jackson,
	Jacek Konieczny, M A Young, xen-devel, Luis R. Rodriguez

On Sat, 2014-03-22 at 03:17 +0100, Luis R. Rodriguez wrote:
> On Fri, Mar 21, 2014 at 03:34:10PM +0000, Ian Campbell wrote:
> > On Wed, 2014-03-19 at 13:58 -0700, Luis R. Rodriguez wrote:

> > > Cc: Ian Jackson <ian.jackson@eu.citrix.com>
> > > Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
> > > Cc: Ian Campbell <ian.campbell@citrix.com>
> > > Cc: Jan Rękorajski <baggins@pld-linux.org>
> > > Cc: M A Young <m.a.young@durham.ac.uk>
> > > Cc: Jacek Konieczny <jajcus@jajcus.net>
> > > Cc: xen-devel@lists.xenproject.org
> > > Signed-off-by: Luis R. Rodriguez <mcgrof@suse.com>
> > > ---
> > >  tools/hotplug/Linux/Makefile                |  4 +++-
> > >  tools/hotplug/Linux/init.d/xendomains-init  | 33 +++++++++++++++++++++++++++++
> > >  tools/hotplug/Linux/{init.d => }/xendomains |  0
> > 
> > For some reason we also have tools/hotplug/NetBSD/rc.d/xendomains. I
> > presume there is a non-zero chance that it could call this new tool as
> > well.
> 
> I rather have someone with NetBSD verify and then make that change.

OK
> 
> > >  3 files changed, 36 insertions(+), 1 deletion(-)
> > >  create mode 100644 tools/hotplug/Linux/init.d/xendomains-init
> > >  rename tools/hotplug/Linux/{init.d => }/xendomains (100%)
> > > 
> > > diff --git a/tools/hotplug/Linux/Makefile b/tools/hotplug/Linux/Makefile
> > > index 47655f6..0be2e8a 100644
> > > --- a/tools/hotplug/Linux/Makefile
> > > +++ b/tools/hotplug/Linux/Makefile
> > > @@ -3,7 +3,8 @@ include $(XEN_ROOT)/tools/Rules.mk
> > >  
> > >  # Init scripts.
> > >  XEND_INITD = init.d/xend
> > > -XENDOMAINS_INITD = init.d/xendomains
> > > +XENDOMAINS_INITD = init.d/xendomains-init
> > 
> > The suffix is unnecessary given the directory, isn't it? Plus it avoids
> > upgrade hassle by not changing the name of the initscript.
> 
> It does and I tried to use the same name but if one does a git mv of a file
> git adds that old file name and path to a temporary .gitignore requiring you
> to use git add -f on that file. It does this because if you insist you loose
> the history of the file after the move. Its also why I changed the name of
> this modified init.
> 
> If you don't want to keep the history I can move forward with a mv but the
> history will be lost. I did explain this in the commit log so hope is that
> anyone with the same WTF reaction would understand why this as done, I know
> I said WTF as well, I tried to avoid this at all costs, let me know if anyone
> thinks of a better way.
> 
> What I mean by keeping the history is you can do git log --follow on the
> script after the move.

The history is never lost. If git was actually losing history there
would be uproar, and the structure of the repo prevents it anyway.

I skanked up an example commit (see below) and git comes up with:
 2 files changed, 54 insertions(+), 610 deletions(-)
 rewrite tools/hotplug/Linux/init.d/xendomains (91%)
 rename tools/hotplug/Linux/{init.d => }/xendomains (93%)
and "git log --follow tools/hotplug/Linux/xendomains" works exactly as I
expected, so I think things are fine.

Even if this weren't the case (perhaps the copy/rename detection doesn't
notice it in some versions of git) you could still get at the history
manually, you just don't get it automatically, which I think is fine in
this case.

Ian.

commit e9861de906d91fd2a3c3aad0aa5485d0f90cad67
Author: Ian Campbell <ian.campbell@citrix.com>
Date:   Mon Mar 24 10:06:45 2014 +0000

    testing

diff --git a/tools/hotplug/Linux/init.d/xendomains b/tools/hotplug/Linux/init.d/xendomains
index 59f1e3d..c91e1a5 100644
--- a/tools/hotplug/Linux/init.d/xendomains
+++ b/tools/hotplug/Linux/init.d/xendomains
@@ -27,559 +27,27 @@
 #                    boots / shuts down.
 ### END INIT INFO
 
-. /etc/xen/scripts/hotplugpath.sh
-
-CMD=${SBINDIR}/xm
-HEADCOMP="LinuxGuestRecord"
-$CMD list &> /dev/null
-if test $? -ne 0
-then
-	CMD=${SBINDIR}/xl
-	HEADCOMP="Xen saved domain"
-fi
-
-$CMD list &> /dev/null
-if test $? -ne 0
-then
-	exit 0;
-fi
-
-# 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
-fi
-
-# See docs/misc/distro_mapping.txt
-if [ -d /var/lock/subsys ]; then
-	LOCKFILE=/var/lock/subsys/xendomains
-else
-	LOCKFILE=/var/lock/xendomains
-fi
-
-if [ -d /etc/sysconfig ]; then
-	XENDOM_CONFIG=/etc/sysconfig/xendomains
-else
-	XENDOM_CONFIG=/etc/default/xendomains
-fi
-
-test -r $XENDOM_CONFIG || { echo "$XENDOM_CONFIG not existing";
-	if [ "$1" = "stop" ]; then exit 0;
-	else exit 6; fi; }
-
-. $XENDOM_CONFIG
-
-# Use the SUSE rc_ init script functions;
-# emulate them on LSB, RH and other systems
-if test -e /etc/rc.status; then
-    # SUSE rc script library
-    . /etc/rc.status
-else    
-    _cmd=$1
-    declare -a _SMSG
-    if test "${_cmd}" = "status"; then
-	_SMSG=(running dead dead unused unknown)
-	_RC_UNUSED=3
-    else
-	_SMSG=(done failed failed missed failed skipped unused failed failed)
-	_RC_UNUSED=6
-    fi
-    if test -e /etc/init.d/functions; then
-	# REDHAT
-	. /etc/init.d/functions
-	echo_rc()
-	{
-	    #echo -n "  [${_SMSG[${_RC_RV}]}] "
-	    if test ${_RC_RV} = 0; then
-		success "  [${_SMSG[${_RC_RV}]}] "
-	    else
-		failure "  [${_SMSG[${_RC_RV}]}] "
-	    fi
-	}
-    elif test -e /lib/lsb/init-functions; then
-	# LSB    
-    	. /lib/lsb/init-functions
-        if alias log_success_msg >/dev/null 2>/dev/null; then
-	  echo_rc()
-	  {
-	       echo "  [${_SMSG[${_RC_RV}]}] "
-	  }
-        else
-	  echo_rc()
-	  {
-	    if test ${_RC_RV} = 0; then
-		log_success_msg "  [${_SMSG[${_RC_RV}]}] "
-	    else
-		log_failure_msg "  [${_SMSG[${_RC_RV}]}] "
-	    fi
-	  }
-        fi
-    else    
-	# emulate it
-	echo_rc()
-	{
-	    echo "  [${_SMSG[${_RC_RV}]}] "
-	}
-    fi
-    rc_reset() { _RC_RV=0; }
-    rc_failed()
-    {
-	if test -z "$1"; then 
-	    _RC_RV=1;
-	elif test "$1" != "0"; then 
-	    _RC_RV=$1; 
-    	fi
-	return ${_RC_RV}
-    }
-    rc_check()
-    {
-	return rc_failed $?
-    }	
-    rc_status()
-    {
-	rc_failed $?
-	if test "$1" = "-r"; then _RC_RV=0; shift; fi
-	if test "$1" = "-s"; then rc_failed 5; echo_rc; rc_failed 3; shift; fi
-	if test "$1" = "-u"; then rc_failed ${_RC_UNUSED}; echo_rc; rc_failed 3; shift; fi
-	if test "$1" = "-v"; then echo_rc; shift; fi
-	if test "$1" = "-r"; then _RC_RV=0; shift; fi
-	return ${_RC_RV}
-    }
-    rc_exit() { exit ${_RC_RV}; }
-    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
-	return 1
-    }
-fi
-
-if ! which usleep >&/dev/null
-then
-  usleep()
-  {
-    if [ -n "$1" ]
-    then
-      sleep $(( $1 / 1000000 ))
-    fi
-  }
-fi
-
-# Reset status of this service
-rc_reset
-
-##
-# Returns 0 (success) if the given parameter names a directory, and that
-# directory is not empty.
-#
-contains_something()
-{
-  if [ -d "$1" ] && [ `/bin/ls $1 | wc -l` -gt 0 ]
-  then
-    return 0
-  else
-    return 1
-  fi
-}
-
-# read name from xen config file
-rdname()
-{
-    NM=$($CMD create --quiet --dryrun --defconfig "$1" |
-         sed -n 's/^.*(name \(.*\))$/\1/p;s/^.*"name": "\(.*\)",$/\1/p')
-}
-
-rdnames()
-{
-    NAMES=
-    if ! contains_something "$XENDOMAINS_AUTO"
-    then 
-	return
-    fi
-    for dom in $XENDOMAINS_AUTO/*; do
-	rdname $dom
-	if test -z $NAMES; then 
-	    NAMES=$NM; 
-	else
-	    NAMES="$NAMES|$NM"
-	fi
-    done
-}
-
-LIST_GREP='(domain\|(domid\|(name\|^    {$\|"name":\|"domid":'
-parseln()
-{
-    if [[ "$1" =~ '(domain' ]] || [[ "$1" = "{" ]]; then
-        name=;id=
-    elif [[ "$1" =~ '(name' ]]; then
-        name=$(echo $1 | sed -e 's/^.*(name \(.*\))$/\1/')
-    elif [[ "$1" =~ '(domid' ]]; then
-        id=$(echo $1 | sed -e 's/^.*(domid \(.*\))$/\1/')
-    elif [[ "$1" =~ '"name":' ]]; then
-        name=$(echo $1 | sed -e 's/^.*"name": "\(.*\)",$/\1/')
-    elif [[ "$1" =~ '"domid":' ]]; then
-        id=$(echo $1 | sed -e 's/^.*"domid": \(.*\),$/\1/')
-    fi
-
-    [ -n "$name" -a -n "$id" ] && return 0 || return 1
-}
-
-is_running()
-{
-    rdname $1
-    RC=1
-    name=;id=
-    while read LN; do
-	parseln "$LN" || continue
-	if test $id = 0; then continue; fi
-	case $name in 
-	    ($NM)
-		RC=0
-		;;
-	esac
-    done < <($CMD list -l | grep "$LIST_GREP")
-    return $RC
-}
-
-start() 
-{
-    if [ -f $LOCKFILE ]; then 
-	echo -e "xendomains already running (lockfile exists)"
-	return; 
-    fi
-
-    saved_domains=" "
-    if [ "$XENDOMAINS_RESTORE" = "true" ] &&
-       contains_something "$XENDOMAINS_SAVE"
-    then
-	mkdir -p $(dirname "$LOCKFILE")
-	touch $LOCKFILE
-	echo -n "Restoring Xen domains:"
-	saved_domains=`ls $XENDOMAINS_SAVE`
-        for dom in $XENDOMAINS_SAVE/*; do
-            if [ -f $dom ] ; then
-                HEADER=`head -c 16 $dom | head -n 1 2> /dev/null`
-                if [ "$HEADER" = "$HEADCOMP" ]; then
-                    echo -n " ${dom##*/}"
-                    XMR=`$CMD restore $dom 2>&1 1>/dev/null`
-                    #$CMD restore $dom
-                    if [ $? -ne 0 ]; then
-                        echo -e "\nAn error occurred while restoring domain ${dom##*/}:\n$XMR"
-                        rc_failed $?
-                        echo -e '!'
-                    else
-                        # mv $dom ${dom%/*}/.${dom##*/}
-                        rm $dom
-                    fi
-                fi
-            fi
-        done
-	echo -e
-    fi
-
-    if contains_something "$XENDOMAINS_AUTO"
-    then
-	touch $LOCKFILE
-	echo -n "Starting auto Xen domains:"
-	# We expect config scripts for auto starting domains to be in
-	# 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 
-	# 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 
-	# restore correctly it requires administrative attention.
-	for dom in $XENDOMAINS_AUTO/*; do
-	    echo -n " ${dom##*/}"
-	    shortdom=$(echo $dom | sed -n 's/^.*\/\(.*\)$/\1/p')
-	    echo $saved_domains | grep -w $shortdom > /dev/null
-	    if [ $? -eq 0 ] || is_running $dom; then
-		echo -n "(skip)"
-	    else
-		XMC=`$CMD create --quiet --defconfig $dom`
-		if [ $? -ne 0 ]; then
-		    echo -e "\nAn error occurred while creating domain ${dom##*/}: $XMC\n"
-		    rc_failed $?
-		    echo -e '!'
-		else
-		    usleep $XENDOMAINS_CREATE_USLEEP
-		fi
-	    fi
-	done
-    fi
-}
-
-all_zombies()
-{
-    name=;id=
-    while read LN; do
-	parseln "$LN" || continue
-	if test $id = 0; then continue; fi
-	if test "$state" != "-b---d" -a "$state" != "-----d"; then
-	    return 1;
-	fi
-    done < <($CMD list -l | grep "$LIST_GREP")
-    return 0
-}
-
-# Wait for max $XENDOMAINS_STOP_MAXWAIT for $CMD $1 to finish;
-# if it has not exited by that time kill it, so the init script will
-# succeed within a finite amount of time; if $2 is nonnull, it will
-# kill the command as well as soon as no domain (except for zombies)
-# are left (used for shutdown --all). Third parameter, if any, suppresses
-# output of dots per working state (formatting issues)
-watchdog_xencmd()
-{
-    if test -z "$XENDOMAINS_STOP_MAXWAIT" -o "$XENDOMAINS_STOP_MAXWAIT" = "0"; then
-	exit
-    fi
-
-    usleep 20000
-    for no in `seq 0 $XENDOMAINS_STOP_MAXWAIT`; do
-	# exit if $CMD save/migrate/shutdown is finished
-	PSAX=`ps axlw | grep "$CMD $1" | grep -v grep`
-	if test -z "$PSAX"; then exit; fi
-	if ! test -n "$3"; then echo -n '.'; fi
-	sleep 1
-	# go to kill immediately if there's only zombies left
-	if all_zombies && test -n "$2"; then break; fi
-    done
-    sleep 1
-    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
-    fi
-    echo -n "Shutting down Xen domains:"
-    name=;id=
-    while read LN; do
-	parseln "$LN" || continue
-	if test $id = 0; then continue; fi
-	echo -n " $name"
-	if test "$XENDOMAINS_AUTO_ONLY" = "true"; then
-	    eval "
-	    case \"\$name\" in
-		($NAMES)
-		    # nothing
-		    ;;
-		(*)
-		    echo -e '(skip)'
-		    continue
-		    ;;
-	    esac
-	    "
-	fi
-	# 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
-	    for sysrq in $XENDOMAINS_SYSRQ; do
-		echo -n "(SR-$sysrq)"
-		XMR=`$CMD sysrq $id $sysrq 2>&1 1>/dev/null`
-		if test $? -ne 0; then
-		    echo -e "\nAn error occurred while doing sysrq on domain:\n$XMR\n"
-		    rc_failed $?
-		    echo -n '!'
-		fi
-		# usleep just ignores empty arg
-		usleep $XENDOMAINS_USLEEP
-	    done
-	fi
-	if test "$state" = "-b---d" -o "$state" = "-----d"; then
-	    echo -n "(zomb)"
-	    continue
-	fi
-	if test -n "$XENDOMAINS_MIGRATE"; then
-	    echo -n "(migr)"
-	    watchdog_xencmd migrate &
-	    WDOG_PID=$!
-	    XMR=`$CMD migrate $id $XENDOMAINS_MIGRATE 2>&1 1>/dev/null`
-	    if test $? -ne 0; then
-		echo -e "\nAn error occurred while migrating domain:\n$XMR\n"
-		rc_failed $?
-		echo -e '!'
-
-		kill $WDOG_PID >/dev/null 2>&1
-	    else
-		kill $WDOG_PID >/dev/null 2>&1
-		
-		echo -e .
-		usleep 1000
-		continue
-	    fi
-	fi
-	if test -n "$XENDOMAINS_SAVE"; then
-	    echo -n "(save)"
-	    watchdog_xencmd save &
-	    WDOG_PID=$!
-	    mkdir -p "$XENDOMAINS_SAVE"
-	    XMR=`$CMD save $id $XENDOMAINS_SAVE/$name 2>&1 1>/dev/null`
-	    if test $? -ne 0; then
-		echo -e "\nAn error occurred while saving domain:\n$XMR\n"
-		rc_failed $?
-		echo -e '!'
-		kill $WDOG_PID >/dev/null 2>&1
-	    else
-		kill $WDOG_PID >/dev/null 2>&1
-		echo -e .
-		usleep 1000
-		continue
-	    fi
-	fi
-	if test -n "$XENDOMAINS_SHUTDOWN"; then
-	    # XENDOMAINS_SHUTDOWN should be "--wait"
-	    echo -n "(shut)"
-	    watchdog_xencmd shutdown &
-	    WDOG_PID=$!
-	    XMR=`$CMD shutdown $XENDOMAINS_SHUTDOWN $id 2>&1 1>/dev/null`
-	    if test $? -ne 0; then
-		echo -e "\nAn error occurred while shutting down domain:\n$XMR\n"
-		rc_failed $?
-		echo -e '!'
-	    fi
-	    kill $WDOG_PID >/dev/null 2>&1
-	fi
-    done < <($CMD list -l | grep "$LIST_GREP")
-
-    # NB. this shuts down ALL Xen domains (politely), not just the ones in
-    # AUTODIR/*
-    # This is because it's easier to do ;-) but arguably if this script is run
-    # on system shutdown then it's also the right thing to do.
-    if ! all_zombies && test -n "$XENDOMAINS_SHUTDOWN_ALL"; then
-	# XENDOMAINS_SHUTDOWN_ALL should be "--all --wait"
-	echo -n " SHUTDOWN_ALL "
-	watchdog_xencmd shutdown 1 false &
-	WDOG_PID=$!
-	XMR=`$CMD shutdown $XENDOMAINS_SHUTDOWN_ALL 2>&1 1>/dev/null`
-	if test $? -ne 0; then
-	    echo -e "\nAn error occurred while shutting down all domains: $XMR\n"
-	    rc_failed $?
-	    echo -e '!'
-	fi
-	kill $WDOG_PID >/dev/null 2>&1
-    fi
-
-    # Unconditionally delete lock file
-    rm -f $LOCKFILE
-    
-    exec 2>&3
-}
-
-check_domain_up()
-{
-    name=;id=
-    while read LN; do
-	parseln "$LN" || continue
-	if test $id = 0; then continue; fi
-	case $name in 
-	    ($1)
-		return 0
-		;;
-	esac
-    done < <($CMD list -l | grep "$LIST_GREP")
-    return 1
-}
-
-check_all_auto_domains_up()
-{
-    if ! contains_something "$XENDOMAINS_AUTO"
-    then
-      return 0
-    fi
-    missing=
-    for nm in $XENDOMAINS_AUTO/*; do
-	rdname $nm
-	found=0
-	if check_domain_up "$NM"; then 
-	    echo -n " $name"
-	else 
-	    missing="$missing $NM"
-	fi
-    done
-    if test -n "$missing"; then
-	echo -n " MISS AUTO:$missing"
-	return 1
-    fi
-    return 0
-}
-
-check_all_saved_domains_up()
-{
-    if ! contains_something "$XENDOMAINS_SAVE" 
-    then
-      return 0
-    fi
-    missing=`/bin/ls $XENDOMAINS_SAVE`
-    echo -n " MISS SAVED: " $missing
-    return 1
-}
-
-# This does NOT necessarily restart all running domains: instead it
-# stops all running domains and then boots all the domains specified in
-# AUTODIR.  If other domains have been started manually then they will
-# not get restarted.
-# Commented out to avoid confusion!
-
-restart()
-{
-    stop
-    start
-}
-
-reload()
-{
-    restart
-}
-
-
 case "$1" in
     start)
-	start
-	rc_status
-	if test -f $LOCKFILE; then rc_status -v; fi
+	foo start
 	;;
 
     stop)
-	stop
-	rc_status -v
+	foo stop
 	;;
 
     restart)
-	restart
+	foo restart
 	;;
     reload)
-	reload
+	foo reload
 	;;
 
     status)
-	echo -n "Checking for xendomains:" 
-	if test ! -f $LOCKFILE; then 
-	    rc_failed 3
-	else
-	    check_all_auto_domains_up
-	    rc_status
-	    check_all_saved_domains_up
-	    rc_status
-	fi
-	rc_status -v
+	foo status -v
 	;;
 
     *)
 	echo "Usage: $0 {start|stop|restart|reload|status}"
-	rc_failed 3
-	rc_status -v
 	;;
 esac
-
-rc_exit
diff --git a/tools/hotplug/Linux/xendomains b/tools/hotplug/Linux/xendomains
new file mode 100644
index 0000000..7364522
--- /dev/null
+++ b/tools/hotplug/Linux/xendomains
@@ -0,0 +1,561 @@
+#!/bin/bash
+#
+# $libexec/xendomains
+# Start / stop domains automatically when domain 0 boots / shuts down.
+
+. /etc/xen/scripts/hotplugpath.sh
+
+CMD=${SBINDIR}/xm
+HEADCOMP="LinuxGuestRecord"
+$CMD list &> /dev/null
+if test $? -ne 0
+then
+	CMD=${SBINDIR}/xl
+	HEADCOMP="Xen saved domain"
+fi
+
+$CMD list &> /dev/null
+if test $? -ne 0
+then
+	exit 0;
+fi
+
+# 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
+fi
+
+# See docs/misc/distro_mapping.txt
+if [ -d /var/lock/subsys ]; then
+	LOCKFILE=/var/lock/subsys/xendomains
+else
+	LOCKFILE=/var/lock/xendomains
+fi
+
+if [ -d /etc/sysconfig ]; then
+	XENDOM_CONFIG=/etc/sysconfig/xendomains
+else
+	XENDOM_CONFIG=/etc/default/xendomains
+fi
+
+test -r $XENDOM_CONFIG || { echo "$XENDOM_CONFIG not existing";
+	if [ "$1" = "stop" ]; then exit 0;
+	else exit 6; fi; }
+
+. $XENDOM_CONFIG
+
+# Use the SUSE rc_ init script functions;
+# emulate them on LSB, RH and other systems
+if test -e /etc/rc.status; then
+    # SUSE rc script library
+    . /etc/rc.status
+else    
+    _cmd=$1
+    declare -a _SMSG
+    if test "${_cmd}" = "status"; then
+	_SMSG=(running dead dead unused unknown)
+	_RC_UNUSED=3
+    else
+	_SMSG=(done failed failed missed failed skipped unused failed failed)
+	_RC_UNUSED=6
+    fi
+    if test -e /etc/init.d/functions; then
+	# REDHAT
+	. /etc/init.d/functions
+	echo_rc()
+	{
+	    #echo -n "  [${_SMSG[${_RC_RV}]}] "
+	    if test ${_RC_RV} = 0; then
+		success "  [${_SMSG[${_RC_RV}]}] "
+	    else
+		failure "  [${_SMSG[${_RC_RV}]}] "
+	    fi
+	}
+    elif test -e /lib/lsb/init-functions; then
+	# LSB    
+    	. /lib/lsb/init-functions
+        if alias log_success_msg >/dev/null 2>/dev/null; then
+	  echo_rc()
+	  {
+	       echo "  [${_SMSG[${_RC_RV}]}] "
+	  }
+        else
+	  echo_rc()
+	  {
+	    if test ${_RC_RV} = 0; then
+		log_success_msg "  [${_SMSG[${_RC_RV}]}] "
+	    else
+		log_failure_msg "  [${_SMSG[${_RC_RV}]}] "
+	    fi
+	  }
+        fi
+    else    
+	# emulate it
+	echo_rc()
+	{
+	    echo "  [${_SMSG[${_RC_RV}]}] "
+	}
+    fi
+    rc_reset() { _RC_RV=0; }
+    rc_failed()
+    {
+	if test -z "$1"; then 
+	    _RC_RV=1;
+	elif test "$1" != "0"; then 
+	    _RC_RV=$1; 
+    	fi
+	return ${_RC_RV}
+    }
+    rc_check()
+    {
+	return rc_failed $?
+    }	
+    rc_status()
+    {
+	rc_failed $?
+	if test "$1" = "-r"; then _RC_RV=0; shift; fi
+	if test "$1" = "-s"; then rc_failed 5; echo_rc; rc_failed 3; shift; fi
+	if test "$1" = "-u"; then rc_failed ${_RC_UNUSED}; echo_rc; rc_failed 3; shift; fi
+	if test "$1" = "-v"; then echo_rc; shift; fi
+	if test "$1" = "-r"; then _RC_RV=0; shift; fi
+	return ${_RC_RV}
+    }
+    rc_exit() { exit ${_RC_RV}; }
+    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
+	return 1
+    }
+fi
+
+if ! which usleep >&/dev/null
+then
+  usleep()
+  {
+    if [ -n "$1" ]
+    then
+      sleep $(( $1 / 1000000 ))
+    fi
+  }
+fi
+
+# Reset status of this service
+rc_reset
+
+##
+# Returns 0 (success) if the given parameter names a directory, and that
+# directory is not empty.
+#
+contains_something()
+{
+  if [ -d "$1" ] && [ `/bin/ls $1 | wc -l` -gt 0 ]
+  then
+    return 0
+  else
+    return 1
+  fi
+}
+
+# read name from xen config file
+rdname()
+{
+    NM=$($CMD create --quiet --dryrun --defconfig "$1" |
+         sed -n 's/^.*(name \(.*\))$/\1/p;s/^.*"name": "\(.*\)",$/\1/p')
+}
+
+rdnames()
+{
+    NAMES=
+    if ! contains_something "$XENDOMAINS_AUTO"
+    then 
+	return
+    fi
+    for dom in $XENDOMAINS_AUTO/*; do
+	rdname $dom
+	if test -z $NAMES; then 
+	    NAMES=$NM; 
+	else
+	    NAMES="$NAMES|$NM"
+	fi
+    done
+}
+
+LIST_GREP='(domain\|(domid\|(name\|^    {$\|"name":\|"domid":'
+parseln()
+{
+    if [[ "$1" =~ '(domain' ]] || [[ "$1" = "{" ]]; then
+        name=;id=
+    elif [[ "$1" =~ '(name' ]]; then
+        name=$(echo $1 | sed -e 's/^.*(name \(.*\))$/\1/')
+    elif [[ "$1" =~ '(domid' ]]; then
+        id=$(echo $1 | sed -e 's/^.*(domid \(.*\))$/\1/')
+    elif [[ "$1" =~ '"name":' ]]; then
+        name=$(echo $1 | sed -e 's/^.*"name": "\(.*\)",$/\1/')
+    elif [[ "$1" =~ '"domid":' ]]; then
+        id=$(echo $1 | sed -e 's/^.*"domid": \(.*\),$/\1/')
+    fi
+
+    [ -n "$name" -a -n "$id" ] && return 0 || return 1
+}
+
+is_running()
+{
+    rdname $1
+    RC=1
+    name=;id=
+    while read LN; do
+	parseln "$LN" || continue
+	if test $id = 0; then continue; fi
+	case $name in 
+	    ($NM)
+		RC=0
+		;;
+	esac
+    done < <($CMD list -l | grep "$LIST_GREP")
+    return $RC
+}
+
+start() 
+{
+    if [ -f $LOCKFILE ]; then 
+	echo -e "xendomains already running (lockfile exists)"
+	return; 
+    fi
+
+    saved_domains=" "
+    if [ "$XENDOMAINS_RESTORE" = "true" ] &&
+       contains_something "$XENDOMAINS_SAVE"
+    then
+	mkdir -p $(dirname "$LOCKFILE")
+	touch $LOCKFILE
+	echo -n "Restoring Xen domains:"
+	saved_domains=`ls $XENDOMAINS_SAVE`
+        for dom in $XENDOMAINS_SAVE/*; do
+            if [ -f $dom ] ; then
+                HEADER=`head -c 16 $dom | head -n 1 2> /dev/null`
+                if [ "$HEADER" = "$HEADCOMP" ]; then
+                    echo -n " ${dom##*/}"
+                    XMR=`$CMD restore $dom 2>&1 1>/dev/null`
+                    #$CMD restore $dom
+                    if [ $? -ne 0 ]; then
+                        echo -e "\nAn error occurred while restoring domain ${dom##*/}:\n$XMR"
+                        rc_failed $?
+                        echo -e '!'
+                    else
+                        # mv $dom ${dom%/*}/.${dom##*/}
+                        rm $dom
+                    fi
+                fi
+            fi
+        done
+	echo -e
+    fi
+
+    if contains_something "$XENDOMAINS_AUTO"
+    then
+	touch $LOCKFILE
+	echo -n "Starting auto Xen domains:"
+	# We expect config scripts for auto starting domains to be in
+	# 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 
+	# 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 
+	# restore correctly it requires administrative attention.
+	for dom in $XENDOMAINS_AUTO/*; do
+	    echo -n " ${dom##*/}"
+	    shortdom=$(echo $dom | sed -n 's/^.*\/\(.*\)$/\1/p')
+	    echo $saved_domains | grep -w $shortdom > /dev/null
+	    if [ $? -eq 0 ] || is_running $dom; then
+		echo -n "(skip)"
+	    else
+		XMC=`$CMD create --quiet --defconfig $dom`
+		if [ $? -ne 0 ]; then
+		    echo -e "\nAn error occurred while creating domain ${dom##*/}: $XMC\n"
+		    rc_failed $?
+		    echo -e '!'
+		else
+		    usleep $XENDOMAINS_CREATE_USLEEP
+		fi
+	    fi
+	done
+    fi
+}
+
+all_zombies()
+{
+    name=;id=
+    while read LN; do
+	parseln "$LN" || continue
+	if test $id = 0; then continue; fi
+	if test "$state" != "-b---d" -a "$state" != "-----d"; then
+	    return 1;
+	fi
+    done < <($CMD list -l | grep "$LIST_GREP")
+    return 0
+}
+
+# Wait for max $XENDOMAINS_STOP_MAXWAIT for $CMD $1 to finish;
+# if it has not exited by that time kill it, so the init script will
+# succeed within a finite amount of time; if $2 is nonnull, it will
+# kill the command as well as soon as no domain (except for zombies)
+# are left (used for shutdown --all). Third parameter, if any, suppresses
+# output of dots per working state (formatting issues)
+watchdog_xencmd()
+{
+    if test -z "$XENDOMAINS_STOP_MAXWAIT" -o "$XENDOMAINS_STOP_MAXWAIT" = "0"; then
+	exit
+    fi
+
+    usleep 20000
+    for no in `seq 0 $XENDOMAINS_STOP_MAXWAIT`; do
+	# exit if $CMD save/migrate/shutdown is finished
+	PSAX=`ps axlw | grep "$CMD $1" | grep -v grep`
+	if test -z "$PSAX"; then exit; fi
+	if ! test -n "$3"; then echo -n '.'; fi
+	sleep 1
+	# go to kill immediately if there's only zombies left
+	if all_zombies && test -n "$2"; then break; fi
+    done
+    sleep 1
+    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
+    fi
+    echo -n "Shutting down Xen domains:"
+    name=;id=
+    while read LN; do
+	parseln "$LN" || continue
+	if test $id = 0; then continue; fi
+	echo -n " $name"
+	if test "$XENDOMAINS_AUTO_ONLY" = "true"; then
+	    eval "
+	    case \"\$name\" in
+		($NAMES)
+		    # nothing
+		    ;;
+		(*)
+		    echo -e '(skip)'
+		    continue
+		    ;;
+	    esac
+	    "
+	fi
+	# 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
+	    for sysrq in $XENDOMAINS_SYSRQ; do
+		echo -n "(SR-$sysrq)"
+		XMR=`$CMD sysrq $id $sysrq 2>&1 1>/dev/null`
+		if test $? -ne 0; then
+		    echo -e "\nAn error occurred while doing sysrq on domain:\n$XMR\n"
+		    rc_failed $?
+		    echo -n '!'
+		fi
+		# usleep just ignores empty arg
+		usleep $XENDOMAINS_USLEEP
+	    done
+	fi
+	if test "$state" = "-b---d" -o "$state" = "-----d"; then
+	    echo -n "(zomb)"
+	    continue
+	fi
+	if test -n "$XENDOMAINS_MIGRATE"; then
+	    echo -n "(migr)"
+	    watchdog_xencmd migrate &
+	    WDOG_PID=$!
+	    XMR=`$CMD migrate $id $XENDOMAINS_MIGRATE 2>&1 1>/dev/null`
+	    if test $? -ne 0; then
+		echo -e "\nAn error occurred while migrating domain:\n$XMR\n"
+		rc_failed $?
+		echo -e '!'
+
+		kill $WDOG_PID >/dev/null 2>&1
+	    else
+		kill $WDOG_PID >/dev/null 2>&1
+		
+		echo -e .
+		usleep 1000
+		continue
+	    fi
+	fi
+	if test -n "$XENDOMAINS_SAVE"; then
+	    echo -n "(save)"
+	    watchdog_xencmd save &
+	    WDOG_PID=$!
+	    mkdir -p "$XENDOMAINS_SAVE"
+	    XMR=`$CMD save $id $XENDOMAINS_SAVE/$name 2>&1 1>/dev/null`
+	    if test $? -ne 0; then
+		echo -e "\nAn error occurred while saving domain:\n$XMR\n"
+		rc_failed $?
+		echo -e '!'
+		kill $WDOG_PID >/dev/null 2>&1
+	    else
+		kill $WDOG_PID >/dev/null 2>&1
+		echo -e .
+		usleep 1000
+		continue
+	    fi
+	fi
+	if test -n "$XENDOMAINS_SHUTDOWN"; then
+	    # XENDOMAINS_SHUTDOWN should be "--wait"
+	    echo -n "(shut)"
+	    watchdog_xencmd shutdown &
+	    WDOG_PID=$!
+	    XMR=`$CMD shutdown $XENDOMAINS_SHUTDOWN $id 2>&1 1>/dev/null`
+	    if test $? -ne 0; then
+		echo -e "\nAn error occurred while shutting down domain:\n$XMR\n"
+		rc_failed $?
+		echo -e '!'
+	    fi
+	    kill $WDOG_PID >/dev/null 2>&1
+	fi
+    done < <($CMD list -l | grep "$LIST_GREP")
+
+    # NB. this shuts down ALL Xen domains (politely), not just the ones in
+    # AUTODIR/*
+    # This is because it's easier to do ;-) but arguably if this script is run
+    # on system shutdown then it's also the right thing to do.
+    if ! all_zombies && test -n "$XENDOMAINS_SHUTDOWN_ALL"; then
+	# XENDOMAINS_SHUTDOWN_ALL should be "--all --wait"
+	echo -n " SHUTDOWN_ALL "
+	watchdog_xencmd shutdown 1 false &
+	WDOG_PID=$!
+	XMR=`$CMD shutdown $XENDOMAINS_SHUTDOWN_ALL 2>&1 1>/dev/null`
+	if test $? -ne 0; then
+	    echo -e "\nAn error occurred while shutting down all domains: $XMR\n"
+	    rc_failed $?
+	    echo -e '!'
+	fi
+	kill $WDOG_PID >/dev/null 2>&1
+    fi
+
+    # Unconditionally delete lock file
+    rm -f $LOCKFILE
+    
+    exec 2>&3
+}
+
+check_domain_up()
+{
+    name=;id=
+    while read LN; do
+	parseln "$LN" || continue
+	if test $id = 0; then continue; fi
+	case $name in 
+	    ($1)
+		return 0
+		;;
+	esac
+    done < <($CMD list -l | grep "$LIST_GREP")
+    return 1
+}
+
+check_all_auto_domains_up()
+{
+    if ! contains_something "$XENDOMAINS_AUTO"
+    then
+      return 0
+    fi
+    missing=
+    for nm in $XENDOMAINS_AUTO/*; do
+	rdname $nm
+	found=0
+	if check_domain_up "$NM"; then 
+	    echo -n " $name"
+	else 
+	    missing="$missing $NM"
+	fi
+    done
+    if test -n "$missing"; then
+	echo -n " MISS AUTO:$missing"
+	return 1
+    fi
+    return 0
+}
+
+check_all_saved_domains_up()
+{
+    if ! contains_something "$XENDOMAINS_SAVE" 
+    then
+      return 0
+    fi
+    missing=`/bin/ls $XENDOMAINS_SAVE`
+    echo -n " MISS SAVED: " $missing
+    return 1
+}
+
+# This does NOT necessarily restart all running domains: instead it
+# stops all running domains and then boots all the domains specified in
+# AUTODIR.  If other domains have been started manually then they will
+# not get restarted.
+# Commented out to avoid confusion!
+
+restart()
+{
+    stop
+    start
+}
+
+reload()
+{
+    restart
+}
+
+
+case "$1" in
+    start)
+	start
+	rc_status
+	if test -f $LOCKFILE; then rc_status -v; fi
+	;;
+
+    stop)
+	stop
+	rc_status -v
+	;;
+
+    restart)
+	restart
+	;;
+    reload)
+	reload
+	;;
+
+    status)
+	echo -n "Checking for xendomains:" 
+	if test ! -f $LOCKFILE; then 
+	    rc_failed 3
+	else
+	    check_all_auto_domains_up
+	    rc_status
+	    check_all_saved_domains_up
+	    rc_status
+	fi
+	rc_status -v
+	;;
+
+    *)
+	echo "Usage: $0 {start|stop|restart|reload|status}"
+	rc_failed 3
+	rc_status -v
+	;;
+esac
+
+rc_exit



_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* Re: [PATCH v2 7/7] systemd: add support initial xen systemd service files
  2014-03-22  2:26     ` Luis R. Rodriguez
@ 2014-03-24 10:11       ` Ian Campbell
  2014-03-24 16:36         ` Luis R. Rodriguez
  2014-04-28  5:12         ` Luis R. Rodriguez
  0 siblings, 2 replies; 37+ messages in thread
From: Ian Campbell @ 2014-03-24 10:11 UTC (permalink / raw)
  To: Luis R. Rodriguez
  Cc: Stefano Stabellini, Jan Rękorajski, Ian Jackson,
	Jacek Konieczny, M A Young, xen-devel, Luis R. Rodriguez

On Sat, 2014-03-22 at 03:26 +0100, Luis R. Rodriguez wrote:
> On Fri, Mar 21, 2014 at 10:08:14AM +0000, Ian Campbell wrote:
> > On Wed, 2014-03-19 at 13:58 -0700, Luis R. Rodriguez wrote:
> > > [...]
> > > diff --git a/tools/hotplug/Linux/systemd/oxenstored.service.in b/tools/hotplug/Linux/systemd/oxenstored.service.in
> > > [...]
> > > +ExecStartPost=-@BINDIR@/xenstore-write "/local/domain/0/name" "Domain-0"
> > > diff --git a/tools/hotplug/Linux/systemd/xenstored.service.in b/tools/hotplug/Linux/systemd/xenstored.service.in
> > [...]
> > > +ExecStartPost=@BINDIR@/xenstore-write "/local/domain/0/name" "Domain-0"
> > 
> > I accidentally deleted the subthread about writing domid here too, but I
> > was wondering if it might be better to have a common xenstore service
> > which depends on oxenstore.service || cxenstore.service and then does
> > this kind of common implementation agnostic setup in one place where it
> > can't get out of sync easily?
> 
> That's what I was hoping for to achieve with the socket file but that
> seems to not work as expected, even if you claim the socket explicitly
> as part of both oxenstored and xenstored. To me this could likely be
> an enhancement to systemd but not sure.
> 
> systemd does not allow one to use || as part of the language for requirements,

Does it not have some sort of "Provides: some-virtual-facility" which
two things can provide and other things can depend on?

> This means we either do some sort of meta @VARIABLE@ substitution or a common
> init routine which will do the or checking for us. The only problem with this
> is systemd will treat the Forking type service ExecStart as the process to care
> for, and if we add a wrapper that'd be dead. I haven't tried to implement one
> but I think this could confuse systemd or administrators.

Yes, lets not go that route.

Ian.

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH v2 7/7] systemd: add support initial xen systemd service files
  2014-03-24 10:11       ` Ian Campbell
@ 2014-03-24 16:36         ` Luis R. Rodriguez
  2014-04-28  5:12         ` Luis R. Rodriguez
  1 sibling, 0 replies; 37+ messages in thread
From: Luis R. Rodriguez @ 2014-03-24 16:36 UTC (permalink / raw)
  To: Ian Campbell
  Cc: Stefano Stabellini, Jan Rękorajski, Ian Jackson,
	Jacek Konieczny, M A Young, xen-devel, Luis R. Rodriguez


[-- Attachment #1.1: Type: text/plain, Size: 2636 bytes --]

On Mon, Mar 24, 2014 at 10:11:13AM +0000, Ian Campbell wrote:
> On Sat, 2014-03-22 at 03:26 +0100, Luis R. Rodriguez wrote:
> > On Fri, Mar 21, 2014 at 10:08:14AM +0000, Ian Campbell wrote:
> > > On Wed, 2014-03-19 at 13:58 -0700, Luis R. Rodriguez wrote:
> > > > [...]
> > > > diff --git a/tools/hotplug/Linux/systemd/oxenstored.service.in b/tools/hotplug/Linux/systemd/oxenstored.service.in
> > > > [...]
> > > > +ExecStartPost=-@BINDIR@/xenstore-write "/local/domain/0/name" "Domain-0"
> > > > diff --git a/tools/hotplug/Linux/systemd/xenstored.service.in b/tools/hotplug/Linux/systemd/xenstored.service.in
> > > [...]
> > > > +ExecStartPost=@BINDIR@/xenstore-write "/local/domain/0/name" "Domain-0"
> > > 
> > > I accidentally deleted the subthread about writing domid here too, but I
> > > was wondering if it might be better to have a common xenstore service
> > > which depends on oxenstore.service || cxenstore.service and then does
> > > this kind of common implementation agnostic setup in one place where it
> > > can't get out of sync easily?
> > 
> > That's what I was hoping for to achieve with the socket file but that
> > seems to not work as expected, even if you claim the socket explicitly
> > as part of both oxenstored and xenstored. To me this could likely be
> > an enhancement to systemd but not sure.
> > 
> > systemd does not allow one to use || as part of the language for requirements,
> 
> Does it not have some sort of "Provides: some-virtual-facility" which
> two things can provide and other things can depend on?

Not that I have seen.

> > This means we either do some sort of meta @VARIABLE@ substitution or a common
> > init routine which will do the or checking for us. The only problem with this
> > is systemd will treat the Forking type service ExecStart as the process to care
> > for, and if we add a wrapper that'd be dead. I haven't tried to implement one
> > but I think this could confuse systemd or administrators.
> 
> Yes, lets not go that route.

I studied this approach a bit more and it turns out that execve() does just what
we want, it will carry the same PID for the spawned process, it won't return, it'll
just go onto the other process, if it fails it returns back, in which case we can
try the other cxenstored. We'd just have to rename the C xentstored to censtored.
This would simplify things for both init systems and systemd. In the init system
the check for oxenstored can be removed, in systemd we'd just have one systemd 
service file.

In light of this I'd like for us to consider this approach now.

Thoughts?

  Luis

[-- Attachment #1.2: Type: application/pgp-signature, Size: 835 bytes --]

[-- Attachment #2: Type: text/plain, Size: 126 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH v2 6/7] tools/xendomains: move to sbin and use init helper
  2014-03-24 10:09       ` Ian Campbell
@ 2014-04-28  5:11         ` Luis R. Rodriguez
  2014-04-28  9:15           ` Ian Campbell
  0 siblings, 1 reply; 37+ messages in thread
From: Luis R. Rodriguez @ 2014-04-28  5:11 UTC (permalink / raw)
  To: Ian Campbell
  Cc: Stefano Stabellini, Jan Rękorajski, Ian Jackson,
	Jacek Konieczny, M A Young, xen-devel, Luis R. Rodriguez

On Mon, Mar 24, 2014 at 10:09:55AM +0000, Ian Campbell wrote:
> On Sat, 2014-03-22 at 03:17 +0100, Luis R. Rodriguez wrote:
> > What I mean by keeping the history is you can do git log --follow on the
> > script after the move.
> 
> The history is never lost. If git was actually losing history there
> would be uproar, and the structure of the repo prevents it anyway.
> 
> I skanked up an example commit (see below) and git comes up with:
>  2 files changed, 54 insertions(+), 610 deletions(-)
>  rewrite tools/hotplug/Linux/init.d/xendomains (91%)
>  rename tools/hotplug/Linux/{init.d => }/xendomains (93%)
> and "git log --follow tools/hotplug/Linux/xendomains" works exactly as I
> expected, so I think things are fine.

Did you try git format-patch -M on that? I now see what you see but I don't
see git format-patch respecting the rename detection, either way we'll know
it will be so I'll just submit it, just to be clear on the submission
that I just move the code, its not a magical rewrite.

  Luis

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH v2 7/7] systemd: add support initial xen systemd service files
  2014-03-24 10:11       ` Ian Campbell
  2014-03-24 16:36         ` Luis R. Rodriguez
@ 2014-04-28  5:12         ` Luis R. Rodriguez
  1 sibling, 0 replies; 37+ messages in thread
From: Luis R. Rodriguez @ 2014-04-28  5:12 UTC (permalink / raw)
  To: Ian Campbell
  Cc: Stefano Stabellini, Jan Rękorajski, Ian Jackson,
	Jacek Konieczny, M A Young, xen-devel, Luis R. Rodriguez

On Mon, Mar 24, 2014 at 10:11:13AM +0000, Ian Campbell wrote:
> On Sat, 2014-03-22 at 03:26 +0100, Luis R. Rodriguez wrote:
> > On Fri, Mar 21, 2014 at 10:08:14AM +0000, Ian Campbell wrote:
> > > On Wed, 2014-03-19 at 13:58 -0700, Luis R. Rodriguez wrote:
> > > > [...]
> > > > diff --git a/tools/hotplug/Linux/systemd/oxenstored.service.in b/tools/hotplug/Linux/systemd/oxenstored.service.in
> > > > [...]
> > > > +ExecStartPost=-@BINDIR@/xenstore-write "/local/domain/0/name" "Domain-0"
> > > > diff --git a/tools/hotplug/Linux/systemd/xenstored.service.in b/tools/hotplug/Linux/systemd/xenstored.service.in
> > > [...]
> > > > +ExecStartPost=@BINDIR@/xenstore-write "/local/domain/0/name" "Domain-0"
> > > 
> > > I accidentally deleted the subthread about writing domid here too, but I
> > > was wondering if it might be better to have a common xenstore service
> > > which depends on oxenstore.service || cxenstore.service and then does
> > > this kind of common implementation agnostic setup in one place where it
> > > can't get out of sync easily?
> > 
> > That's what I was hoping for to achieve with the socket file but that
> > seems to not work as expected, even if you claim the socket explicitly
> > as part of both oxenstored and xenstored. To me this could likely be
> > an enhancement to systemd but not sure.
> > 
> > systemd does not allow one to use || as part of the language for requirements,
> 
> Does it not have some sort of "Provides: some-virtual-facility" which
> two things can provide and other things can depend on?
> 
> > This means we either do some sort of meta @VARIABLE@ substitution or a common
> > init routine which will do the or checking for us. The only problem with this
> > is systemd will treat the Forking type service ExecStart as the process to care
> > for, and if we add a wrapper that'd be dead. I haven't tried to implement one
> > but I think this could confuse systemd or administrators.
> 
> Yes, lets not go that route.

I found one, the trick is to use a target file. I'll do a new submission with
quite a bit of changes.

  Luis

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH v2 6/7] tools/xendomains: move to sbin and use init helper
  2014-04-28  5:11         ` Luis R. Rodriguez
@ 2014-04-28  9:15           ` Ian Campbell
  2014-04-28 10:47             ` Luis R. Rodriguez
  0 siblings, 1 reply; 37+ messages in thread
From: Ian Campbell @ 2014-04-28  9:15 UTC (permalink / raw)
  To: Luis R. Rodriguez
  Cc: Stefano Stabellini, Jan Rękorajski, Ian Jackson,
	Jacek Konieczny, M A Young, xen-devel, Luis R. Rodriguez

On Mon, 2014-04-28 at 07:11 +0200, Luis R. Rodriguez wrote:
> On Mon, Mar 24, 2014 at 10:09:55AM +0000, Ian Campbell wrote:
> > On Sat, 2014-03-22 at 03:17 +0100, Luis R. Rodriguez wrote:
> > > What I mean by keeping the history is you can do git log --follow on the
> > > script after the move.
> > 
> > The history is never lost. If git was actually losing history there
> > would be uproar, and the structure of the repo prevents it anyway.
> > 
> > I skanked up an example commit (see below) and git comes up with:
> >  2 files changed, 54 insertions(+), 610 deletions(-)
> >  rewrite tools/hotplug/Linux/init.d/xendomains (91%)
> >  rename tools/hotplug/Linux/{init.d => }/xendomains (93%)
> > and "git log --follow tools/hotplug/Linux/xendomains" works exactly as I
> > expected, so I think things are fine.
> 
> Did you try git format-patch -M on that? I now see what you see but I don't
> see git format-patch respecting the rename detection, either way we'll know
> it will be so I'll just submit it, just to be clear on the submission
> that I just move the code, its not a magical rewrite.

I can't remember what I did above, probably git show -M. I thought git
send-email/format-patch obeyed the same option just fine though.

Ian.

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH v2 6/7] tools/xendomains: move to sbin and use init helper
  2014-04-28  9:15           ` Ian Campbell
@ 2014-04-28 10:47             ` Luis R. Rodriguez
  0 siblings, 0 replies; 37+ messages in thread
From: Luis R. Rodriguez @ 2014-04-28 10:47 UTC (permalink / raw)
  To: Ian Campbell
  Cc: Stefano Stabellini, Jan Rękorajski, Ian Jackson,
	Jacek Konieczny, M A Young, xen-devel

On Mon, Apr 28, 2014 at 2:15 AM, Ian Campbell <Ian.Campbell@citrix.com> wrote:
> On Mon, 2014-04-28 at 07:11 +0200, Luis R. Rodriguez wrote:
>> On Mon, Mar 24, 2014 at 10:09:55AM +0000, Ian Campbell wrote:
>> > On Sat, 2014-03-22 at 03:17 +0100, Luis R. Rodriguez wrote:
>> > > What I mean by keeping the history is you can do git log --follow on the
>> > > script after the move.
>> >
>> > The history is never lost. If git was actually losing history there
>> > would be uproar, and the structure of the repo prevents it anyway.
>> >
>> > I skanked up an example commit (see below) and git comes up with:
>> >  2 files changed, 54 insertions(+), 610 deletions(-)
>> >  rewrite tools/hotplug/Linux/init.d/xendomains (91%)
>> >  rename tools/hotplug/Linux/{init.d => }/xendomains (93%)
>> > and "git log --follow tools/hotplug/Linux/xendomains" works exactly as I
>> > expected, so I think things are fine.
>>
>> Did you try git format-patch -M on that? I now see what you see but I don't
>> see git format-patch respecting the rename detection, either way we'll know
>> it will be so I'll just submit it, just to be clear on the submission
>> that I just move the code, its not a magical rewrite.
>
> I can't remember what I did above, probably git show -M. I thought git
> send-email/format-patch obeyed the same option just fine though.

Ditto, I think you may have pasted the output of the commit. Either
way I take it you see now what I see. Either way, at least internally
it seems git knows what's up. For review this can be an inconvenience
though. We'll have to try to fix this upstream on git if its a bug.

  Luis

^ permalink raw reply	[flat|nested] 37+ messages in thread

end of thread, other threads:[~2014-04-28 10:47 UTC | newest]

Thread overview: 37+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-19 20:58 [PATCH v2 0/7] xen: add systemd files Luis R. Rodriguez
2014-03-19 20:58 ` [PATCH v2 1/7] xenstore-read: add support for a retry open limit on xenstored Luis R. Rodriguez
2014-03-21 15:21   ` Ian Campbell
2014-03-21 15:22     ` Ian Jackson
2014-03-22  1:36       ` Luis R. Rodriguez
2014-03-22  1:33     ` Luis R. Rodriguez
2014-03-24  9:57       ` Ian Campbell
2014-03-21 15:40   ` David Vrabel
2014-03-21 16:01     ` Ian Campbell
2014-03-22  1:43       ` Luis R. Rodriguez
2014-03-24 10:01         ` Ian Campbell
2014-03-22  1:41     ` Luis R. Rodriguez
2014-03-19 20:58 ` [PATCH v2 2/7] xencommons: use the retry limit instead of implementing our own timeout Luis R. Rodriguez
2014-03-21 15:24   ` Ian Campbell
2014-03-19 20:58 ` [PATCH v2 3/7] tools/xendomains: make xl the default Luis R. Rodriguez
2014-03-21 15:26   ` Ian Campbell
2014-03-19 20:58 ` [PATCH v2 4/7] tools/xendomains: remove old redhat check Luis R. Rodriguez
2014-03-21 15:28   ` Ian Campbell
2014-03-22  1:56     ` Luis R. Rodriguez
2014-03-19 20:58 ` [PATCH v2 5/7] tools/xendomains: do space cleanups Luis R. Rodriguez
2014-03-21 15:29   ` Ian Campbell
2014-03-19 20:58 ` [PATCH v2 6/7] tools/xendomains: move to sbin and use init helper Luis R. Rodriguez
2014-03-19 22:03   ` Olaf Hering
2014-03-22  2:00     ` Luis R. Rodriguez
2014-03-21 15:34   ` Ian Campbell
2014-03-22  2:17     ` Luis R. Rodriguez
2014-03-24 10:09       ` Ian Campbell
2014-04-28  5:11         ` Luis R. Rodriguez
2014-04-28  9:15           ` Ian Campbell
2014-04-28 10:47             ` Luis R. Rodriguez
2014-03-19 20:58 ` [PATCH v2 7/7] systemd: add support initial xen systemd service files Luis R. Rodriguez
2014-03-19 21:05   ` Luis R. Rodriguez
2014-03-21 10:08   ` Ian Campbell
2014-03-22  2:26     ` Luis R. Rodriguez
2014-03-24 10:11       ` Ian Campbell
2014-03-24 16:36         ` Luis R. Rodriguez
2014-04-28  5:12         ` Luis R. Rodriguez

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.