[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] xl: init scripts (v2)



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1275922186 -3600
# Node ID 8bcaec29574ebf7ac8b79c7f5b5d6711a3c80740
# Parent  fd6e9407adf4c34a796241ea3d0dea9bc856019c
xl: init scripts (v2)

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.

Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
---
 tools/hotplug/Linux/init.d/sysconfig.xend |   11 ------
 tools/hotplug/Linux/xl-vif-script         |   14 --------
 tools/hotplug/Linux/Makefile              |   14 +++-----
 tools/hotplug/Linux/init.d/xend           |   24 ---------------
 tools/hotplug/Linux/init.d/xendomains     |    4 --
 tools/hotplug/Linux/vif-setup             |    9 +++++
 tools/hotplug/Linux/xen-backend.rules     |    4 +-
 tools/libxl/xl_cmdimpl.c                  |    2 -
 tools/misc/xend                           |   48 ------------------------------
 9 files changed, 18 insertions(+), 112 deletions(-)

diff -r fd6e9407adf4 -r 8bcaec29574e tools/hotplug/Linux/Makefile
--- a/tools/hotplug/Linux/Makefile      Mon Jun 07 15:48:12 2010 +0100
+++ b/tools/hotplug/Linux/Makefile      Mon Jun 07 15:49:46 2010 +0100
@@ -3,20 +3,18 @@ include $(XEN_ROOT)/tools/Rules.mk
 
 # Init scripts.
 XEND_INITD = init.d/xend
-XEND_SYSCONFIG = init.d/sysconfig.xend
 XENDOMAINS_INITD = init.d/xendomains
 XENDOMAINS_SYSCONFIG = init.d/sysconfig.xendomains
 
-XLD_INITD = init.d/xenlightdaemons
-XLD_SYSCONFIG = init.d/sysconfig.xenlightdaemons
-XENTOOLSTACK_SYSCONFIG = init.d/sysconfig.xen_toolstack
+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 += xl-vif-script
 XEN_SCRIPTS += vif2
+XEN_SCRIPTS += vif-setup
 XEN_SCRIPTS += block
 XEN_SCRIPTS += block-enbd block-nbd
 XEN_SCRIPTS += blktap
@@ -69,12 +67,10 @@ install-initd:
        [ -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) $(XLD_INITD) $(DESTDIR)$(CONFIG_DIR)/init.d
-       $(INSTALL_PROG) $(XLD_SYSCONFIG) 
$(DESTDIR)$(CONFIG_DIR)/sysconfig/xenlightdaemons
-       $(INSTALL_PROG) $(XENTOOLSTACK_SYSCONFIG) 
$(DESTDIR)$(CONFIG_DIR)/sysconfig/xen_toolstack
+       $(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 fd6e9407adf4 -r 8bcaec29574e tools/hotplug/Linux/init.d/sysconfig.xend
--- a/tools/hotplug/Linux/init.d/sysconfig.xend Mon Jun 07 15:48:12 2010 +0100
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -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 fd6e9407adf4 -r 8bcaec29574e tools/hotplug/Linux/init.d/xend
--- a/tools/hotplug/Linux/init.d/xend   Mon Jun 07 15:48:12 2010 +0100
+++ b/tools/hotplug/Linux/init.d/xend   Mon Jun 07 15:49:46 2010 +0100
@@ -20,26 +20,6 @@
 ### END INIT INFO
 
 shopt -s extglob
-test -f /etc/sysconfig/xend && . /etc/sysconfig/xend
-test -f /etc/sysconfig/xen_toolstack && . /etc/sysconfig/xen_toolstack
-
-if test "x$xen_toolstack" != "xxend"
-then
-       exit 0
-fi
-
-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
@@ -59,10 +39,6 @@ case "$1" in
   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 fd6e9407adf4 -r 8bcaec29574e tools/hotplug/Linux/init.d/xendomains
--- a/tools/hotplug/Linux/init.d/xendomains     Mon Jun 07 15:48:12 2010 +0100
+++ b/tools/hotplug/Linux/init.d/xendomains     Mon Jun 07 15:49:46 2010 +0100
@@ -28,9 +28,7 @@
 #                    boots / shuts down.
 ### END INIT INFO
 
-test -f /etc/sysconfig/xen_toolstack && . /etc/sysconfig/xen_toolstack
-
-if test "x$xen_toolstack" != "xxend"
+if `xm list &> /dev/null`
 then
        exit 0
 fi
diff -r fd6e9407adf4 -r 8bcaec29574e tools/hotplug/Linux/vif-setup
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/hotplug/Linux/vif-setup     Mon Jun 07 15:49:46 2010 +0100
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+if test "$script"
+then
+    exec "$script" $*
+else
+    exec /etc/xen/scripts/vif-bridge $*
+fi
+
diff -r fd6e9407adf4 -r 8bcaec29574e tools/hotplug/Linux/xen-backend.rules
--- a/tools/hotplug/Linux/xen-backend.rules     Mon Jun 07 15:48:12 2010 +0100
+++ b/tools/hotplug/Linux/xen-backend.rules     Mon Jun 07 15:49:46 2010 +0100
@@ -2,8 +2,8 @@ SUBSYSTEM=="xen-backend", KERNEL=="vbd*"
 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 fd6e9407adf4 -r 8bcaec29574e tools/hotplug/Linux/xl-vif-script
--- a/tools/hotplug/Linux/xl-vif-script Mon Jun 07 15:48:12 2010 +0100
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,14 +0,0 @@
-#!/bin/sh
-
-test -f /etc/sysconfig/xenlightdaemons && . /etc/sysconfig/xenlightdaemons
-
-if test "$VIF_SCRIPT"
-then
-    if test -f "$VIF_SCRIPT"
-    then
-        "$VIF_SCRIPT" $*
-    else
-        "$XEN_SCRIPTS_DIR"/"$VIF_SCRIPT" $*
-    fi
-fi
-
diff -r fd6e9407adf4 -r 8bcaec29574e tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c  Mon Jun 07 15:48:12 2010 +0100
+++ b/tools/libxl/xl_cmdimpl.c  Mon Jun 07 15:49:46 2010 +0100
@@ -259,7 +259,7 @@ static void init_nic_info(libxl_device_n
     nic_info->mac[5] = 1 + (int) (0xff * (rand() / (RAND_MAX + 1.0)));
     nic_info->ifname = NULL;
     nic_info->bridge = "xenbr0";
-    CHK_ERRNO( asprintf(&nic_info->script, "%s/xl-vif-script",
+    CHK_ERRNO( asprintf(&nic_info->script, "%s/vif-bridge",
                libxl_xen_script_dir_path()) );
     nic_info->nictype = NICTYPE_IOEMU;
 }
diff -r fd6e9407adf4 -r 8bcaec29574e tools/misc/xend
--- a/tools/misc/xend   Mon Jun 07 15:48:12 2010 +0100
+++ b/tools/misc/xend   Mon Jun 07 15:49:46 2010 +0100
@@ -73,47 +73,8 @@ def start_daemon(daemon, *args):
     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:
@@ -127,15 +88,9 @@ def main():
         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 @@ def main():
     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-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.