Skip to contentSkip to conversation

init script v2

PATCH In review Stefano Stabellini 3 participants 5 messages Jun 7, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 init script v2

Hi all,
second version of the init scripts for xl: now the init script is called xencommons and, as the name suggests, it is a common script between xl and xend because it is used to start xenconsoled, xenstored and xenbackendd and the initialization of these three daemons has been removed from xend.
The global xen_toolstack=xl/xend variable has been removed. Regarding the network setup, I made the vif scripts follow the same pattern as the other scripts in xen-backend: a new script called vif-setup is executed unconditionally. vif-setup is going to do the right thing depending on the value of the environmental variable "script" (same technique used before), defaulting to vif-bridge.
In the common scenario the toolstack doesn't need to set the variable "script" because vif-bridge is going to be called anyway.
There is no global network script to setup the network bridges with xl, so if you are using xl without xend, you need to manually configure the bridges using your distro network setup, or, if you are lazy, you can just add something like:

/etc/xen/scripts/network-bridge start

to your rc.local.

---

tools/hotplug/Linux/Makefile +6 -2
diff -r c514d69c71d8 tools/hotplug/Linux/Makefile
@@ -3,15 +3,18 @@
 
 # Init scripts.
 XEND_INITD = init.d/xend
-XEND_SYSCONFIG = init.d/sysconfig.xend
 XENDOMAINS_INITD = init.d/xendomains
 XENDOMAINS_SYSCONFIG = init.d/sysconfig.xendomains
 
+XENCOMMONS_INITD = init.d/xencommons
+XENCOMMONS_SYSCONFIG = init.d/sysconfig.xencommons
+
 # Xen script dir and scripts to go there.
 XEN_SCRIPTS = network-bridge vif-bridge
 XEN_SCRIPTS += network-route vif-route
 XEN_SCRIPTS += network-nat vif-nat
 XEN_SCRIPTS += vif2
+XEN_SCRIPTS += vif-setup
 XEN_SCRIPTS += block
 XEN_SCRIPTS += block-enbd block-nbd
 XEN_SCRIPTS += blktap
@@ -64,9 +67,10 @@
 	[ -d $(DESTDIR)$(CONFIG_DIR)/init.d ] || $(INSTALL_DIR) $(DESTDIR)$(CONFIG_DIR)/init.d
 	[ -d $(DESTDIR)$(CONFIG_DIR)/sysconfig ] || $(INSTALL_DIR) $(DESTDIR)$(CONFIG_DIR)/sysconfig
 	$(INSTALL_PROG) $(XEND_INITD) $(DESTDIR)$(CONFIG_DIR)/init.d
-	$(INSTALL_PROG) $(XEND_SYSCONFIG) $(DESTDIR)$(CONFIG_DIR)/sysconfig/xend
 	$(INSTALL_PROG) $(XENDOMAINS_INITD) $(DESTDIR)$(CONFIG_DIR)/init.d
 	$(INSTALL_PROG) $(XENDOMAINS_SYSCONFIG) $(DESTDIR)$(CONFIG_DIR)/sysconfig/xendomains
+	$(INSTALL_PROG) $(XENCOMMONS_INITD) $(DESTDIR)$(CONFIG_DIR)/init.d
+	$(INSTALL_PROG) $(XENCOMMONS_SYSCONFIG) $(DESTDIR)$(CONFIG_DIR)/sysconfig/xencommons
 
 .PHONY: install-scripts
 install-scripts:
tools/hotplug/Linux/init.d/sysconfig.xencommons new file +11 -0
diff -r c514d69c71d8 tools/hotplug/Linux/init.d/sysconfig.xencommons
@@ -0,0 +1,11 @@
+# Log xenconsoled messages (cf xl dmesg)
+#XENCONSOLED_TRACE=[none|guest|hv|all]
+
+# Log xenstored messages
+#XENSTORED_TRACE=[yes|on|1]
+
+# Running xenstored on XENSTORED_ROOTDIR
+#XENSTORED_ROOTDIR=/var/lib/xenstored
+
+# Running xenbackendd in debug mode
+#XENBACKENDD_DEBUG=[yes|on|1]
tools/hotplug/Linux/init.d/sysconfig.xend deleted +0 -11
diff -r c514d69c71d8 tools/hotplug/Linux/init.d/sysconfig.xend
@@ -1,11 +0,0 @@
-# Log xenconsoled messages (cf xm dmesg)
-#XENCONSOLED_TRACE=[none|guest|hv|all]
-
-# Log xenstored messages
-#XENSTORED_TRACE=[yes|on|1]
-
-# Running xenstored on XENSTORED_ROOTDIR
-#XENSTORED_ROOTDIR=/var/lib/xenstored
-
-# Running xenbackendd in debug mode
-#XENBACKENDD_DEBUG=[yes|on|1]
tools/hotplug/Linux/init.d/xencommons new file +87 -0

87 lines not on this page · raw message

tools/hotplug/Linux/init.d/xend +0 -18
diff -r c514d69c71d8 tools/hotplug/Linux/init.d/xend
@@ -20,20 +20,6 @@
 ### END INIT INFO
 
 shopt -s extglob
-test -f /etc/sysconfig/xend && . /etc/sysconfig/xend
-
-if   test "x$1" = xstart && \
-     test -d /proc/xen && \
-   ! test -d /proc/xen/capabilities && \
-     grep '	xenfs$' /proc/filesystems >/dev/null && \
-   ! grep '^xenfs ' /proc/mounts >/dev/null;
-then
-	mount -t xenfs xenfs /proc/xen
-fi
-
-if ! grep -qs "control_d" /proc/xen/capabilities ; then
-	exit 0
-fi
 
 # Wait for Xend to be up
 function await_daemons_up
@@ -53,10 +39,6 @@
   start)
 	mkdir -p /var/lock/subsys
 	touch /var/lock/subsys/xend
-	test -z "$XENSTORED_ROOTDIR" || export XENSTORED_ROOTDIR
-	test -z "$XENCONSOLED_TRACE" || export XENCONSOLED_TRACE
-	[[ "$XENSTORED_TRACE" == @(yes|on|1) ]] && export XENSTORED_TRACE
-	[[ "$XENBACKENDD_DEBUG" == @(yes|on|1) ]] && export XENBACKENDD_DEBUG
 	xend start
 	await_daemons_up
 	;;
tools/hotplug/Linux/init.d/xendomains +5 -0
diff -r c514d69c71d8 tools/hotplug/Linux/init.d/xendomains
@@ -28,6 +28,11 @@
 #                    boots / shuts down.
 ### END INIT INFO
 
+if ! `xm list &> /dev/null`
+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
tools/hotplug/Linux/vif-setup new file +9 -0
diff -r c514d69c71d8 tools/hotplug/Linux/vif-setup
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+if test "$script"
+then
+    exec "$script" $*
+else
+    exec /etc/xen/scripts/vif-bridge $*
+fi
+
tools/hotplug/Linux/xen-backend.rules +2 -2
diff -r c514d69c71d8 tools/hotplug/Linux/xen-backend.rules
@@ -2,8 +2,8 @@
 SUBSYSTEM=="xen-backend", KERNEL=="vbd*", RUN+="/etc/xen/scripts/block $env{ACTION}"
 SUBSYSTEM=="xen-backend", KERNEL=="vtpm*", RUN+="/etc/xen/scripts/vtpm $env{ACTION}"
 SUBSYSTEM=="xen-backend", KERNEL=="vif2-*", RUN+="/etc/xen/scripts/vif2 $env{ACTION}"
-SUBSYSTEM=="xen-backend", KERNEL=="vif-*", ACTION=="online", RUN+="$env{script} online"
-SUBSYSTEM=="xen-backend", KERNEL=="vif-*", ACTION=="offline", RUN+="$env{script} offline"
+SUBSYSTEM=="xen-backend", KERNEL=="vif-*", ACTION=="online", RUN+="/etc/xen/scripts/vif-setup online"
+SUBSYSTEM=="xen-backend", KERNEL=="vif-*", ACTION=="offline", RUN+="/etc/xen/scripts/vif-setup offline"
 SUBSYSTEM=="xen-backend", KERNEL=="vscsi*", RUN+="/etc/xen/scripts/vscsi $env{ACTION}"
 SUBSYSTEM=="xen-backend", ACTION=="remove", RUN+="/etc/xen/scripts/xen-hotplug-cleanup"
 KERNEL=="evtchn", NAME="xen/%k"
tools/libxl/libxl.h +12 -0
diff -r c514d69c71d8 tools/libxl/libxl.h
@@ -538,5 +538,17 @@
                    uint32_t set);
 int libxl_tmem_shared_auth(struct libxl_ctx *ctx, uint32_t domid, char* uuid,
                            int auth);
+
+/* common paths */
+const char *libxl_sbindir_path(void);
+const char *libxl_bindir_path(void);
+const char *libxl_libexec_path(void);
+const char *libxl_libdir_path(void);
+const char *libxl_sharedir_path(void);
+const char *libxl_private_bindir_path(void);
+const char *libxl_xenfirmwaredir_path(void);
+const char *libxl_xen_config_dir_path(void);
+const char *libxl_xen_script_dir_path(void);
+
 #endif /* LIBXL_H */
 
tools/libxl/libxl_internal.h +0 -11
diff -r c514d69c71d8 tools/libxl/libxl_internal.h
@@ -215,17 +215,6 @@
 
 char *libxl_abs_path(struct libxl_ctx *ctx, char *s, const char *path);
 
-/* libxl_paths.c */
-const char *libxl_sbindir_path(void);
-const char *libxl_bindir_path(void);
-const char *libxl_libexec_path(void);
-const char *libxl_libdir_path(void);
-const char *libxl_sharedir_path(void);
-const char *libxl_private_bindir_path(void);
-const char *libxl_xenfirmwaredir_path(void);
-const char *libxl_xen_config_dir_path(void);
-const char *libxl_xen_script_dir_path(void);
-
 #define XL_LOG_DEBUG   XTL_DEBUG
 #define XL_LOG_INFO    XTL_INFO
 #define XL_LOG_WARNING XTL_WARN
tools/libxl/xl_cmdimpl.c +21 -19
diff -r c514d69c71d8 tools/libxl/xl_cmdimpl.c
@@ -42,6 +42,25 @@
 
 #define UUID_FMT "%02hhx%02hhx%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx"
 
+#define CHK_ERRNO( call ) ({                                            \
+        int chk_errno = (call);                                         \
+        if (chk_errno < 0) {                                                \
+            fprintf(stderr,"xl: fatal error: %s:%d: %s: %s\n",          \
+                    __FILE__,__LINE__, strerror(chk_errno), #call);     \
+            exit(-ERROR_FAIL);                                          \
+        }                                                               \
+    })
+
+#define MUST( call ) ({                                                 \
+        int must_rc = (call);                                           \
+        if (must_rc < 0) {                                                  \
+            fprintf(stderr,"xl: fatal error: %s:%d, rc=%d: %s\n",       \
+                    __FILE__,__LINE__, must_rc, #call);                 \
+            exit(-must_rc);                                             \
+        }                                                               \
+    })
+
+
 int logfile = 2;
 
 /* every libxl action in xl uses this same libxl context */
@@ -240,7 +259,8 @@
     nic_info->mac[5] = 1 + (int) (0xff * (rand() / (RAND_MAX + 1.0)));
     nic_info->ifname = NULL;
     nic_info->bridge = "xenbr0";
-    nic_info->script = "/etc/xen/scripts/vif-bridge";
+    CHK_ERRNO( asprintf(&nic_info->script, "%s/vif-bridge",
+               libxl_xen_script_dir_path()) );
     nic_info->nictype = NICTYPE_IOEMU;
 }
 
@@ -791,24 +811,6 @@
     xlu_cfg_destroy(config);
 }
 
-#define CHK_ERRNO( call ) ({                                            \
-        int chk_errno = (call);                                         \
-        if (chk_errno) {                                                \
-            fprintf(stderr,"xl: fatal error: %s:%d: %s: %s\n",          \
-                    __FILE__,__LINE__, strerror(chk_errno), #call);     \
-            exit(-ERROR_FAIL);                                          \
-        }                                                               \
-    })
-
-#define MUST( call ) ({                                                 \
-        int must_rc = (call);                                           \
-        if (must_rc) {                                                  \
-            fprintf(stderr,"xl: fatal error: %s:%d, rc=%d: %s\n",       \
-                    __FILE__,__LINE__, must_rc, #call);                 \
-            exit(-must_rc);                                             \
-        }                                                               \
-    })
-
 static void *xmalloc(size_t sz) {
     void *r;
     r = malloc(sz);
tools/misc/xend +0 -48

72 lines not on this page · raw message

#1 lore raw

I pulled the latest tip (from staging) and I get this error in compiling tools :
../../../tools/cross-install -m0755 -p init.d/xencommons //etc/init.d
install: cannot stat `init.d/xencommons': No such file or directory make[5]: *** [install-initd] Error 1

I can't find xencommons in the repo. Is this patch applied correctly ?

-dulloor

Quoted 450 lines · Stefano Stabellini

Hi all,
second version of the init scripts for xl: now the init script is called xencommons and, as the name suggests, it is a common script between xl and xend because it is used to start xenconsoled, xenstored and xenbackendd and the initialization of these three daemons has been removed from xend.
The global xen_toolstack=xl/xend variable has been removed. Regarding the network setup, I made the vif scripts follow the same pattern as the other scripts in xen-backend: a new script called vif-setup is executed unconditionally. vif-setup is going to do the right thing depending on the value of the environmental variable "script" (same technique used before), defaulting to vif-bridge.
In the common scenario the toolstack doesn't need to set the variable "script" because vif-bridge is going to be called anyway.
There is no global network script to setup the network bridges with xl, so if you are using xl without xend, you need to manually configure the bridges using your distro network setup, or, if you are lazy, you can just add something like:

/etc/xen/scripts/network-bridge start

to your rc.local.

---

diff -r c514d69c71d8 tools/hotplug/Linux/Makefile

tools/hotplug/Linux/Makefile      Mon Jun 07 12:46:52 2010 +0100 renamed from tools/hotplug/Linux/Makefile      Fri Jun 04 11:39:06 2010 +0100 +0 -0
@@ -3,15 +3,18 @@
 
  # Init scripts.

 XEND_INITD = init.d/xend
-XEND_SYSCONFIG = init.d/sysconfig.xend XENDOMAINS_INITD = init.d/xendomains XENDOMAINS_SYSCONFIG = init.d/sysconfig.xendomains

tools/hotplug/Linux/Makefile      Mon Jun 07 12:46:52 2010 +0100 renamed from tools/hotplug/Linux/Makefile      Fri Jun 04 11:39:06 2010 +0100 +3 -0
+XENCOMMONS_INITD = init.d/xencommons
+XENCOMMONS_SYSCONFIG = init.d/sysconfig.xencommons
+

 # Xen script dir and scripts to go there.
 XEN_SCRIPTS = network-bridge vif-bridge
 XEN_SCRIPTS += network-route vif-route
 XEN_SCRIPTS += network-nat vif-nat
 XEN_SCRIPTS += vif2
+XEN_SCRIPTS += vif-setup
 XEN_SCRIPTS += block
 XEN_SCRIPTS += block-enbd block-nbd
 XEN_SCRIPTS += blktap

tools/hotplug/Linux/Makefile      Mon Jun 07 12:46:52 2010 +0100 renamed from tools/hotplug/Linux/Makefile      Fri Jun 04 11:39:06 2010 +0100 +0 -0
@@ -64,9 +67,10 @@

       [ -d $(DESTDIR)$(CONFIG_DIR)/init.d ] || $(INSTALL_DIR) $(DESTDIR)$(CONFIG_DIR)/init.d [ -d $(DESTDIR)$(CONFIG_DIR)/sysconfig ] || $(INSTALL_DIR) $(DESTDIR)$(CONFIG_DIR)/sysconfig $(INSTALL_PROG) $(XEND_INITD) $(DESTDIR)$(CONFIG_DIR)/init.d
-       $(INSTALL_PROG) $(XEND_SYSCONFIG) $(DESTDIR)$(CONFIG_DIR)/sysconfig/xend $(INSTALL_PROG) $(XENDOMAINS_INITD) $(DESTDIR)$(CONFIG_DIR)/init.d $(INSTALL_PROG) $(XENDOMAINS_SYSCONFIG) $(DESTDIR)$(CONFIG_DIR)/sysconfig/xendomains
+       $(INSTALL_PROG) $(XENCOMMONS_INITD) $(DESTDIR)$(CONFIG_DIR)/init.d
+       $(INSTALL_PROG) $(XENCOMMONS_SYSCONFIG) $(DESTDIR)$(CONFIG_DIR)/sysconfig/xencommons

 .PHONY: install-scripts
 install-scripts:
diff -r c514d69c71d8 tools/hotplug/Linux/init.d/sysconfig.xencommons

tools/hotplug/Linux/init.d/sysconfig.xencommons   Mon Jun 07 12:46:52 2010 +0100 renamed from dev/null   Thu Jan 01 00:00:00 1970 +0000 +11 -0
@@ -0,0 +1,11 @@
+# Log xenconsoled messages (cf xl dmesg)
+#XENCONSOLED_TRACE=[none|guest|hv|all]
+
+# Log xenstored messages
+#XENSTORED_TRACE=[yes|on|1]
+
+# Running xenstored on XENSTORED_ROOTDIR
+#XENSTORED_ROOTDIR=/var/lib/xenstored
+
+# Running xenbackendd in debug mode
+#XENBACKENDD_DEBUG=[yes|on|1]

diff -r c514d69c71d8 tools/hotplug/Linux/init.d/sysconfig.xend

dev/null   Thu Jan 01 00:00:00 1970 +0000 renamed from tools/hotplug/Linux/init.d/sysconfig.xend Fri Jun 04 11:39:06 2010 +0100 +0 -11
@@ -1,11 +0,0 @@
-# Log xenconsoled messages (cf xm dmesg)
-#XENCONSOLED_TRACE=[none|guest|hv|all]
-
-# Log xenstored messages
-#XENSTORED_TRACE=[yes|on|1]
-
-# Running xenstored on XENSTORED_ROOTDIR
-#XENSTORED_ROOTDIR=/var/lib/xenstored
-
-# Running xenbackendd in debug mode
-#XENBACKENDD_DEBUG=[yes|on|1]

diff -r c514d69c71d8 tools/hotplug/Linux/init.d/xencommons

tools/hotplug/Linux/init.d/xencommons     Mon Jun 07 12:46:52 2010 +0100 renamed from dev/null   Thu Jan 01 00:00:00 1970 +0000 +87 -0
@@ -0,0 +1,87 @@
+#!/bin/bash
+#
+# xencommons    Script to start and stop xenstored and xenconsoled
+#
+# Author:       Ian Jackson <[email protected]>
+#
+# chkconfig: 2345
+# description: Starts and stops xenstored and xenconsoled
+### BEGIN INIT INFO
+# Provides:          xenstored xenconsoled
+# Required-Start:    $syslog $remote_fs
+# Should-Start:
+# Required-Stop:     $syslog $remote_fs
+# Should-Stop:
+# Default-Start:     3 4 5
+# Default-Stop:      1
+# Default-Enabled:   yes
+# Short-Description: Start/stop xenstored and xenconsoled
+# Description:       Starts and stops the daemons neeeded for xl/xend
+### END INIT INFO
+
+test -f /etc/sysconfig/xencommons && . /etc/sysconfig/xencommons
+
+XENCONSOLED_PIDFILE=/var/run/xenconsoled.pid
+shopt -s extglob
+
+if test "x$1" = xstart && \
+     test -d /proc/xen && \
+   ! test -d /proc/xen/capabilities && \
+     grep '    xenfs$' /proc/filesystems >/dev/null && \
+   ! grep '^xenfs ' /proc/mounts >/dev/null;
+then
+       mount -t xenfs xenfs /proc/xen
+fi
+
+if ! grep -q "control_d" /proc/xen/capabilities ; then
+       exit 0
+fi
+
+do_start () {
+       if ! `xenstore-read -s / >/dev/null 2>&1`
+       then
+               test -z "$XENSTORED_ROOTDIR" || XENSTORED_ROOTDIR="/var/lib/xenstored"
+               rm -f "$XENSTORED_ROOTDIR"/tdb* &>/dev/null
+               test -z "$XENSTORED_TRACE" || XENSTORED_ARGS=" -T /var/log/xen/xenstored-trace.log"
+               xenstored --pid-file=/var/run/xenstore.pid $XENSTORED_ARGS
+               xenstore-write "/local/domain/0/name" "Domain-0"
+       fi
+
+       test -z "$XENCONSOLED_TRACE" || XENCONSOLED_ARGS=" -T /var/log/xen/xenstored-trace.log"
+       xenconsoled --pid-file=$XENCONSOLED_PIDFILE $XENCONSOLED_ARGS
+       test -z "$XENBACKENDD_DEBUG" || XENBACKENDD_ARGS="-d"
+       test "`uname`" != "NetBSD" || xenbackendd $XENBACKENDD_ARGS
+}
+do_stop () {
+       if read 2>/dev/null <$XENCONSOLED_PIDFILE pid; then
+               kill $pid
+               while kill -9 $pid >/dev/null 2>&1; do sleep 0.1; done
+               rm -f $XENCONSOLED_PIDFILE
+       fi
+}
+
+case "$1" in
+  start)
+       do_start
+       ;;
+  status)
+        xenstore-read -s /
+       ;;
+  stop)
+       do_stop
+       ;;
+  reload)
+       echo >&2 'Reload not available; use force-reload'; exit 1
+       ;;
+  force-reload|restart)
+        do_stop
+       do_start
+       ;;
+  *)
+       # do not advertise unreasonable commands that there is no reason
+       # to use with this device
+       echo $"Usage: $0 {start|stop|status|restart|force-reload}"
+       exit 1
+esac
+
+exit $?

diff -r c514d69c71d8 tools/hotplug/Linux/init.d/xend

tools/hotplug/Linux/init.d/xend   Mon Jun 07 12:46:52 2010 +0100 renamed from tools/hotplug/Linux/init.d/xend   Fri Jun 04 11:39:06 2010 +0100 +0 -0
@@ -20,20 +20,6 @@
  ### END INIT INFO
 

 shopt -s extglob

tools/hotplug/Linux/init.d/xend   Mon Jun 07 12:46:52 2010 +0100 renamed from tools/hotplug/Linux/init.d/xend   Fri Jun 04 11:39:06 2010 +0100 +0 -14
-test -f /etc/sysconfig/xend && . /etc/sysconfig/xend
-
-if   test "x$1" = xstart && \
-     test -d /proc/xen && \
-   ! test -d /proc/xen/capabilities && \
-     grep '    xenfs$' /proc/filesystems >/dev/null && \
-   ! grep '^xenfs ' /proc/mounts >/dev/null;
-then
-       mount -t xenfs xenfs /proc/xen
-fi
-
-if ! grep -qs "control_d" /proc/xen/capabilities ; then
-       exit 0
-fi

 # Wait for Xend to be up
 function await_daemons_up

tools/hotplug/Linux/init.d/xend   Mon Jun 07 12:46:52 2010 +0100 renamed from tools/hotplug/Linux/init.d/xend   Fri Jun 04 11:39:06 2010 +0100 +0 -0
@@ -53,10 +39,6 @@
   start)

       mkdir -p /var/lock/subsys
       touch /var/lock/subsys/xend

-       test -z "$XENSTORED_ROOTDIR" || export XENSTORED_ROOTDIR
-       test -z "$XENCONSOLED_TRACE" || export XENCONSOLED_TRACE
-       [[ "$XENSTORED_TRACE" == @(yes|on|1) ]] && export XENSTORED_TRACE

-       [[ "$XENBACKENDD_DEBUG" == @(yes|on|1) ]] && export XENBACKENDD_DEBUG xend start
       await_daemons_up
       ;;
diff -r c514d69c71d8 tools/hotplug/Linux/init.d/xendomains

tools/hotplug/Linux/init.d/xendomains     Mon Jun 07 12:46:52 2010 +0100 renamed from tools/hotplug/Linux/init.d/xendomains     Fri Jun 04 11:39:06 2010 +0100 +5 -0
@@ -28,6 +28,11 @@
  #                    boots / shuts down.
  ### END INIT INFO
 
+if ! `xm list &> /dev/null`
+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
diff -r c514d69c71d8 tools/hotplug/Linux/vif-setup

tools/hotplug/Linux/vif-setup     Mon Jun 07 12:46:52 2010 +0100 renamed from dev/null   Thu Jan 01 00:00:00 1970 +0000 +9 -0
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+if test "$script"
+then
+    exec "$script" $*
+else
+    exec /etc/xen/scripts/vif-bridge $*
+fi
+

diff -r c514d69c71d8 tools/hotplug/Linux/xen-backend.rules

tools/hotplug/Linux/xen-backend.rules     Mon Jun 07 12:46:52 2010 +0100 renamed from tools/hotplug/Linux/xen-backend.rules     Fri Jun 04 11:39:06 2010 +0100 +0 -0
@@ -2,8 +2,8 @@

 SUBSYSTEM=="xen-backend", KERNEL=="vbd*", RUN+="/etc/xen/scripts/block $env{ACTION}" SUBSYSTEM=="xen-backend", KERNEL=="vtpm*", RUN+="/etc/xen/scripts/vtpm $env{ACTION}" SUBSYSTEM=="xen-backend", KERNEL=="vif2-*", RUN+="/etc/xen/scripts/vif2 $env{ACTION}"

tools/hotplug/Linux/xen-backend.rules     Mon Jun 07 12:46:52 2010 +0100 renamed from tools/hotplug/Linux/xen-backend.rules     Fri Jun 04 11:39:06 2010 +0100 +2 -2
-SUBSYSTEM=="xen-backend", KERNEL=="vif-*", ACTION=="online", RUN+="$env{script} online"
-SUBSYSTEM=="xen-backend", KERNEL=="vif-*", ACTION=="offline", RUN+="$env{script} offline"
+SUBSYSTEM=="xen-backend", KERNEL=="vif-*", ACTION=="online", RUN+="/etc/xen/scripts/vif-setup online"
+SUBSYSTEM=="xen-backend", KERNEL=="vif-*", ACTION=="offline", RUN+="/etc/xen/scripts/vif-setup offline"

 SUBSYSTEM=="xen-backend", KERNEL=="vscsi*", RUN+="/etc/xen/scripts/vscsi $env{ACTION}" SUBSYSTEM=="xen-backend", ACTION=="remove", RUN+="/etc/xen/scripts/xen-hotplug-cleanup" KERNEL=="evtchn", NAME="xen/%k"
diff -r c514d69c71d8 tools/libxl/libxl.h

tools/libxl/libxl.h       Mon Jun 07 12:46:52 2010 +0100 renamed from tools/libxl/libxl.h       Fri Jun 04 11:39:06 2010 +0100 +12 -0
@@ -538,5 +538,17 @@
                    uint32_t set);
  int libxl_tmem_shared_auth(struct libxl_ctx *ctx, uint32_t domid, char* uuid,
                            int auth);
+
+/* common paths */
+const char *libxl_sbindir_path(void);
+const char *libxl_bindir_path(void);
+const char *libxl_libexec_path(void);
+const char *libxl_libdir_path(void);
+const char *libxl_sharedir_path(void);
+const char *libxl_private_bindir_path(void);
+const char *libxl_xenfirmwaredir_path(void);
+const char *libxl_xen_config_dir_path(void);
+const char *libxl_xen_script_dir_path(void);
+
  #endif /* LIBXL_H */
 

diff -r c514d69c71d8 tools/libxl/libxl_internal.h

tools/libxl/libxl_internal.h      Mon Jun 07 12:46:52 2010 +0100 renamed from tools/libxl/libxl_internal.h      Fri Jun 04 11:39:06 2010 +0100 +0 -11
@@ -215,17 +215,6 @@
 
  char *libxl_abs_path(struct libxl_ctx *ctx, char *s, const char *path);
 
-/* libxl_paths.c */
-const char *libxl_sbindir_path(void);
-const char *libxl_bindir_path(void);
-const char *libxl_libexec_path(void);
-const char *libxl_libdir_path(void);
-const char *libxl_sharedir_path(void);
-const char *libxl_private_bindir_path(void);
-const char *libxl_xenfirmwaredir_path(void);
-const char *libxl_xen_config_dir_path(void);
-const char *libxl_xen_script_dir_path(void);
-
  #define XL_LOG_DEBUG   XTL_DEBUG
  #define XL_LOG_INFO    XTL_INFO
  #define XL_LOG_WARNING XTL_WARN

diff -r c514d69c71d8 tools/libxl/xl_cmdimpl.c

tools/libxl/xl_cmdimpl.c  Mon Jun 07 12:46:52 2010 +0100 renamed from tools/libxl/xl_cmdimpl.c  Fri Jun 04 11:39:06 2010 +0100 +21 -19
@@ -42,6 +42,25 @@
 
  #define UUID_FMT "%02hhx%02hhx%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx"
 
+#define CHK_ERRNO( call ) ({                                            \
+        int chk_errno = (call);                                         \
+        if (chk_errno < 0) {                                                \
+            fprintf(stderr,"xl: fatal error: %s:%d: %s: %s\n",          \
+                    __FILE__,__LINE__, strerror(chk_errno), #call);     \
+            exit(-ERROR_FAIL);                                          \
+        }                                                               \
+    })
+
+#define MUST( call ) ({                                                 \
+        int must_rc = (call);                                           \
+        if (must_rc < 0) {                                                  \
+            fprintf(stderr,"xl: fatal error: %s:%d, rc=%d: %s\n",       \
+                    __FILE__,__LINE__, must_rc, #call);                 \
+            exit(-must_rc);                                             \
+        }                                                               \
+    })
+
+
  int logfile = 2;
 
  /* every libxl action in xl uses this same libxl context */
@@ -240,7 +259,8 @@
     nic_info->mac[5] = 1 + (int) (0xff * (rand() / (RAND_MAX + 1.0)));
     nic_info->ifname = NULL;
     nic_info->bridge = "xenbr0";
-    nic_info->script = "/etc/xen/scripts/vif-bridge";
+    CHK_ERRNO( asprintf(&nic_info->script, "%s/vif-bridge",
+               libxl_xen_script_dir_path()) );
     nic_info->nictype = NICTYPE_IOEMU;
  }
 
@@ -791,24 +811,6 @@
     xlu_cfg_destroy(config);
  }
 
-#define CHK_ERRNO( call ) ({                                            \
-        int chk_errno = (call);                                         \
-        if (chk_errno) {                                                \
-            fprintf(stderr,"xl: fatal error: %s:%d: %s: %s\n",          \
-                    __FILE__,__LINE__, strerror(chk_errno), #call);     \
-            exit(-ERROR_FAIL);                                          \
-        }                                                               \
-    })
-
-#define MUST( call ) ({                                                 \
-        int must_rc = (call);                                           \
-        if (must_rc) {                                                  \
-            fprintf(stderr,"xl: fatal error: %s:%d, rc=%d: %s\n",       \
-                    __FILE__,__LINE__, must_rc, #call);                 \
-            exit(-must_rc);                                             \
-        }                                                               \
-    })
-
  static void *xmalloc(size_t sz) {
     void *r;
     r = malloc(sz);

diff -r c514d69c71d8 tools/misc/xend

tools/misc/xend   Mon Jun 07 12:46:52 2010 +0100 renamed from tools/misc/xend   Fri Jun 04 11:39:06 2010 +0100 +0 -0
@@ -73,48 +73,9 @@

    if os.fork() == 0:
        os.execvp(daemon, (daemon,) + args)

tools/misc/xend   Mon Jun 07 12:46:52 2010 +0100 renamed from tools/misc/xend   Fri Jun 04 11:39:06 2010 +0100 +0 -31
-def start_xenstored():
-    pidfname = "/var/run/xenstore.pid"
-    try:
-        f = open(pidfname, "a")
-        try:
-            fcntl.lockf(f, fcntl.LOCK_EX | fcntl.LOCK_NB)
-            rootdir = os.getenv("XENSTORED_ROOTDIR") or "/var/lib/xenstored"
-            for i in glob.glob(rootdir + "/tdb*"):
-                try:
-                    os.unlink(i)
-                except:
-                    pass
-            os.unlink(pidfname)
-        except:
-            pass
-        f.close()
-    except:
-        pass
-    XENSTORED_TRACE = os.getenv("XENSTORED_TRACE")
-    cmd = "xenstored --pid-file /var/run/xenstore.pid"
-    if XENSTORED_TRACE:
-        cmd += " -T /var/log/xen/xenstored-trace.log"
-    s,o = commands.getstatusoutput(cmd)
-
-def start_consoled():
-    XENCONSOLED_TRACE = os.getenv("XENCONSOLED_TRACE")
-    args = ""
-    if XENCONSOLED_TRACE:
-        args += "--log=" + XENCONSOLED_TRACE
-    start_daemon("xenconsoled", args)
-

 def start_blktapctrl():
    start_daemon("blktapctrl", "")

tools/misc/xend   Mon Jun 07 12:46:52 2010 +0100 renamed from tools/misc/xend   Fri Jun 04 11:39:06 2010 +0100 +0 -8
-def start_xenbackendd():
-    XENBACKENDD_DEBUG = os.getenv("XENBACKENDD_DEBUG")
-    args = ""
-    if XENBACKENDD_DEBUG:
-        args += "-d"
-    if os.uname()[0] == 'NetBSD':
-        start_daemon("xenbackendd", args)
-

 def main():
    try:
        check_logging()

tools/misc/xend   Mon Jun 07 12:46:52 2010 +0100 renamed from tools/misc/xend   Fri Jun 04 11:39:06 2010 +0100 +0 -0
@@ -127,15 +88,9 @@

        print 'usage: %s {start|stop|reload|restart}' % sys.argv[0] elif sys.argv[1] == 'start':
        if os.uname()[0] != "SunOS":
-            start_xenstored()
-            start_consoled()
-            start_xenbackendd()
            start_blktapctrl()
        return daemon.start()
    elif sys.argv[1] == 'trace_start':
-        start_xenstored()
-        start_consoled()
-        start_xenbackendd()
        start_blktapctrl()
        return daemon.start(trace=1)
    elif sys.argv[1] == 'stop':

tools/misc/xend   Mon Jun 07 12:46:52 2010 +0100 renamed from tools/misc/xend   Fri Jun 04 11:39:06 2010 +0100 +0 -0
@@ -143,9 +98,6 @@

    elif sys.argv[1] == 'reload':
        return daemon.reloadConfig()
    elif sys.argv[1] == 'restart':
-        start_xenstored()
-        start_consoled()
-        start_xenbackendd()
        start_blktapctrl()
        return daemon.stop() or daemon.start()
    elif sys.argv[1] == 'status':

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

#2 lore raw

Looks like the changeset 21549 is incomplete.

-dulloor

Quoted 462 lines · Dulloor

I pulled the latest tip (from staging) and I get this error in compiling tools :
../../../tools/cross-install -m0755 -p init.d/xencommons //etc/init.d
install: cannot stat `init.d/xencommons': No such file or directory make[5]: *** [install-initd] Error 1

I can't find xencommons in the repo. Is this patch applied correctly ?

-dulloor

Quoted 450 lines · Stefano Stabellini

Hi all,
second version of the init scripts for xl: now the init script is called xencommons and, as the name suggests, it is a common script between xl and xend because it is used to start xenconsoled, xenstored and xenbackendd and the initialization of these three daemons has been removed from xend.
The global xen_toolstack=xl/xend variable has been removed. Regarding the network setup, I made the vif scripts follow the same pattern as the other scripts in xen-backend: a new script called vif-setup is executed unconditionally. vif-setup is going to do the right thing depending on the value of the environmental variable "script" (same technique used before), defaulting to vif-bridge.
In the common scenario the toolstack doesn't need to set the variable "script" because vif-bridge is going to be called anyway.
There is no global network script to setup the network bridges with xl, so if you are using xl without xend, you need to manually configure the bridges using your distro network setup, or, if you are lazy, you can just add something like:

/etc/xen/scripts/network-bridge start

to your rc.local.

---

diff -r c514d69c71d8 tools/hotplug/Linux/Makefile

tools/hotplug/Linux/Makefile      Mon Jun 07 12:46:52 2010 +0100 renamed from tools/hotplug/Linux/Makefile      Fri Jun 04 11:39:06 2010 +0100 +0 -0
@@ -3,15 +3,18 @@
 
  # Init scripts.

 XEND_INITD = init.d/xend
-XEND_SYSCONFIG = init.d/sysconfig.xend XENDOMAINS_INITD = init.d/xendomains XENDOMAINS_SYSCONFIG = init.d/sysconfig.xendomains

tools/hotplug/Linux/Makefile      Mon Jun 07 12:46:52 2010 +0100 renamed from tools/hotplug/Linux/Makefile      Fri Jun 04 11:39:06 2010 +0100 +3 -0
+XENCOMMONS_INITD = init.d/xencommons
+XENCOMMONS_SYSCONFIG = init.d/sysconfig.xencommons
+

 # Xen script dir and scripts to go there.
 XEN_SCRIPTS = network-bridge vif-bridge
 XEN_SCRIPTS += network-route vif-route
 XEN_SCRIPTS += network-nat vif-nat
 XEN_SCRIPTS += vif2
+XEN_SCRIPTS += vif-setup
 XEN_SCRIPTS += block
 XEN_SCRIPTS += block-enbd block-nbd
 XEN_SCRIPTS += blktap

tools/hotplug/Linux/Makefile      Mon Jun 07 12:46:52 2010 +0100 renamed from tools/hotplug/Linux/Makefile      Fri Jun 04 11:39:06 2010 +0100 +0 -0
@@ -64,9 +67,10 @@

       [ -d $(DESTDIR)$(CONFIG_DIR)/init.d ] || $(INSTALL_DIR) $(DESTDIR)$(CONFIG_DIR)/init.d [ -d $(DESTDIR)$(CONFIG_DIR)/sysconfig ] || $(INSTALL_DIR) $(DESTDIR)$(CONFIG_DIR)/sysconfig $(INSTALL_PROG) $(XEND_INITD) $(DESTDIR)$(CONFIG_DIR)/init.d
-       $(INSTALL_PROG) $(XEND_SYSCONFIG) $(DESTDIR)$(CONFIG_DIR)/sysconfig/xend $(INSTALL_PROG) $(XENDOMAINS_INITD) $(DESTDIR)$(CONFIG_DIR)/init.d $(INSTALL_PROG) $(XENDOMAINS_SYSCONFIG) $(DESTDIR)$(CONFIG_DIR)/sysconfig/xendomains
+       $(INSTALL_PROG) $(XENCOMMONS_INITD) $(DESTDIR)$(CONFIG_DIR)/init.d
+       $(INSTALL_PROG) $(XENCOMMONS_SYSCONFIG) $(DESTDIR)$(CONFIG_DIR)/sysconfig/xencommons

 .PHONY: install-scripts
 install-scripts:
diff -r c514d69c71d8 tools/hotplug/Linux/init.d/sysconfig.xencommons

tools/hotplug/Linux/init.d/sysconfig.xencommons   Mon Jun 07 12:46:52 2010 +0100 renamed from dev/null   Thu Jan 01 00:00:00 1970 +0000 +11 -0
@@ -0,0 +1,11 @@
+# Log xenconsoled messages (cf xl dmesg)
+#XENCONSOLED_TRACE=[none|guest|hv|all]
+
+# Log xenstored messages
+#XENSTORED_TRACE=[yes|on|1]
+
+# Running xenstored on XENSTORED_ROOTDIR
+#XENSTORED_ROOTDIR=/var/lib/xenstored
+
+# Running xenbackendd in debug mode
+#XENBACKENDD_DEBUG=[yes|on|1]

diff -r c514d69c71d8 tools/hotplug/Linux/init.d/sysconfig.xend

dev/null   Thu Jan 01 00:00:00 1970 +0000 renamed from tools/hotplug/Linux/init.d/sysconfig.xend Fri Jun 04 11:39:06 2010 +0100 +0 -11
@@ -1,11 +0,0 @@
-# Log xenconsoled messages (cf xm dmesg)
-#XENCONSOLED_TRACE=[none|guest|hv|all]
-
-# Log xenstored messages
-#XENSTORED_TRACE=[yes|on|1]
-
-# Running xenstored on XENSTORED_ROOTDIR
-#XENSTORED_ROOTDIR=/var/lib/xenstored
-
-# Running xenbackendd in debug mode
-#XENBACKENDD_DEBUG=[yes|on|1]

diff -r c514d69c71d8 tools/hotplug/Linux/init.d/xencommons

tools/hotplug/Linux/init.d/xencommons     Mon Jun 07 12:46:52 2010 +0100 renamed from dev/null   Thu Jan 01 00:00:00 1970 +0000 +87 -0
@@ -0,0 +1,87 @@
+#!/bin/bash
+#
+# xencommons    Script to start and stop xenstored and xenconsoled
+#
+# Author:       Ian Jackson <[email protected]>
+#
+# chkconfig: 2345
+# description: Starts and stops xenstored and xenconsoled
+### BEGIN INIT INFO
+# Provides:          xenstored xenconsoled
+# Required-Start:    $syslog $remote_fs
+# Should-Start:
+# Required-Stop:     $syslog $remote_fs
+# Should-Stop:
+# Default-Start:     3 4 5
+# Default-Stop:      1
+# Default-Enabled:   yes
+# Short-Description: Start/stop xenstored and xenconsoled
+# Description:       Starts and stops the daemons neeeded for xl/xend
+### END INIT INFO
+
+test -f /etc/sysconfig/xencommons && . /etc/sysconfig/xencommons
+
+XENCONSOLED_PIDFILE=/var/run/xenconsoled.pid
+shopt -s extglob
+
+if test "x$1" = xstart && \
+     test -d /proc/xen && \
+   ! test -d /proc/xen/capabilities && \
+     grep '    xenfs$' /proc/filesystems >/dev/null && \
+   ! grep '^xenfs ' /proc/mounts >/dev/null;
+then
+       mount -t xenfs xenfs /proc/xen
+fi
+
+if ! grep -q "control_d" /proc/xen/capabilities ; then
+       exit 0
+fi
+
+do_start () {
+       if ! `xenstore-read -s / >/dev/null 2>&1`
+       then
+               test -z "$XENSTORED_ROOTDIR" || XENSTORED_ROOTDIR="/var/lib/xenstored"
+               rm -f "$XENSTORED_ROOTDIR"/tdb* &>/dev/null
+               test -z "$XENSTORED_TRACE" || XENSTORED_ARGS=" -T /var/log/xen/xenstored-trace.log"
+               xenstored --pid-file=/var/run/xenstore.pid $XENSTORED_ARGS
+               xenstore-write "/local/domain/0/name" "Domain-0"
+       fi
+
+       test -z "$XENCONSOLED_TRACE" || XENCONSOLED_ARGS=" -T /var/log/xen/xenstored-trace.log"
+       xenconsoled --pid-file=$XENCONSOLED_PIDFILE $XENCONSOLED_ARGS
+       test -z "$XENBACKENDD_DEBUG" || XENBACKENDD_ARGS="-d"
+       test "`uname`" != "NetBSD" || xenbackendd $XENBACKENDD_ARGS
+}
+do_stop () {
+       if read 2>/dev/null <$XENCONSOLED_PIDFILE pid; then
+               kill $pid
+               while kill -9 $pid >/dev/null 2>&1; do sleep 0.1; done
+               rm -f $XENCONSOLED_PIDFILE
+       fi
+}
+
+case "$1" in
+  start)
+       do_start
+       ;;
+  status)
+        xenstore-read -s /
+       ;;
+  stop)
+       do_stop
+       ;;
+  reload)
+       echo >&2 'Reload not available; use force-reload'; exit 1
+       ;;
+  force-reload|restart)
+        do_stop
+       do_start
+       ;;
+  *)
+       # do not advertise unreasonable commands that there is no reason
+       # to use with this device
+       echo $"Usage: $0 {start|stop|status|restart|force-reload}"
+       exit 1
+esac
+
+exit $?

diff -r c514d69c71d8 tools/hotplug/Linux/init.d/xend

tools/hotplug/Linux/init.d/xend   Mon Jun 07 12:46:52 2010 +0100 renamed from tools/hotplug/Linux/init.d/xend   Fri Jun 04 11:39:06 2010 +0100 +0 -0
@@ -20,20 +20,6 @@
  ### END INIT INFO
 

 shopt -s extglob

tools/hotplug/Linux/init.d/xend   Mon Jun 07 12:46:52 2010 +0100 renamed from tools/hotplug/Linux/init.d/xend   Fri Jun 04 11:39:06 2010 +0100 +0 -14
-test -f /etc/sysconfig/xend && . /etc/sysconfig/xend
-
-if   test "x$1" = xstart && \
-     test -d /proc/xen && \
-   ! test -d /proc/xen/capabilities && \
-     grep '    xenfs$' /proc/filesystems >/dev/null && \
-   ! grep '^xenfs ' /proc/mounts >/dev/null;
-then
-       mount -t xenfs xenfs /proc/xen
-fi
-
-if ! grep -qs "control_d" /proc/xen/capabilities ; then
-       exit 0
-fi

 # Wait for Xend to be up
 function await_daemons_up

tools/hotplug/Linux/init.d/xend   Mon Jun 07 12:46:52 2010 +0100 renamed from tools/hotplug/Linux/init.d/xend   Fri Jun 04 11:39:06 2010 +0100 +0 -0
@@ -53,10 +39,6 @@
   start)

       mkdir -p /var/lock/subsys
       touch /var/lock/subsys/xend

-       test -z "$XENSTORED_ROOTDIR" || export XENSTORED_ROOTDIR
-       test -z "$XENCONSOLED_TRACE" || export XENCONSOLED_TRACE
-       [[ "$XENSTORED_TRACE" == @(yes|on|1) ]] && export XENSTORED_TRACE

-       [[ "$XENBACKENDD_DEBUG" == @(yes|on|1) ]] && export XENBACKENDD_DEBUG xend start
       await_daemons_up
       ;;
diff -r c514d69c71d8 tools/hotplug/Linux/init.d/xendomains

tools/hotplug/Linux/init.d/xendomains     Mon Jun 07 12:46:52 2010 +0100 renamed from tools/hotplug/Linux/init.d/xendomains     Fri Jun 04 11:39:06 2010 +0100 +5 -0
@@ -28,6 +28,11 @@
  #                    boots / shuts down.
  ### END INIT INFO
 
+if ! `xm list &> /dev/null`
+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
diff -r c514d69c71d8 tools/hotplug/Linux/vif-setup

tools/hotplug/Linux/vif-setup     Mon Jun 07 12:46:52 2010 +0100 renamed from dev/null   Thu Jan 01 00:00:00 1970 +0000 +9 -0
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+if test "$script"
+then
+    exec "$script" $*
+else
+    exec /etc/xen/scripts/vif-bridge $*
+fi
+

diff -r c514d69c71d8 tools/hotplug/Linux/xen-backend.rules

tools/hotplug/Linux/xen-backend.rules     Mon Jun 07 12:46:52 2010 +0100 renamed from tools/hotplug/Linux/xen-backend.rules     Fri Jun 04 11:39:06 2010 +0100 +0 -0
@@ -2,8 +2,8 @@

 SUBSYSTEM=="xen-backend", KERNEL=="vbd*", RUN+="/etc/xen/scripts/block $env{ACTION}" SUBSYSTEM=="xen-backend", KERNEL=="vtpm*", RUN+="/etc/xen/scripts/vtpm $env{ACTION}" SUBSYSTEM=="xen-backend", KERNEL=="vif2-*", RUN+="/etc/xen/scripts/vif2 $env{ACTION}"

tools/hotplug/Linux/xen-backend.rules     Mon Jun 07 12:46:52 2010 +0100 renamed from tools/hotplug/Linux/xen-backend.rules     Fri Jun 04 11:39:06 2010 +0100 +2 -2
-SUBSYSTEM=="xen-backend", KERNEL=="vif-*", ACTION=="online", RUN+="$env{script} online"
-SUBSYSTEM=="xen-backend", KERNEL=="vif-*", ACTION=="offline", RUN+="$env{script} offline"
+SUBSYSTEM=="xen-backend", KERNEL=="vif-*", ACTION=="online", RUN+="/etc/xen/scripts/vif-setup online"
+SUBSYSTEM=="xen-backend", KERNEL=="vif-*", ACTION=="offline", RUN+="/etc/xen/scripts/vif-setup offline"

 SUBSYSTEM=="xen-backend", KERNEL=="vscsi*", RUN+="/etc/xen/scripts/vscsi $env{ACTION}" SUBSYSTEM=="xen-backend", ACTION=="remove", RUN+="/etc/xen/scripts/xen-hotplug-cleanup" KERNEL=="evtchn", NAME="xen/%k"
diff -r c514d69c71d8 tools/libxl/libxl.h

tools/libxl/libxl.h       Mon Jun 07 12:46:52 2010 +0100 renamed from tools/libxl/libxl.h       Fri Jun 04 11:39:06 2010 +0100 +12 -0
@@ -538,5 +538,17 @@
                    uint32_t set);
  int libxl_tmem_shared_auth(struct libxl_ctx *ctx, uint32_t domid, char* uuid,
                            int auth);
+
+/* common paths */
+const char *libxl_sbindir_path(void);
+const char *libxl_bindir_path(void);
+const char *libxl_libexec_path(void);
+const char *libxl_libdir_path(void);
+const char *libxl_sharedir_path(void);
+const char *libxl_private_bindir_path(void);
+const char *libxl_xenfirmwaredir_path(void);
+const char *libxl_xen_config_dir_path(void);
+const char *libxl_xen_script_dir_path(void);
+
  #endif /* LIBXL_H */
 

diff -r c514d69c71d8 tools/libxl/libxl_internal.h

tools/libxl/libxl_internal.h      Mon Jun 07 12:46:52 2010 +0100 renamed from tools/libxl/libxl_internal.h      Fri Jun 04 11:39:06 2010 +0100 +0 -11
@@ -215,17 +215,6 @@
 
  char *libxl_abs_path(struct libxl_ctx *ctx, char *s, const char *path);
 
-/* libxl_paths.c */
-const char *libxl_sbindir_path(void);
-const char *libxl_bindir_path(void);
-const char *libxl_libexec_path(void);
-const char *libxl_libdir_path(void);
-const char *libxl_sharedir_path(void);
-const char *libxl_private_bindir_path(void);
-const char *libxl_xenfirmwaredir_path(void);
-const char *libxl_xen_config_dir_path(void);
-const char *libxl_xen_script_dir_path(void);
-
  #define XL_LOG_DEBUG   XTL_DEBUG
  #define XL_LOG_INFO    XTL_INFO
  #define XL_LOG_WARNING XTL_WARN

diff -r c514d69c71d8 tools/libxl/xl_cmdimpl.c

tools/libxl/xl_cmdimpl.c  Mon Jun 07 12:46:52 2010 +0100 renamed from tools/libxl/xl_cmdimpl.c  Fri Jun 04 11:39:06 2010 +0100 +21 -19
@@ -42,6 +42,25 @@
 
  #define UUID_FMT "%02hhx%02hhx%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx"
 
+#define CHK_ERRNO( call ) ({                                            \
+        int chk_errno = (call);                                         \
+        if (chk_errno < 0) {                                                \
+            fprintf(stderr,"xl: fatal error: %s:%d: %s: %s\n",          \
+                    __FILE__,__LINE__, strerror(chk_errno), #call);     \
+            exit(-ERROR_FAIL);                                          \
+        }                                                               \
+    })
+
+#define MUST( call ) ({                                                 \
+        int must_rc = (call);                                           \
+        if (must_rc < 0) {                                                  \
+            fprintf(stderr,"xl: fatal error: %s:%d, rc=%d: %s\n",       \
+                    __FILE__,__LINE__, must_rc, #call);                 \
+            exit(-must_rc);                                             \
+        }                                                               \
+    })
+
+
  int logfile = 2;
 
  /* every libxl action in xl uses this same libxl context */
@@ -240,7 +259,8 @@
     nic_info->mac[5] = 1 + (int) (0xff * (rand() / (RAND_MAX + 1.0)));
     nic_info->ifname = NULL;
     nic_info->bridge = "xenbr0";
-    nic_info->script = "/etc/xen/scripts/vif-bridge";
+    CHK_ERRNO( asprintf(&nic_info->script, "%s/vif-bridge",
+               libxl_xen_script_dir_path()) );
     nic_info->nictype = NICTYPE_IOEMU;
  }
 
@@ -791,24 +811,6 @@
     xlu_cfg_destroy(config);
  }
 
-#define CHK_ERRNO( call ) ({                                            \
-        int chk_errno = (call);                                         \
-        if (chk_errno) {                                                \
-            fprintf(stderr,"xl: fatal error: %s:%d: %s: %s\n",          \
-                    __FILE__,__LINE__, strerror(chk_errno), #call);     \
-            exit(-ERROR_FAIL);                                          \
-        }                                                               \
-    })
-
-#define MUST( call ) ({                                                 \
-        int must_rc = (call);                                           \
-        if (must_rc) {                                                  \
-            fprintf(stderr,"xl: fatal error: %s:%d, rc=%d: %s\n",       \
-                    __FILE__,__LINE__, must_rc, #call);                 \
-            exit(-must_rc);                                             \
-        }                                                               \
-    })
-
  static void *xmalloc(size_t sz) {
     void *r;
     r = malloc(sz);

diff -r c514d69c71d8 tools/misc/xend

tools/misc/xend   Mon Jun 07 12:46:52 2010 +0100 renamed from tools/misc/xend   Fri Jun 04 11:39:06 2010 +0100 +0 -0
@@ -73,48 +73,9 @@

    if os.fork() == 0:
        os.execvp(daemon, (daemon,) + args)

tools/misc/xend   Mon Jun 07 12:46:52 2010 +0100 renamed from tools/misc/xend   Fri Jun 04 11:39:06 2010 +0100 +0 -31
-def start_xenstored():
-    pidfname = "/var/run/xenstore.pid"
-    try:
-        f = open(pidfname, "a")
-        try:
-            fcntl.lockf(f, fcntl.LOCK_EX | fcntl.LOCK_NB)
-            rootdir = os.getenv("XENSTORED_ROOTDIR") or "/var/lib/xenstored"
-            for i in glob.glob(rootdir + "/tdb*"):
-                try:
-                    os.unlink(i)
-                except:
-                    pass
-            os.unlink(pidfname)
-        except:
-            pass
-        f.close()
-    except:
-        pass
-    XENSTORED_TRACE = os.getenv("XENSTORED_TRACE")
-    cmd = "xenstored --pid-file /var/run/xenstore.pid"
-    if XENSTORED_TRACE:
-        cmd += " -T /var/log/xen/xenstored-trace.log"
-    s,o = commands.getstatusoutput(cmd)
-
-def start_consoled():
-    XENCONSOLED_TRACE = os.getenv("XENCONSOLED_TRACE")
-    args = ""
-    if XENCONSOLED_TRACE:
-        args += "--log=" + XENCONSOLED_TRACE
-    start_daemon("xenconsoled", args)
-

 def start_blktapctrl():
    start_daemon("blktapctrl", "")

tools/misc/xend   Mon Jun 07 12:46:52 2010 +0100 renamed from tools/misc/xend   Fri Jun 04 11:39:06 2010 +0100 +0 -8
-def start_xenbackendd():
-    XENBACKENDD_DEBUG = os.getenv("XENBACKENDD_DEBUG")
-    args = ""
-    if XENBACKENDD_DEBUG:
-        args += "-d"
-    if os.uname()[0] == 'NetBSD':
-        start_daemon("xenbackendd", args)
-

 def main():
    try:
        check_logging()

tools/misc/xend   Mon Jun 07 12:46:52 2010 +0100 renamed from tools/misc/xend   Fri Jun 04 11:39:06 2010 +0100 +0 -0
@@ -127,15 +88,9 @@

        print 'usage: %s {start|stop|reload|restart}' % sys.argv[0] elif sys.argv[1] == 'start':
        if os.uname()[0] != "SunOS":
-            start_xenstored()
-            start_consoled()
-            start_xenbackendd()
            start_blktapctrl()
        return daemon.start()
    elif sys.argv[1] == 'trace_start':
-        start_xenstored()
-        start_consoled()
-        start_xenbackendd()
        start_blktapctrl()
        return daemon.start(trace=1)
    elif sys.argv[1] == 'stop':

tools/misc/xend   Mon Jun 07 12:46:52 2010 +0100 renamed from tools/misc/xend   Fri Jun 04 11:39:06 2010 +0100 +0 -0
@@ -143,9 +98,6 @@

    elif sys.argv[1] == 'reload':
        return daemon.reloadConfig()
    elif sys.argv[1] == 'restart':
-        start_xenstored()
-        start_consoled()
-        start_xenbackendd()
        start_blktapctrl()
        return daemon.stop() or daemon.start()
    elif sys.argv[1] == 'status':

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

#3 lore raw

Fixed by 21552.

K.

Quoted 508 lines · Dulloor

Looks like the changeset 21549 is incomplete.

-dulloor

Quoted 492 lines · Dulloor

I pulled the latest tip (from staging) and I get this error in compiling tools :
../../../tools/cross-install -m0755 -p init.d/xencommons //etc/init.d
install: cannot stat `init.d/xencommons': No such file or directory make[5]: *** [install-initd] Error 1

I can't find xencommons in the repo. Is this patch applied correctly ?

-dulloor

Quoted 480 lines · Stefano Stabellini

Hi all,
second version of the init scripts for xl: now the init script is called xencommons and, as the name suggests, it is a common script between xl and xend because it is used to start xenconsoled, xenstored and xenbackendd and the initialization of these three daemons has been removed from xend.
The global xen_toolstack=xl/xend variable has been removed. Regarding the network setup, I made the vif scripts follow the same pattern as the other scripts in xen-backend: a new script called vif-setup is executed unconditionally. vif-setup is going to do the right thing depending on the value of the environmental variable "script" (same technique used before), defaulting to vif-bridge. In the common scenario the toolstack doesn't need to set the variable "script"
because vif-bridge is going to be called anyway.
There is no global network script to setup the network bridges with xl, so if
you are using xl without xend, you need to manually configure the bridges using
your distro network setup, or, if you are lazy, you can just add something like:

/etc/xen/scripts/network-bridge start

to your rc.local.

---

diff -r c514d69c71d8 tools/hotplug/Linux/Makefile

tools/hotplug/Linux/Makefile Mon Jun 07 12:46:52 2010 +0100 renamed from tools/hotplug/Linux/Makefile Fri Jun 04 11:39:06 2010 +0100 +4 -1
@@ -3,15 +3,18 @@
 
 # Init scripts.
 XEND_INITD = init.d/xend
-XEND_SYSCONFIG = init.d/sysconfig.xend
 XENDOMAINS_INITD = init.d/xendomains
 XENDOMAINS_SYSCONFIG = init.d/sysconfig.xendomains
 
+XENCOMMONS_INITD = init.d/xencommons
+XENCOMMONS_SYSCONFIG = init.d/sysconfig.xencommons
+
 # Xen script dir and scripts to go there.
 XEN_SCRIPTS = network-bridge vif-bridge
 XEN_SCRIPTS += network-route vif-route
 XEN_SCRIPTS += network-nat vif-nat
 XEN_SCRIPTS += vif2
+XEN_SCRIPTS += vif-setup
 XEN_SCRIPTS += block
 XEN_SCRIPTS += block-enbd block-nbd
 XEN_SCRIPTS += blktap
@@ -64,9 +67,10 @@
       [ -d $(DESTDIR)$(CONFIG_DIR)/init.d ] || $(INSTALL_DIR)

$(DESTDIR)$(CONFIG_DIR)/init.d

       [ -d $(DESTDIR)$(CONFIG_DIR)/sysconfig ] || $(INSTALL_DIR)
$(DESTDIR)$(CONFIG_DIR)/sysconfig
       $(INSTALL_PROG) $(XEND_INITD) $(DESTDIR)$(CONFIG_DIR)/init.d
-       $(INSTALL_PROG) $(XEND_SYSCONFIG)
$(DESTDIR)$(CONFIG_DIR)/sysconfig/xend
       $(INSTALL_PROG) $(XENDOMAINS_INITD) $(DESTDIR)$(CONFIG_DIR)/init.d
       $(INSTALL_PROG) $(XENDOMAINS_SYSCONFIG)

$(DESTDIR)$(CONFIG_DIR)/sysconfig/xendomains

tools/hotplug/Linux/Makefile Mon Jun 07 12:46:52 2010 +0100 renamed from tools/hotplug/Linux/Makefile Fri Jun 04 11:39:06 2010 +0100 +2 -0
+       $(INSTALL_PROG) $(XENCOMMONS_INITD) $(DESTDIR)$(CONFIG_DIR)/init.d
+       $(INSTALL_PROG) $(XENCOMMONS_SYSCONFIG)

$(DESTDIR)$(CONFIG_DIR)/sysconfig/xencommons

.PHONY: install-scripts
install-scripts:
diff -r c514d69c71d8 tools/hotplug/Linux/init.d/sysconfig.xencommons

tools/hotplug/Linux/init.d/sysconfig.xencommons Mon Jun 07 12:46:52 renamed from dev/null Thu Jan 01 00:00:00 1970 +0000 +0 -0

2010 +0100

tools/hotplug/Linux/init.d/sysconfig.xencommons Mon Jun 07 12:46:52 renamed from dev/null Thu Jan 01 00:00:00 1970 +0000 +11 -0
@@ -0,0 +1,11 @@
+# Log xenconsoled messages (cf xl dmesg)
+#XENCONSOLED_TRACE=[none|guest|hv|all]
+
+# Log xenstored messages
+#XENSTORED_TRACE=[yes|on|1]
+
+# Running xenstored on XENSTORED_ROOTDIR
+#XENSTORED_ROOTDIR=/var/lib/xenstored
+
+# Running xenbackendd in debug mode
+#XENBACKENDD_DEBUG=[yes|on|1]

diff -r c514d69c71d8 tools/hotplug/Linux/init.d/sysconfig.xend --- a/tools/hotplug/Linux/init.d/sysconfig.xend Fri Jun 04 11:39:06 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000

tools/hotplug/Linux/init.d/sysconfig.xencommons Mon Jun 07 12:46:52 renamed from dev/null Thu Jan 01 00:00:00 1970 +0000 +0 -11
@@ -1,11 +0,0 @@
-# Log xenconsoled messages (cf xm dmesg)
-#XENCONSOLED_TRACE=[none|guest|hv|all]
-
-# Log xenstored messages
-#XENSTORED_TRACE=[yes|on|1]
-
-# Running xenstored on XENSTORED_ROOTDIR
-#XENSTORED_ROOTDIR=/var/lib/xenstored
-
-# Running xenbackendd in debug mode
-#XENBACKENDD_DEBUG=[yes|on|1]

diff -r c514d69c71d8 tools/hotplug/Linux/init.d/xencommons

tools/hotplug/Linux/init.d/xencommons Mon Jun 07 12:46:52 2010 renamed from dev/null Thu Jan 01 00:00:00 1970 +0000 +44 -0
+0100
@@ -0,0 +1,87 @@
+#!/bin/bash
+#
+# xencommons    Script to start and stop xenstored and xenconsoled
+#
+# Author:       Ian Jackson <[email protected]>
+#
+# chkconfig: 2345
+# description: Starts and stops xenstored and xenconsoled
+### BEGIN INIT INFO
+# Provides:          xenstored xenconsoled
+# Required-Start:    $syslog $remote_fs
+# Should-Start:
+# Required-Stop:     $syslog $remote_fs
+# Should-Stop:
+# Default-Start:     3 4 5
+# Default-Stop:      1
+# Default-Enabled:   yes
+# Short-Description: Start/stop xenstored and xenconsoled
+# Description:       Starts and stops the daemons neeeded for xl/xend
+### END INIT INFO
+
+test -f /etc/sysconfig/xencommons && . /etc/sysconfig/xencommons
+
+XENCONSOLED_PIDFILE=/var/run/xenconsoled.pid
+shopt -s extglob
+
+if test "x$1" = xstart && \
+     test -d /proc/xen && \
+   ! test -d /proc/xen/capabilities && \
+     grep '    xenfs$' /proc/filesystems >/dev/null && \
+   ! grep '^xenfs ' /proc/mounts >/dev/null;
+then
+       mount -t xenfs xenfs /proc/xen
+fi
+
+if ! grep -q "control_d" /proc/xen/capabilities ; then
+       exit 0
+fi
+
+do_start () {
+       if ! `xenstore-read -s / >/dev/null 2>&1`
+       then
+               test -z "$XENSTORED_ROOTDIR" ||

XENSTORED_ROOTDIR="/var/lib/xenstored"

tools/hotplug/Linux/init.d/xencommons Mon Jun 07 12:46:52 2010 renamed from dev/null Thu Jan 01 00:00:00 1970 +0000 +2 -0
+               rm -f "$XENSTORED_ROOTDIR"/tdb* &>/dev/null
+               test -z "$XENSTORED_TRACE" || XENSTORED_ARGS=" -T

/var/log/xen/xenstored-trace.log"

tools/hotplug/Linux/init.d/xencommons Mon Jun 07 12:46:52 2010 renamed from dev/null Thu Jan 01 00:00:00 1970 +0000 +5 -0
+               xenstored --pid-file=/var/run/xenstore.pid $XENSTORED_ARGS
+               xenstore-write "/local/domain/0/name" "Domain-0"
+       fi
+
+       test -z "$XENCONSOLED_TRACE" || XENCONSOLED_ARGS=" -T

/var/log/xen/xenstored-trace.log"

tools/hotplug/Linux/init.d/xencommons Mon Jun 07 12:46:52 2010 renamed from dev/null Thu Jan 01 00:00:00 1970 +0000 +37 -0
+       xenconsoled --pid-file=$XENCONSOLED_PIDFILE $XENCONSOLED_ARGS
+       test -z "$XENBACKENDD_DEBUG" || XENBACKENDD_ARGS="-d"
+       test "`uname`" != "NetBSD" || xenbackendd $XENBACKENDD_ARGS
+}
+do_stop () {
+       if read 2>/dev/null <$XENCONSOLED_PIDFILE pid; then
+               kill $pid
+               while kill -9 $pid >/dev/null 2>&1; do sleep 0.1; done
+               rm -f $XENCONSOLED_PIDFILE
+       fi
+}
+
+case "$1" in
+  start)
+       do_start
+       ;;
+  status)
+        xenstore-read -s /
+       ;;
+  stop)
+       do_stop
+       ;;
+  reload)
+       echo >&2 'Reload not available; use force-reload'; exit 1
+       ;;
+  force-reload|restart)
+        do_stop
+       do_start
+       ;;
+  *)
+       # do not advertise unreasonable commands that there is no reason
+       # to use with this device
+       echo $"Usage: $0 {start|stop|status|restart|force-reload}"
+       exit 1
+esac
+
+exit $?

diff -r c514d69c71d8 tools/hotplug/Linux/init.d/xend

tools/hotplug/Linux/init.d/xend Mon Jun 07 12:46:52 2010 +0100 renamed from tools/hotplug/Linux/init.d/xend Fri Jun 04 11:39:06 2010 +0100 +0 -18
@@ -20,20 +20,6 @@
 ### END INIT INFO
 
 shopt -s extglob
-test -f /etc/sysconfig/xend && . /etc/sysconfig/xend
-
-if   test "x$1" = xstart && \
-     test -d /proc/xen && \
-   ! test -d /proc/xen/capabilities && \
-     grep '    xenfs$' /proc/filesystems >/dev/null && \
-   ! grep '^xenfs ' /proc/mounts >/dev/null;
-then
-       mount -t xenfs xenfs /proc/xen
-fi
-
-if ! grep -qs "control_d" /proc/xen/capabilities ; then
-       exit 0
-fi
 
 # Wait for Xend to be up
 function await_daemons_up
@@ -53,10 +39,6 @@
  start)
       mkdir -p /var/lock/subsys
       touch /var/lock/subsys/xend
-       test -z "$XENSTORED_ROOTDIR" || export XENSTORED_ROOTDIR
-       test -z "$XENCONSOLED_TRACE" || export XENCONSOLED_TRACE
-       [[ "$XENSTORED_TRACE" == @(yes|on|1) ]] && export XENSTORED_TRACE
-       [[ "$XENBACKENDD_DEBUG" == @(yes|on|1) ]] && export

XENBACKENDD_DEBUG

       xend start
       await_daemons_up
       ;;

diff -r c514d69c71d8 tools/hotplug/Linux/init.d/xendomains
--- a/tools/hotplug/Linux/init.d/xendomains Fri Jun 04 11:39:06 2010
+0100
+++ b/tools/hotplug/Linux/init.d/xendomains Mon Jun 07 12:46:52 2010
+0100

tools/hotplug/Linux/init.d/xend Mon Jun 07 12:46:52 2010 +0100 renamed from tools/hotplug/Linux/init.d/xend Fri Jun 04 11:39:06 2010 +0100 +5 -0
@@ -28,6 +28,11 @@
 #                    boots / shuts down.
 ### END INIT INFO
 
+if ! `xm list &> /dev/null`
+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

diff -r c514d69c71d8 tools/hotplug/Linux/vif-setup

tools/hotplug/Linux/vif-setup Mon Jun 07 12:46:52 2010 +0100 renamed from dev/null Thu Jan 01 00:00:00 1970 +0000 +9 -0
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+if test "$script"
+then
+    exec "$script" $*
+else
+    exec /etc/xen/scripts/vif-bridge $*
+fi
+

diff -r c514d69c71d8 tools/hotplug/Linux/xen-backend.rules
--- a/tools/hotplug/Linux/xen-backend.rules Fri Jun 04 11:39:06 2010
+0100
+++ b/tools/hotplug/Linux/xen-backend.rules Mon Jun 07 12:46:52 2010
+0100

tools/hotplug/Linux/vif-setup Mon Jun 07 12:46:52 2010 +0100 renamed from dev/null Thu Jan 01 00:00:00 1970 +0000 +0 -0
@@ -2,8 +2,8 @@
 SUBSYSTEM=="xen-backend", KERNEL=="vbd*", RUN+="/etc/xen/scripts/block

$env{ACTION}"
SUBSYSTEM=="xen-backend", KERNEL=="vtpm*", RUN+="/etc/xen/scripts/vtpm
$env{ACTION}"
SUBSYSTEM=="xen-backend", KERNEL=="vif2-*", RUN+="/etc/xen/scripts/vif2
$env{ACTION}"
-SUBSYSTEM=="xen-backend", KERNEL=="vif-*", ACTION=="online", RUN+="$env{script} online"
-SUBSYSTEM=="xen-backend", KERNEL=="vif-*", ACTION=="offline", RUN+="$env{script} offline"
+SUBSYSTEM=="xen-backend", KERNEL=="vif-*", ACTION=="online", RUN+="/etc/xen/scripts/vif-setup online" +SUBSYSTEM=="xen-backend", KERNEL=="vif-*", ACTION=="offline", RUN+="/etc/xen/scripts/vif-setup offline"
SUBSYSTEM=="xen-backend", KERNEL=="vscsi*", RUN+="/etc/xen/scripts/vscsi
$env{ACTION}"
SUBSYSTEM=="xen-backend", ACTION=="remove",
RUN+="/etc/xen/scripts/xen-hotplug-cleanup"
KERNEL=="evtchn", NAME="xen/%k"
diff -r c514d69c71d8 tools/libxl/libxl.h

tools/libxl/libxl.h Mon Jun 07 12:46:52 2010 +0100 renamed from tools/libxl/libxl.h Fri Jun 04 11:39:06 2010 +0100 +12 -0
@@ -538,5 +538,17 @@
                   uint32_t set);
 int libxl_tmem_shared_auth(struct libxl_ctx *ctx, uint32_t domid, char*
 uuid,
                           int auth);
+
+/* common paths */
+const char *libxl_sbindir_path(void);
+const char *libxl_bindir_path(void);
+const char *libxl_libexec_path(void);
+const char *libxl_libdir_path(void);
+const char *libxl_sharedir_path(void);
+const char *libxl_private_bindir_path(void);
+const char *libxl_xenfirmwaredir_path(void);
+const char *libxl_xen_config_dir_path(void);
+const char *libxl_xen_script_dir_path(void);
+
 #endif /* LIBXL_H */

diff -r c514d69c71d8 tools/libxl/libxl_internal.h

tools/libxl/libxl_internal.h Mon Jun 07 12:46:52 2010 +0100 renamed from tools/libxl/libxl_internal.h Fri Jun 04 11:39:06 2010 +0100 +0 -11
@@ -215,17 +215,6 @@
 
 char *libxl_abs_path(struct libxl_ctx *ctx, char *s, const char *path);
 
-/* libxl_paths.c */
-const char *libxl_sbindir_path(void);
-const char *libxl_bindir_path(void);
-const char *libxl_libexec_path(void);
-const char *libxl_libdir_path(void);
-const char *libxl_sharedir_path(void);
-const char *libxl_private_bindir_path(void);
-const char *libxl_xenfirmwaredir_path(void);
-const char *libxl_xen_config_dir_path(void);
-const char *libxl_xen_script_dir_path(void);
-
 #define XL_LOG_DEBUG   XTL_DEBUG
 #define XL_LOG_INFO    XTL_INFO
 #define XL_LOG_WARNING XTL_WARN

diff -r c514d69c71d8 tools/libxl/xl_cmdimpl.c

tools/libxl/xl_cmdimpl.c Mon Jun 07 12:46:52 2010 +0100 renamed from tools/libxl/xl_cmdimpl.c Fri Jun 04 11:39:06 2010 +0100 +0 -0
@@ -42,6 +42,25 @@
 
 #define UUID_FMT

"%02hhx%02hhx%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hh x%02hhx%02hhx%02hhx%02hhx"

tools/libxl/xl_cmdimpl.c Mon Jun 07 12:46:52 2010 +0100 renamed from tools/libxl/xl_cmdimpl.c Fri Jun 04 11:39:06 2010 +0100 +3 -0
+#define CHK_ERRNO( call ) ({                                            \
+        int chk_errno = (call);                                         \
+        if (chk_errno < 0) {

\

tools/libxl/xl_cmdimpl.c Mon Jun 07 12:46:52 2010 +0100 renamed from tools/libxl/xl_cmdimpl.c Fri Jun 04 11:39:06 2010 +0100 +9 -0
+            fprintf(stderr,"xl: fatal error: %s:%d: %s: %s\n",          \
+                    __FILE__,__LINE__, strerror(chk_errno), #call);     \
+            exit(-ERROR_FAIL);                                          \
+        }                                                               \
+    })
+
+#define MUST( call ) ({                                                 \
+        int must_rc = (call);                                           \
+        if (must_rc < 0) {

\

tools/libxl/xl_cmdimpl.c Mon Jun 07 12:46:52 2010 +0100 renamed from tools/libxl/xl_cmdimpl.c Fri Jun 04 11:39:06 2010 +0100 +9 -19
+            fprintf(stderr,"xl: fatal error: %s:%d, rc=%d: %s\n",       \
+                    __FILE__,__LINE__, must_rc, #call);                 \
+            exit(-must_rc);                                             \
+        }                                                               \
+    })
+
+
 int logfile = 2;
 
 /* every libxl action in xl uses this same libxl context */
@@ -240,7 +259,8 @@
    nic_info->mac[5] = 1 + (int) (0xff * (rand() / (RAND_MAX + 1.0)));
    nic_info->ifname = NULL;
    nic_info->bridge = "xenbr0";
-    nic_info->script = "/etc/xen/scripts/vif-bridge";
+    CHK_ERRNO( asprintf(&nic_info->script, "%s/vif-bridge",
+               libxl_xen_script_dir_path()) );
    nic_info->nictype = NICTYPE_IOEMU;
 }
 
@@ -791,24 +811,6 @@
    xlu_cfg_destroy(config);
 }
 
-#define CHK_ERRNO( call ) ({                                            \
-        int chk_errno = (call);                                         \
-        if (chk_errno) {                                                \
-            fprintf(stderr,"xl: fatal error: %s:%d: %s: %s\n",          \
-                    __FILE__,__LINE__, strerror(chk_errno), #call);     \
-            exit(-ERROR_FAIL);                                          \
-        }                                                               \
-    })
-
-#define MUST( call ) ({                                                 \
-        int must_rc = (call);                                           \
-        if (must_rc) {                                                  \
-            fprintf(stderr,"xl: fatal error: %s:%d, rc=%d: %s\n",       \
-                    __FILE__,__LINE__, must_rc, #call);                 \
-            exit(-must_rc);                                             \
-        }                                                               \
-    })
-
 static void *xmalloc(size_t sz) {
    void *r;
    r = malloc(sz);

diff -r c514d69c71d8 tools/misc/xend

tools/misc/xend Mon Jun 07 12:46:52 2010 +0100 renamed from tools/misc/xend Fri Jun 04 11:39:06 2010 +0100 +0 -7
@@ -73,48 +73,9 @@
    if os.fork() == 0:
        os.execvp(daemon, (daemon,) + args)
 
-def start_xenstored():
-    pidfname = "/var/run/xenstore.pid"
-    try:
-        f = open(pidfname, "a")
-        try:
-            fcntl.lockf(f, fcntl.LOCK_EX | fcntl.LOCK_NB)
-            rootdir = os.getenv("XENSTORED_ROOTDIR") or

"/var/lib/xenstored"

tools/misc/xend Mon Jun 07 12:46:52 2010 +0100 renamed from tools/misc/xend Fri Jun 04 11:39:06 2010 +0100 +0 -41
-            for i in glob.glob(rootdir + "/tdb*"):
-                try:
-                    os.unlink(i)
-                except:
-                    pass
-            os.unlink(pidfname)
-        except:
-            pass
-        f.close()
-    except:
-        pass
-    XENSTORED_TRACE = os.getenv("XENSTORED_TRACE")
-    cmd = "xenstored --pid-file /var/run/xenstore.pid"
-    if XENSTORED_TRACE:
-        cmd += " -T /var/log/xen/xenstored-trace.log"
-    s,o = commands.getstatusoutput(cmd)
-
-def start_consoled():
-    XENCONSOLED_TRACE = os.getenv("XENCONSOLED_TRACE")
-    args = ""
-    if XENCONSOLED_TRACE:
-        args += "--log=" + XENCONSOLED_TRACE
-    start_daemon("xenconsoled", args)
-
 def start_blktapctrl():
    start_daemon("blktapctrl", "")
 
-def start_xenbackendd():
-    XENBACKENDD_DEBUG = os.getenv("XENBACKENDD_DEBUG")
-    args = ""
-    if XENBACKENDD_DEBUG:
-        args += "-d"
-    if os.uname()[0] == 'NetBSD':
-        start_daemon("xenbackendd", args)
-
 def main():
    try:
        check_logging()
@@ -127,15 +88,9 @@
        print 'usage: %s {start|stop|reload|restart}' % sys.argv[0]
    elif sys.argv[1] == 'start':
        if os.uname()[0] != "SunOS":
-            start_xenstored()
-            start_consoled()
-            start_xenbackendd()
            start_blktapctrl()
        return daemon.start()
    elif sys.argv[1] == 'trace_start':
-        start_xenstored()
-        start_consoled()
-        start_xenbackendd()
        start_blktapctrl()
        return daemon.start(trace=1)
    elif sys.argv[1] == 'stop':
@@ -143,9 +98,6 @@
    elif sys.argv[1] == 'reload':
        return daemon.reloadConfig()
    elif sys.argv[1] == 'restart':
-        start_xenstored()
-        start_consoled()
-        start_xenbackendd()
        start_blktapctrl()
        return daemon.stop() or daemon.start()
    elif sys.argv[1] == 'status':
Quoted 6 lines
Quoted 5 lines

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

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

#4 lore raw
In reply to Dulloor

Hgignore is filtering new files in tools/hotplug/Linux/init.d/ and so we may be missing a few files from the repo... I'm not sure why the ^.*\.d$ wildcard in .hgignore is triggering on an intermediate directory name. Will have to investigate.

-- Keir

Quoted 499 lines · Dulloor

I pulled the latest tip (from staging) and I get this error in compiling tools :
../../../tools/cross-install -m0755 -p init.d/xencommons //etc/init.d
install: cannot stat `init.d/xencommons': No such file or directory make[5]: *** [install-initd] Error 1

I can't find xencommons in the repo. Is this patch applied correctly ?

-dulloor

Quoted 477 lines · Stefano Stabellini

Hi all,
second version of the init scripts for xl: now the init script is called xencommons and, as the name suggests, it is a common script between xl and xend because it is used to start xenconsoled, xenstored and xenbackendd and the initialization of these three daemons has been removed from xend.
The global xen_toolstack=xl/xend variable has been removed. Regarding the network setup, I made the vif scripts follow the same pattern as the other scripts in xen-backend: a new script called vif-setup is executed unconditionally. vif-setup is going to do the right thing depending on the value of the environmental variable "script" (same technique used before), defaulting to vif-bridge. In the common scenario the toolstack doesn't need to set the variable "script"
because vif-bridge is going to be called anyway.
There is no global network script to setup the network bridges with xl, so if you are using xl without xend, you need to manually configure the bridges using
your distro network setup, or, if you are lazy, you can just add something like:

/etc/xen/scripts/network-bridge start

to your rc.local.

---

diff -r c514d69c71d8 tools/hotplug/Linux/Makefile

tools/hotplug/Linux/Makefile Mon Jun 07 12:46:52 2010 +0100 renamed from tools/hotplug/Linux/Makefile Fri Jun 04 11:39:06 2010 +0100 +4 -1
@@ -3,15 +3,18 @@
 
 # Init scripts.
 XEND_INITD = init.d/xend
-XEND_SYSCONFIG = init.d/sysconfig.xend
 XENDOMAINS_INITD = init.d/xendomains
 XENDOMAINS_SYSCONFIG = init.d/sysconfig.xendomains
 
+XENCOMMONS_INITD = init.d/xencommons
+XENCOMMONS_SYSCONFIG = init.d/sysconfig.xencommons
+
 # Xen script dir and scripts to go there.
 XEN_SCRIPTS = network-bridge vif-bridge
 XEN_SCRIPTS += network-route vif-route
 XEN_SCRIPTS += network-nat vif-nat
 XEN_SCRIPTS += vif2
+XEN_SCRIPTS += vif-setup
 XEN_SCRIPTS += block
 XEN_SCRIPTS += block-enbd block-nbd
 XEN_SCRIPTS += blktap
@@ -64,9 +67,10 @@
       [ -d $(DESTDIR)$(CONFIG_DIR)/init.d ] || $(INSTALL_DIR)

$(DESTDIR)$(CONFIG_DIR)/init.d

       [ -d $(DESTDIR)$(CONFIG_DIR)/sysconfig ] || $(INSTALL_DIR)
$(DESTDIR)$(CONFIG_DIR)/sysconfig
       $(INSTALL_PROG) $(XEND_INITD) $(DESTDIR)$(CONFIG_DIR)/init.d
-       $(INSTALL_PROG) $(XEND_SYSCONFIG)
$(DESTDIR)$(CONFIG_DIR)/sysconfig/xend
       $(INSTALL_PROG) $(XENDOMAINS_INITD) $(DESTDIR)$(CONFIG_DIR)/init.d
       $(INSTALL_PROG) $(XENDOMAINS_SYSCONFIG)

$(DESTDIR)$(CONFIG_DIR)/sysconfig/xendomains

tools/hotplug/Linux/Makefile Mon Jun 07 12:46:52 2010 +0100 renamed from tools/hotplug/Linux/Makefile Fri Jun 04 11:39:06 2010 +0100 +2 -0
+       $(INSTALL_PROG) $(XENCOMMONS_INITD) $(DESTDIR)$(CONFIG_DIR)/init.d
+       $(INSTALL_PROG) $(XENCOMMONS_SYSCONFIG)

$(DESTDIR)$(CONFIG_DIR)/sysconfig/xencommons

.PHONY: install-scripts
install-scripts:
diff -r c514d69c71d8 tools/hotplug/Linux/init.d/sysconfig.xencommons

tools/hotplug/Linux/init.d/sysconfig.xencommons Mon Jun 07 12:46:52 renamed from dev/null Thu Jan 01 00:00:00 1970 +0000 +0 -0

2010 +0100

tools/hotplug/Linux/init.d/sysconfig.xencommons Mon Jun 07 12:46:52 renamed from dev/null Thu Jan 01 00:00:00 1970 +0000 +11 -0
@@ -0,0 +1,11 @@
+# Log xenconsoled messages (cf xl dmesg)
+#XENCONSOLED_TRACE=[none|guest|hv|all]
+
+# Log xenstored messages
+#XENSTORED_TRACE=[yes|on|1]
+
+# Running xenstored on XENSTORED_ROOTDIR
+#XENSTORED_ROOTDIR=/var/lib/xenstored
+
+# Running xenbackendd in debug mode
+#XENBACKENDD_DEBUG=[yes|on|1]

diff -r c514d69c71d8 tools/hotplug/Linux/init.d/sysconfig.xend --- a/tools/hotplug/Linux/init.d/sysconfig.xend Fri Jun 04 11:39:06 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000

tools/hotplug/Linux/init.d/sysconfig.xencommons Mon Jun 07 12:46:52 renamed from dev/null Thu Jan 01 00:00:00 1970 +0000 +0 -11
@@ -1,11 +0,0 @@
-# Log xenconsoled messages (cf xm dmesg)
-#XENCONSOLED_TRACE=[none|guest|hv|all]
-
-# Log xenstored messages
-#XENSTORED_TRACE=[yes|on|1]
-
-# Running xenstored on XENSTORED_ROOTDIR
-#XENSTORED_ROOTDIR=/var/lib/xenstored
-
-# Running xenbackendd in debug mode
-#XENBACKENDD_DEBUG=[yes|on|1]

diff -r c514d69c71d8 tools/hotplug/Linux/init.d/xencommons

tools/hotplug/Linux/init.d/xencommons Mon Jun 07 12:46:52 2010 renamed from dev/null Thu Jan 01 00:00:00 1970 +0000 +44 -0
+0100
@@ -0,0 +1,87 @@
+#!/bin/bash
+#
+# xencommons    Script to start and stop xenstored and xenconsoled
+#
+# Author:       Ian Jackson <[email protected]>
+#
+# chkconfig: 2345
+# description: Starts and stops xenstored and xenconsoled
+### BEGIN INIT INFO
+# Provides:          xenstored xenconsoled
+# Required-Start:    $syslog $remote_fs
+# Should-Start:
+# Required-Stop:     $syslog $remote_fs
+# Should-Stop:
+# Default-Start:     3 4 5
+# Default-Stop:      1
+# Default-Enabled:   yes
+# Short-Description: Start/stop xenstored and xenconsoled
+# Description:       Starts and stops the daemons neeeded for xl/xend
+### END INIT INFO
+
+test -f /etc/sysconfig/xencommons && . /etc/sysconfig/xencommons
+
+XENCONSOLED_PIDFILE=/var/run/xenconsoled.pid
+shopt -s extglob
+
+if test "x$1" = xstart && \
+     test -d /proc/xen && \
+   ! test -d /proc/xen/capabilities && \
+     grep '    xenfs$' /proc/filesystems >/dev/null && \
+   ! grep '^xenfs ' /proc/mounts >/dev/null;
+then
+       mount -t xenfs xenfs /proc/xen
+fi
+
+if ! grep -q "control_d" /proc/xen/capabilities ; then
+       exit 0
+fi
+
+do_start () {
+       if ! `xenstore-read -s / >/dev/null 2>&1`
+       then
+               test -z "$XENSTORED_ROOTDIR" ||

XENSTORED_ROOTDIR="/var/lib/xenstored"

tools/hotplug/Linux/init.d/xencommons Mon Jun 07 12:46:52 2010 renamed from dev/null Thu Jan 01 00:00:00 1970 +0000 +2 -0
+               rm -f "$XENSTORED_ROOTDIR"/tdb* &>/dev/null
+               test -z "$XENSTORED_TRACE" || XENSTORED_ARGS=" -T

/var/log/xen/xenstored-trace.log"

tools/hotplug/Linux/init.d/xencommons Mon Jun 07 12:46:52 2010 renamed from dev/null Thu Jan 01 00:00:00 1970 +0000 +5 -0
+               xenstored --pid-file=/var/run/xenstore.pid $XENSTORED_ARGS
+               xenstore-write "/local/domain/0/name" "Domain-0"
+       fi
+
+       test -z "$XENCONSOLED_TRACE" || XENCONSOLED_ARGS=" -T

/var/log/xen/xenstored-trace.log"

tools/hotplug/Linux/init.d/xencommons Mon Jun 07 12:46:52 2010 renamed from dev/null Thu Jan 01 00:00:00 1970 +0000 +37 -0
+       xenconsoled --pid-file=$XENCONSOLED_PIDFILE $XENCONSOLED_ARGS
+       test -z "$XENBACKENDD_DEBUG" || XENBACKENDD_ARGS="-d"
+       test "`uname`" != "NetBSD" || xenbackendd $XENBACKENDD_ARGS
+}
+do_stop () {
+       if read 2>/dev/null <$XENCONSOLED_PIDFILE pid; then
+               kill $pid
+               while kill -9 $pid >/dev/null 2>&1; do sleep 0.1; done
+               rm -f $XENCONSOLED_PIDFILE
+       fi
+}
+
+case "$1" in
+  start)
+       do_start
+       ;;
+  status)
+        xenstore-read -s /
+       ;;
+  stop)
+       do_stop
+       ;;
+  reload)
+       echo >&2 'Reload not available; use force-reload'; exit 1
+       ;;
+  force-reload|restart)
+        do_stop
+       do_start
+       ;;
+  *)
+       # do not advertise unreasonable commands that there is no reason
+       # to use with this device
+       echo $"Usage: $0 {start|stop|status|restart|force-reload}"
+       exit 1
+esac
+
+exit $?

diff -r c514d69c71d8 tools/hotplug/Linux/init.d/xend

tools/hotplug/Linux/init.d/xend Mon Jun 07 12:46:52 2010 +0100 renamed from tools/hotplug/Linux/init.d/xend Fri Jun 04 11:39:06 2010 +0100 +0 -18
@@ -20,20 +20,6 @@
 ### END INIT INFO
 
 shopt -s extglob
-test -f /etc/sysconfig/xend && . /etc/sysconfig/xend
-
-if   test "x$1" = xstart && \
-     test -d /proc/xen && \
-   ! test -d /proc/xen/capabilities && \
-     grep '    xenfs$' /proc/filesystems >/dev/null && \
-   ! grep '^xenfs ' /proc/mounts >/dev/null;
-then
-       mount -t xenfs xenfs /proc/xen
-fi
-
-if ! grep -qs "control_d" /proc/xen/capabilities ; then
-       exit 0
-fi
 
 # Wait for Xend to be up
 function await_daemons_up
@@ -53,10 +39,6 @@
  start)
       mkdir -p /var/lock/subsys
       touch /var/lock/subsys/xend
-       test -z "$XENSTORED_ROOTDIR" || export XENSTORED_ROOTDIR
-       test -z "$XENCONSOLED_TRACE" || export XENCONSOLED_TRACE
-       [[ "$XENSTORED_TRACE" == @(yes|on|1) ]] && export XENSTORED_TRACE
-       [[ "$XENBACKENDD_DEBUG" == @(yes|on|1) ]] && export XENBACKENDD_DEBUG
       xend start
       await_daemons_up
       ;;

diff -r c514d69c71d8 tools/hotplug/Linux/init.d/xendomains
--- a/tools/hotplug/Linux/init.d/xendomains Fri Jun 04 11:39:06 2010
+0100
+++ b/tools/hotplug/Linux/init.d/xendomains Mon Jun 07 12:46:52 2010
+0100

tools/hotplug/Linux/init.d/xend Mon Jun 07 12:46:52 2010 +0100 renamed from tools/hotplug/Linux/init.d/xend Fri Jun 04 11:39:06 2010 +0100 +5 -0
@@ -28,6 +28,11 @@
 #                    boots / shuts down.
 ### END INIT INFO
 
+if ! `xm list &> /dev/null`
+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

diff -r c514d69c71d8 tools/hotplug/Linux/vif-setup

tools/hotplug/Linux/vif-setup Mon Jun 07 12:46:52 2010 +0100 renamed from dev/null Thu Jan 01 00:00:00 1970 +0000 +9 -0
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+if test "$script"
+then
+    exec "$script" $*
+else
+    exec /etc/xen/scripts/vif-bridge $*
+fi
+

diff -r c514d69c71d8 tools/hotplug/Linux/xen-backend.rules
--- a/tools/hotplug/Linux/xen-backend.rules Fri Jun 04 11:39:06 2010
+0100
+++ b/tools/hotplug/Linux/xen-backend.rules Mon Jun 07 12:46:52 2010
+0100

tools/hotplug/Linux/vif-setup Mon Jun 07 12:46:52 2010 +0100 renamed from dev/null Thu Jan 01 00:00:00 1970 +0000 +0 -0
@@ -2,8 +2,8 @@
 SUBSYSTEM=="xen-backend", KERNEL=="vbd*", RUN+="/etc/xen/scripts/block

$env{ACTION}"
SUBSYSTEM=="xen-backend", KERNEL=="vtpm*", RUN+="/etc/xen/scripts/vtpm
$env{ACTION}"
SUBSYSTEM=="xen-backend", KERNEL=="vif2-*", RUN+="/etc/xen/scripts/vif2
$env{ACTION}"
-SUBSYSTEM=="xen-backend", KERNEL=="vif-*", ACTION=="online", RUN+="$env{script} online"
-SUBSYSTEM=="xen-backend", KERNEL=="vif-*", ACTION=="offline", RUN+="$env{script} offline"
+SUBSYSTEM=="xen-backend", KERNEL=="vif-*", ACTION=="online", RUN+="/etc/xen/scripts/vif-setup online" +SUBSYSTEM=="xen-backend", KERNEL=="vif-*", ACTION=="offline", RUN+="/etc/xen/scripts/vif-setup offline"
SUBSYSTEM=="xen-backend", KERNEL=="vscsi*", RUN+="/etc/xen/scripts/vscsi
$env{ACTION}"
SUBSYSTEM=="xen-backend", ACTION=="remove",
RUN+="/etc/xen/scripts/xen-hotplug-cleanup"
KERNEL=="evtchn", NAME="xen/%k"
diff -r c514d69c71d8 tools/libxl/libxl.h

tools/libxl/libxl.h Mon Jun 07 12:46:52 2010 +0100 renamed from tools/libxl/libxl.h Fri Jun 04 11:39:06 2010 +0100 +12 -0
@@ -538,5 +538,17 @@
                   uint32_t set);
 int libxl_tmem_shared_auth(struct libxl_ctx *ctx, uint32_t domid, char*
 uuid,
                           int auth);
+
+/* common paths */
+const char *libxl_sbindir_path(void);
+const char *libxl_bindir_path(void);
+const char *libxl_libexec_path(void);
+const char *libxl_libdir_path(void);
+const char *libxl_sharedir_path(void);
+const char *libxl_private_bindir_path(void);
+const char *libxl_xenfirmwaredir_path(void);
+const char *libxl_xen_config_dir_path(void);
+const char *libxl_xen_script_dir_path(void);
+
 #endif /* LIBXL_H */

diff -r c514d69c71d8 tools/libxl/libxl_internal.h

tools/libxl/libxl_internal.h Mon Jun 07 12:46:52 2010 +0100 renamed from tools/libxl/libxl_internal.h Fri Jun 04 11:39:06 2010 +0100 +0 -11
@@ -215,17 +215,6 @@
 
 char *libxl_abs_path(struct libxl_ctx *ctx, char *s, const char *path);
 
-/* libxl_paths.c */
-const char *libxl_sbindir_path(void);
-const char *libxl_bindir_path(void);
-const char *libxl_libexec_path(void);
-const char *libxl_libdir_path(void);
-const char *libxl_sharedir_path(void);
-const char *libxl_private_bindir_path(void);
-const char *libxl_xenfirmwaredir_path(void);
-const char *libxl_xen_config_dir_path(void);
-const char *libxl_xen_script_dir_path(void);
-
 #define XL_LOG_DEBUG   XTL_DEBUG
 #define XL_LOG_INFO    XTL_INFO
 #define XL_LOG_WARNING XTL_WARN

diff -r c514d69c71d8 tools/libxl/xl_cmdimpl.c

tools/libxl/xl_cmdimpl.c Mon Jun 07 12:46:52 2010 +0100 renamed from tools/libxl/xl_cmdimpl.c Fri Jun 04 11:39:06 2010 +0100 +0 -0
@@ -42,6 +42,25 @@
 
 #define UUID_FMT

"%02hhx%02hhx%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx %02hhx%02hhx%02hhx%02hhx"

tools/libxl/xl_cmdimpl.c Mon Jun 07 12:46:52 2010 +0100 renamed from tools/libxl/xl_cmdimpl.c Fri Jun 04 11:39:06 2010 +0100 +3 -0
+#define CHK_ERRNO( call ) ({                                            \
+        int chk_errno = (call);                                         \
+        if (chk_errno < 0) {

\

tools/libxl/xl_cmdimpl.c Mon Jun 07 12:46:52 2010 +0100 renamed from tools/libxl/xl_cmdimpl.c Fri Jun 04 11:39:06 2010 +0100 +9 -0
+            fprintf(stderr,"xl: fatal error: %s:%d: %s: %s\n",          \
+                    __FILE__,__LINE__, strerror(chk_errno), #call);     \
+            exit(-ERROR_FAIL);                                          \
+        }                                                               \
+    })
+
+#define MUST( call ) ({                                                 \
+        int must_rc = (call);                                           \
+        if (must_rc < 0) {

\

tools/libxl/xl_cmdimpl.c Mon Jun 07 12:46:52 2010 +0100 renamed from tools/libxl/xl_cmdimpl.c Fri Jun 04 11:39:06 2010 +0100 +9 -19
+            fprintf(stderr,"xl: fatal error: %s:%d, rc=%d: %s\n",       \
+                    __FILE__,__LINE__, must_rc, #call);                 \
+            exit(-must_rc);                                             \
+        }                                                               \
+    })
+
+
 int logfile = 2;
 
 /* every libxl action in xl uses this same libxl context */
@@ -240,7 +259,8 @@
    nic_info->mac[5] = 1 + (int) (0xff * (rand() / (RAND_MAX + 1.0)));
    nic_info->ifname = NULL;
    nic_info->bridge = "xenbr0";
-    nic_info->script = "/etc/xen/scripts/vif-bridge";
+    CHK_ERRNO( asprintf(&nic_info->script, "%s/vif-bridge",
+               libxl_xen_script_dir_path()) );
    nic_info->nictype = NICTYPE_IOEMU;
 }
 
@@ -791,24 +811,6 @@
    xlu_cfg_destroy(config);
 }
 
-#define CHK_ERRNO( call ) ({                                            \
-        int chk_errno = (call);                                         \
-        if (chk_errno) {                                                \
-            fprintf(stderr,"xl: fatal error: %s:%d: %s: %s\n",          \
-                    __FILE__,__LINE__, strerror(chk_errno), #call);     \
-            exit(-ERROR_FAIL);                                          \
-        }                                                               \
-    })
-
-#define MUST( call ) ({                                                 \
-        int must_rc = (call);                                           \
-        if (must_rc) {                                                  \
-            fprintf(stderr,"xl: fatal error: %s:%d, rc=%d: %s\n",       \
-                    __FILE__,__LINE__, must_rc, #call);                 \
-            exit(-must_rc);                                             \
-        }                                                               \
-    })
-
 static void *xmalloc(size_t sz) {
    void *r;
    r = malloc(sz);

diff -r c514d69c71d8 tools/misc/xend

tools/misc/xend Mon Jun 07 12:46:52 2010 +0100 renamed from tools/misc/xend Fri Jun 04 11:39:06 2010 +0100 +0 -48
@@ -73,48 +73,9 @@
    if os.fork() == 0:
        os.execvp(daemon, (daemon,) + args)
 
-def start_xenstored():
-    pidfname = "/var/run/xenstore.pid"
-    try:
-        f = open(pidfname, "a")
-        try:
-            fcntl.lockf(f, fcntl.LOCK_EX | fcntl.LOCK_NB)
-            rootdir = os.getenv("XENSTORED_ROOTDIR") or "/var/lib/xenstored"
-            for i in glob.glob(rootdir + "/tdb*"):
-                try:
-                    os.unlink(i)
-                except:
-                    pass
-            os.unlink(pidfname)
-        except:
-            pass
-        f.close()
-    except:
-        pass
-    XENSTORED_TRACE = os.getenv("XENSTORED_TRACE")
-    cmd = "xenstored --pid-file /var/run/xenstore.pid"
-    if XENSTORED_TRACE:
-        cmd += " -T /var/log/xen/xenstored-trace.log"
-    s,o = commands.getstatusoutput(cmd)
-
-def start_consoled():
-    XENCONSOLED_TRACE = os.getenv("XENCONSOLED_TRACE")
-    args = ""
-    if XENCONSOLED_TRACE:
-        args += "--log=" + XENCONSOLED_TRACE
-    start_daemon("xenconsoled", args)
-
 def start_blktapctrl():
    start_daemon("blktapctrl", "")
 
-def start_xenbackendd():
-    XENBACKENDD_DEBUG = os.getenv("XENBACKENDD_DEBUG")
-    args = ""
-    if XENBACKENDD_DEBUG:
-        args += "-d"
-    if os.uname()[0] == 'NetBSD':
-        start_daemon("xenbackendd", args)
-
 def main():
    try:
        check_logging()
@@ -127,15 +88,9 @@
        print 'usage: %s {start|stop|reload|restart}' % sys.argv[0]
    elif sys.argv[1] == 'start':
        if os.uname()[0] != "SunOS":
-            start_xenstored()
-            start_consoled()
-            start_xenbackendd()
            start_blktapctrl()
        return daemon.start()
    elif sys.argv[1] == 'trace_start':
-        start_xenstored()
-        start_consoled()
-        start_xenbackendd()
        start_blktapctrl()
        return daemon.start(trace=1)
    elif sys.argv[1] == 'stop':
@@ -143,9 +98,6 @@
    elif sys.argv[1] == 'reload':
        return daemon.reloadConfig()
    elif sys.argv[1] == 'restart':
-        start_xenstored()
-        start_consoled()
-        start_xenbackendd()
        start_blktapctrl()
        return daemon.stop() or daemon.start()
    elif sys.argv[1] == 'status':
Quoted 5 lines

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

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