WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] [patch] Xen build - Debian vs Redhat layout patch option

To: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
Subject: Re: [Xen-devel] [patch] Xen build - Debian vs Redhat layout patch options
From: Bruce Edge <bruce.edge@xxxxxxxxx>
Date: Thu, 16 Sep 2010 11:52:10 -0700
Cc: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Thu, 16 Sep 2010 11:53:08 -0700
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type; bh=axcOXBw94ELqydYhHhFvZGXvCZsiFEWcf8quJQ/4wHo=; b=antxGmpT9OV8uXJ1rrD8eUHxoTaTuIf/WM8e62vXc7AAvI09Ge/gzvS37khzuqtlHl gXw4t2H8+09u80cfnRf6Ztk1v2CoOZ+kxQj845iLdR0ycqgedSmHyc79O6qisNcjxEBW GYwY4UT5YlJscH+EHGGT6ZC0Bs2L8DPEJCEt4=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=Div527IIy+B5+GxtUJ8/8QrBFr+HYOqRRspnvV2By8ZKIYfDwT7qt8wFdHcq31Hp9A nc12uE1BVLQRTV+ua4f5lK8EKUcaVW8IBpfAYys8QWJVkAO6faupvsrFYtAmgL3fhooh HpMNmzT3GEKnxfzJ4dCwdoQxbNznQD1aLottI=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <19602.17927.197275.274485@xxxxxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <AANLkTimi2-DzvysGnzJmEZtL4TXSsX6YDS0TPtoU-FiE@xxxxxxxxxxxxxx> <alpine.DEB.2.00.1007071207480.17029@kaball-desktop> <AANLkTi=2TveuUANkar9d89k_Ck22RWFDEB-bKnCanOuz@xxxxxxxxxxxxxx> <19599.43888.826450.690087@xxxxxxxxxxxxxxxxxxxxxxxx> <AANLkTik8b2evzTg8biVPVySvJTzVYmTSmSSt-WhbYrnD@xxxxxxxxxxxxxx> <19600.39408.486631.15438@xxxxxxxxxxxxxxxxxxxxxxxx> <AANLkTim8TGttxjWiVCnXrh9wyzpfaC6sd=MirvYUw__y@xxxxxxxxxxxxxx> <19602.17927.197275.274485@xxxxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
On Thu, Sep 16, 2010 at 9:29 AM, Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx> wrote:
> Bruce Edge writes ("Re: [Xen-devel] [patch] Xen build - Debian vs Redhat 
> layout patch options"):
>> On Wed, Sep 15, 2010 at 3:03 AM, Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx> 
>> wrote:
>> > It is better to provide hooks to allow distros we don't know about to
>> > do what they want.
>>
>> You don't think there's any advantage to grouping all the distro
>> directory dependencies in one place?
>
> No.  I think there is a disadvantage to grouping these kind of
> configuration parameter settings by our idea of what distros there
> are and how they work.
>
>> I thought that would make it easy to see where new distro layouts
>> should be added.
>
> A distro we haven't heard of doesn't want to patch our makefiles to
> add themselves to a huge list, and we don't want a list of all the
> distros in the universe in our code.  They just want to set the
> settings available to the values for their setup.
>
>> If not, then I'll just use these variables that can be tuned individually:
>>
>> SYSCONFIG_DIR_LEAF
>> SUBSYS_DIR_LEAF
>> INITD_DIR
>>
>> and put them all in Config.mk.
>
> That would be great, thanks.
>
> Ian.
>

Here's the next attempt.
This addresses the issues raised above and addresses a few more things I found.
This one fixes udev and xen-watchdog startup as well.


=============== cut ================

See docs/misc/distro_mapping.txt for more details.

Author: Bruce Edge <bruce.edge@xxxxxxxxx>

Signed-off-by: Bruce Edge <bruce.edge@xxxxxxxxx>

Index: xen-unstable.hg/config/StdGNU.mk
===================================================================
--- xen-unstable.hg.orig/config/StdGNU.mk       2010-09-15
10:14:31.000000000 -0700
+++ xen-unstable.hg/config/StdGNU.mk    2010-09-16 09:48:43.000000000 -0700
@@ -49,7 +49,7 @@
 CONFIG_DIR = $(PREFIX)/etc
 endif

-SYSCONFIG_DIR = $(CONFIG_DIR)/sysconfig
+SYSCONFIG_DIR = $(CONFIG_DIR)/$(CONFIG_LEAF_DIR)

 XEN_CONFIG_DIR = $(CONFIG_DIR)/xen
 XEN_SCRIPT_DIR = $(XEN_CONFIG_DIR)/scripts
Index: xen-unstable.hg/Makefile
===================================================================
--- xen-unstable.hg.orig/Makefile       2010-09-15 10:14:31.000000000 -0700
+++ xen-unstable.hg/Makefile    2010-09-16 09:35:49.000000000 -0700
@@ -203,7 +203,7 @@
        rm -f  $(D)$(CONFIG_DIR)/udev/xen-backend.rules
        rm -f  $(D)$(CONFIG_DIR)/udev/rules.d/xend.rules
        rm -f  $(D)$(CONFIG_DIR)/udev/xend.rules
-       rm -f  $(D)$(CONFIG_DIR)/sysconfig/xendomains
+       rm -f  $(D)$(SYSCONFIG_DIR)/xendomains
        rm -rf $(D)/var/run/xen* $(D)/var/lib/xen*
        rm -rf $(D)/boot/*xen*
        rm -rf $(D)/lib/modules/*xen*
Index: xen-unstable.hg/docs/misc/distro_mapping.txt
===================================================================
--- /dev/null   1970-01-01 00:00:00.000000000 +0000
+++ xen-unstable.hg/docs/misc/distro_mapping.txt        2010-09-16
09:50:30.000000000 -0700
@@ -0,0 +1,20 @@
+With directory layout differences between Red Hat, Debian, Suse and
+other distros one needs to set the variables for the elements below
+
+-----------------+------------------+---------------+----------------+
+                 | RedHat (default) |  Debian       |  Suse          |
+-----------------+------------------+---------------+----------------+
+CONFIG_LEAF_DIR  | /sysconfig       | /default      | /sysconfig     |
+SUBSYS_DIR       | /var/run/subsys  | /var/run      | /var/run       |
+INITD_DIR        | /etc/rc.d/init.d | /etc/init.d   | /etc/init.d    |
+-----------------+------------------+---------------+----------------+
+
+The build currently defaults to the elements used by Red Hat.
+For others, these env variables must be set in the shell env
+or modified in Config.mk before running make.
+
+This mechanism sets the location that files are installed to, but does
+not change the code itself. Scripts that refer to files affected by these
+directories must check each possible location at run time.
+To add support for new distributions that don't use the above locations,
+one must grep for the above elements and add appropriate checks.
Index: xen-unstable.hg/tools/xenballoon/xenballoond.init
===================================================================
--- xen-unstable.hg.orig/tools/xenballoon/xenballoond.init
2010-09-15 10:14:32.000000000 -0700
+++ xen-unstable.hg/tools/xenballoon/xenballoond.init   2010-09-16
09:53:19.000000000 -0700
@@ -29,6 +29,8 @@

 if [ -f /etc/sysconfig/xenballoon.conf ]; then
        . /etc/sysconfig/xenballoon.conf
+elif [ -f /etc/default/xenballoon.conf ]; then
+       . /etc/default/xenballoon.conf
 fi

 # Check that balloon driver is present
Index: xen-unstable.hg/tools/xenballoon/xenballoond
===================================================================
--- xen-unstable.hg.orig/tools/xenballoon/xenballoond   2010-09-15
10:14:32.000000000 -0700
+++ xen-unstable.hg/tools/xenballoon/xenballoond        2010-09-16
09:35:49.000000000 -0700
@@ -21,7 +21,7 @@
 # If xenbus is running and the /usr/bin/xenstore-* tools are installed,
 # "xenbus is enabled".
 #
-# Parameters are documented in /etc/sysconfig/xenballoon.conf. Although
+# Parameters are documented in <SYSCONFIG>/xenballoon.conf. Although
 # some are not used with directed ballooning, all must be set properly.
 # If xenbus is enabled, some of these parameters may be overridden by values
 # set by domain0 via xenbus.
@@ -237,7 +237,12 @@
 fi
 preswapnow=0

-. /etc/sysconfig/xenballoon.conf
+# See DISTRO_TYPE in the docs
+if [ -f /etc/sysconfig/xenballoon.conf ]; then
+       . /etc/sysconfig/xenballoon.conf
+elif [ -f /etc/default/xenballoon.conf ]; then
+       . /etc/default/xenballoon.conf
+fi

 while true;
 do
Index: xen-unstable.hg/tools/xenballoon/xenballoond.README
===================================================================
--- xen-unstable.hg.orig/tools/xenballoon/xenballoond.README
2010-09-15 10:14:32.000000000 -0700
+++ xen-unstable.hg/tools/xenballoon/xenballoond.README 2010-09-16
09:56:42.000000000 -0700
@@ -56,16 +56,19 @@
     be installed.  Binaries can be obtained, for example, by building
     xen-vvv.gz/tools in a guest-binary-compatible development tree

-Instructions to install/deploy xenballoond (in Redhat-based system):
+Instructions to install/deploy xenballoond:
+  (see docs/misc/distro_mapping.txt for SYSCONFIG and INITD_DIR definitions)
 - in each guest:
   - ensure pre-requisites are met (see above)
-  - place xenballoon.conf in /etc/sysconfig
+  - place xenballoon.conf in <SYSCONFIG>
   - place xenballoond in /usr/sbin
-  - copy xenballoond.init to /etc/rc.d/init.d/xenballoond (note file rename)
-  - edit /etc/sysconfig/xenballoond.conf as desired (especially note that
+  - copy xenballoond.init to <INITD_DIR>/xenballoond (note file rename)
+  - edit <SYSCONFIG>/xenballoond.conf as desired (especially note that
     selfballooning defaults as off)
   - start xenballoond with "service xenballoond start", and/or configure
-    xenballoond to start at init (e.g. "chkconfig xenballoond on")
+    xenballoond to start at init
+        (Red Hat e.g. "chkconfig xenballoond on")
+        (Debian e.g. " update-rc.d xenballoond defaults")
 - in domain0:
   - if monitoring is desired, xenballoon-monitor may be installed in /usr/sbin
 - note that certain xenballoond.conf variables may be overridden by domain0
@@ -73,7 +76,7 @@
   xenballoond.conf

 TODO:
-080630 modifications to support SUSE-based and debian-based guests
+080630 modifications to support SUSE-based
 080630 domain0 ballooning policy module
 080630 experiment with more aggressive (optionally) memory minimum targets
 080630 BUG: xenballoond doesn't properly record the fact that it's running;
Index: xen-unstable.hg/tools/hotplug/Linux/init.d/xendomains
===================================================================
--- xen-unstable.hg.orig/tools/hotplug/Linux/init.d/xendomains
2010-09-15 10:14:31.000000000 -0700
+++ xen-unstable.hg/tools/hotplug/Linux/init.d/xendomains
2010-09-16 09:35:49.000000000 -0700
@@ -46,8 +46,18 @@
        exit 0
 fi

-LOCKFILE=/var/lock/subsys/xendomains
-XENDOM_CONFIG=/etc/sysconfig/xendomains
+# See DISTRO_TYPE in the docs
+if [ -d /var/lock/subsys ]; then
+       LOCKFILE=/var/lock/subsys/xendomains
+else
+       LOCKFILE=/var/lock/xendomains
+fi
+
+if [ -d /etc/sysconfig ]; then
+       XENDOM_CONFIG=/etc/sysconfig/xendomains
+else
+       XENDOM_CONFIG=/etc/default/xendomains
+fi

 test -r $XENDOM_CONFIG || { echo "$XENDOM_CONFIG not existing";
        if [ "$1" = "stop" ]; then exit 0;
Index: xen-unstable.hg/tools/hotplug/Linux/init.d/xend
===================================================================
--- xen-unstable.hg.orig/tools/hotplug/Linux/init.d/xend
2010-09-15 10:14:31.000000000 -0700
+++ xen-unstable.hg/tools/hotplug/Linux/init.d/xend     2010-09-16
09:35:49.000000000 -0700
@@ -40,14 +40,20 @@
                echo "xencommons should be started first."
                exit 1
        fi
-       mkdir -p /var/lock/subsys
-       touch /var/lock/subsys/xend
+       # mkdir shouldn't be needed as most distros have this already
created. Default to using subsys.
+       # See DISTRO_TYPE in the docs
+       mkdir -p /var/lock
+       if [ -d /var/lock/subsys ] ; then
+               touch /var/lock/subsys/xend
+       else
+               touch /var/lock/xend
+       fi
        xend start
        await_daemons_up
        ;;
   stop)
        xend stop
-       rm -f /var/lock/subsys/xend
+       rm -f /var/lock/subsys/xend /var/lock/xend
        ;;
   status)
        xend status
Index: xen-unstable.hg/tools/hotplug/Linux/Makefile
===================================================================
--- xen-unstable.hg.orig/tools/hotplug/Linux/Makefile   2010-09-15
10:14:31.000000000 -0700
+++ xen-unstable.hg/tools/hotplug/Linux/Makefile        2010-09-16
09:35:49.000000000 -0700
@@ -62,16 +62,17 @@
 .PHONY: install
 install: all install-initd install-scripts $(HOTPLUGS)

+# See DISTRO_TYPE in the docs for INITD_DIR location
 .PHONY: install-initd
 install-initd:
-       [ -d $(DESTDIR)$(CONFIG_DIR)/init.d ] || $(INSTALL_DIR)
$(DESTDIR)$(CONFIG_DIR)/init.d
+       [ -d $(DESTDIR)$(INITD_DIR) ] || $(INSTALL_DIR) $(DESTDIR)$(INITD_DIR)
        [ -d $(DESTDIR)$(SYSCONFIG_DIR) ] || $(INSTALL_DIR)
$(DESTDIR)$(SYSCONFIG_DIR)
-       $(INSTALL_PROG) $(XEND_INITD) $(DESTDIR)$(CONFIG_DIR)/init.d
-       $(INSTALL_PROG) $(XENDOMAINS_INITD) $(DESTDIR)$(CONFIG_DIR)/init.d
+       $(INSTALL_PROG) $(XEND_INITD) $(DESTDIR)$(INITD_DIR)
+       $(INSTALL_PROG) $(XENDOMAINS_INITD) $(DESTDIR)$(INITD_DIR)
        $(INSTALL_PROG) $(XENDOMAINS_SYSCONFIG)
$(DESTDIR)$(SYSCONFIG_DIR)/xendomains
-       $(INSTALL_PROG) $(XENCOMMONS_INITD) $(DESTDIR)$(CONFIG_DIR)/init.d
+       $(INSTALL_PROG) $(XENCOMMONS_INITD) $(DESTDIR)$(INITD_DIR)
        $(INSTALL_PROG) $(XENCOMMONS_SYSCONFIG)
$(DESTDIR)$(SYSCONFIG_DIR)/xencommons
-       $(INSTALL_PROG) init.d/xen-watchdog $(DESTDIR)$(CONFIG_DIR)/init.d
+       $(INSTALL_PROG) init.d/xen-watchdog $(DESTDIR)$(INITD_DIR)

 .PHONY: install-scripts
 install-scripts:
Index: xen-unstable.hg/tools/hotplug/Linux/init.d/xen-watchdog
===================================================================
--- xen-unstable.hg.orig/tools/hotplug/Linux/init.d/xen-watchdog
 2010-09-15 10:14:31.000000000 -0700
+++ xen-unstable.hg/tools/hotplug/Linux/init.d/xen-watchdog
2010-09-16 09:35:49.000000000 -0700
@@ -18,7 +18,24 @@
 #

 # Source function library.
-. /etc/init.d/functions
+if [ -e  /etc/init.d/functions ] ; then
+    . /etc/init.d/functions
+elif [ -e /lib/lsb/init-functions ] ; then
+    . /lib/lsb/init-functions
+    success () {
+        log_success_msg $*
+    }
+    failure () {
+        log_failure_msg $*
+    }
+else
+    success () {
+        echo $*
+    }
+    failure () {
+        echo $*
+    }
+fi

 start() {
        local r
Index: xen-unstable.hg/Config.mk
===================================================================
--- xen-unstable.hg.orig/Config.mk      2010-09-16 09:47:02.000000000 -0700
+++ xen-unstable.hg/Config.mk   2010-09-16 09:48:58.000000000 -0700
@@ -31,6 +31,12 @@
 MANDIR      ?= $(SHAREDIR)/man
 BASH_COMPLETION_DIR ?= $(CONFIG_DIR)/bash_completion.d

+# These are the Red Hat settings.
+# See distro_mapping.txt for other options
+CONFIG_LEAF_DIR ?= sysconfig
+SUBSYS_DIR ?= /var/run/subsys
+INITD_DIR ?= /etc/rc.d/init.d
+
 ifneq ($(EXTRA_PREFIX),)
 EXTRA_INCLUDES += $(EXTRA_PREFIX)/include
 EXTRA_LIB += $(EXTRA_PREFIX)/$(LIBLEAFDIR)

Attachment: sysconfig-alias.patch
Description: Text Data

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>