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: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
Subject: Re: [Xen-devel] [patch] Xen build - Debian vs Redhat layout patch options
From: Bruce Edge <bruce.edge@xxxxxxxxx>
Date: Mon, 13 Sep 2010 16:53:39 -0700
Cc: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Mon, 13 Sep 2010 16:54:21 -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=QOOqOJWsl/EcTJ0PrVvSLnBvnERmXeL2q+6G22n4+i4=; b=N1KMmyPsW90IZMWZBMhs4EV9YbhQI1R25PukVzY5YGx1VeoKT5Q6txCYizsqbb5WdA wreQeJ96tEH640CT/45Aq74TlrOXrcPXFv+LlR5xMuJq8MAyFBCuzi4V+Me4Uedi4AOT LsEHSWyg6+Q05LHJjqrUhLGDIKrJ/+JKjMV1U=
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=TMymjOaRSd82aUa3s+6sLaycTMrNXt50vo3esTUlzhNFjrYFzgsNY2hs5Xjlb5lN8s /7j6W3Kv9jSs9ORb27o+VlBWrrSAXHJHSMxitG+XG2cO13jjh2RfDuZWEXYLF+LtcwPH JgHMK1pL+/348tWblzK6Jc/2hacic/X2FEF5M=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <alpine.DEB.2.00.1007071207480.17029@kaball-desktop>
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>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
On Wed, Jul 7, 2010 at 4:19 AM, Stefano Stabellini
<stefano.stabellini@xxxxxxxxxxxxx> wrote:
> On Wed, 7 Jul 2010, Bruce Edge wrote:
>> What's the right way to address these sort RedHat vs. Debian things in the 
>> Xen build?
>>
>> - rm -f  $(D)$(CONFIG_DIR)/sysconfig/xendomains
>> + rm -f  $(D)$(CONFIG_DIR)/default/xendomains
>>
>> - mkdir -p /var/lock/subsys
>> - touch /var/lock/subsys/xend
>> + mkdir -p /var/lock
>> + touch /var/lock/xend
>>
>> Can I submit a patch that uses a config var to switch on which path use ?
>>
>> Or, where should such a build time switch go? Env, or?
>> ...assuming that it's even an option.
>>
>> There's a couple of different downstream patches that others are maintaining 
>> to handle this kind of stuff, but that lag
>> behind the xen-unstable tree and it seems like an upstream patch to handle 
>> this distro variation in the Xen build itself
>> would be a better long term solution.
>>
>
> A way to switch between the two would be nice, I would accept a patch
> that accomplish that using a config var (something in Config.mk ?.
> The default value of this config variable might be detected looking at
> the existence of /etc/sysconfig or /etc/default.
>
> Keep in mind that besides sysconfig vs. default there are other subtle
> differences, like the chkconfig line in the init scripts
> (tools/hotplug/Linux/init.d/xencommons for example).
>

Here's my attempt at the above. It defaults to the current behavior
with the debian option being an env setting.

========================== cut =====================
There are 2 locations that are not optimal for Debian based distributions.
These are /etc/sysconfig, and /var/subsys.
Debian uses /etc/default and /var for these respectively.
This patch provides a new make config variable, XEN_CONFIG_ARCH, which
changes the location of these 2 elements if set.
If unset it defaults to the current behavior, but if set to the string
"default", it uses the Debian locations.
For the runtime scripts it checks whether the Red Hat sysconfig files
exist first, then looks in the Debian location.
This lets the config files reside in the desired location and does not
require any additional runtime config file
to point to their location.
This patch also adds a sysconfig.txt file describing the build time usage.
Author: Bruce Edge <bruce.edge@xxxxxxxxx>

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

Index: xen-unstable.hg/Config.mk
===================================================================
--- xen-unstable.hg.orig/Config.mk      2010-09-13 10:44:48.000000000 -0700
+++ xen-unstable.hg/Config.mk   2010-09-13 10:45:11.000000000 -0700
@@ -8,6 +8,9 @@
 XEN_TARGET_ARCH     ?= $(XEN_COMPILE_ARCH)
 XEN_OS              ?= $(shell uname -s)

+# Override for debian based systems that use /etc instead of /etc/sysconfig
+XEN_CONFIG_ARCH     ?= /sysconfig
+
 CONFIG_$(XEN_OS) := y

 SHELL     ?= /bin/sh
Index: xen-unstable.hg/config/StdGNU.mk
===================================================================
--- xen-unstable.hg.orig/config/StdGNU.mk       2010-09-13
10:44:48.000000000 -0700
+++ xen-unstable.hg/config/StdGNU.mk    2010-09-13 10:45:11.000000000 -0700
@@ -49,7 +49,7 @@
 CONFIG_DIR = $(PREFIX)/etc
 endif

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

 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-13 10:44:48.000000000 -0700
+++ xen-unstable.hg/Makefile    2010-09-13 10:45:11.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/network_setup.txt
===================================================================
--- xen-unstable.hg.orig/docs/misc/network_setup.txt    2010-09-13
10:44:48.000000000 -0700
+++ xen-unstable.hg/docs/misc/network_setup.txt 2010-09-13
10:45:11.000000000 -0700
@@ -44,7 +44,7 @@
 Creating network initscripts
 ----------------------------

-In the /etc/sysconfig/network-scripts directory it is necccessary to create
+In the <SYSCONFIG>/network-scripts directory it is necccessary to create
 2 config files. The first (ifcfg-eth0) defines your physical network interface,
 and says that it will be part of a bridge:

@@ -79,8 +79,8 @@
 The final step is to configure iptables to allow all traffic to be
 forwarded across the bridge

-# echo "-I FORWARD -m physdev --physdev-is-bridged -j ACCEPT" >
/etc/sysconfig/iptables-forward-bridged
-# lokkit --custom-rules=ipv4:filter:/etc/sysconfig/iptables-forward-bridged
+# echo "-I FORWARD -m physdev --physdev-is-bridged -j ACCEPT" >
<SYSCONFIG>/iptables-forward-bridged
+# lokkit --custom-rules=ipv4:filter:<SYSCONFIG>/iptables-forward-bridged
 # service libvirtd reload

 Alternatively, you can prevent bridged traffic getting pushed through
Index: xen-unstable.hg/docs/misc/sysconfig.txt
===================================================================
--- /dev/null   1970-01-01 00:00:00.000000000 +0000
+++ xen-unstable.hg/docs/misc/sysconfig.txt     2010-09-13
10:45:11.000000000 -0700
@@ -0,0 +1,14 @@
+This describes the use of the <SYSCONFIG> and <SUBSYS> variables.
+
+Red hat and most other RPM based distros use /etc/sysconfig for
configuration data.
+
+Debian and other derivative distros use /etc/default for this same data.
+
+The same applies to /var/subsys and /var. Red Hat uses the former and
Debian the latter.
+
+These differences are handled by the XEN_CONFIG_ARCH build time
variable. The default is for the Red Hat configuration. Debian and
other derivatives need to set this variable to "default" in the build
shell's environment.
+
+eg:
+
+XEN_CONFIG_ARCH="" make dist
+
Index: xen-unstable.hg/tools/vnet/doc/vnet-xend.txt
===================================================================
--- xen-unstable.hg.orig/tools/vnet/doc/vnet-xend.txt   2010-09-13
10:44:49.000000000 -0700
+++ xen-unstable.hg/tools/vnet/doc/vnet-xend.txt        2010-09-13
10:45:11.000000000 -0700
@@ -79,8 +79,8 @@

 MTU=1400

-in /etc/sysconfig/network-scripts/ifcfg-eth0. You may also have to
change or remove
-cached config files for eth0 under /etc/sysconfig/networking.
+in <SYSCONFIG>/network-scripts/ifcfg-eth0. You may also have to
change or remove
+cached config files for eth0 under <SYSCONFIG>/networking.

 Once configured, vnets are persistent in the xend database.
 To remove a vnet use
Index: xen-unstable.hg/tools/xenballoon/xenballoond.init
===================================================================
--- xen-unstable.hg.orig/tools/xenballoon/xenballoond.init
2010-09-13 10:44:49.000000000 -0700
+++ xen-unstable.hg/tools/xenballoon/xenballoond.init   2010-09-13
10:45:11.000000000 -0700
@@ -29,6 +29,10 @@

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

 # Check that balloon driver is present
Index: xen-unstable.hg/tools/xenballoon/xenballoond
===================================================================
--- xen-unstable.hg.orig/tools/xenballoon/xenballoond   2010-09-13
10:44:49.000000000 -0700
+++ xen-unstable.hg/tools/xenballoon/xenballoond        2010-09-13
10:45:11.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,13 @@
 fi
 preswapnow=0

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

 while true;
 do
Index: xen-unstable.hg/tools/xenballoon/xenballoond.README
===================================================================
--- xen-unstable.hg.orig/tools/xenballoon/xenballoond.README
2010-09-13 10:44:49.000000000 -0700
+++ xen-unstable.hg/tools/xenballoon/xenballoond.README 2010-09-13
10:45:11.000000000 -0700
@@ -59,10 +59,10 @@
 Instructions to install/deploy xenballoond (in Redhat-based system):
 - 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
+  - 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")
Index: xen-unstable.hg/tools/hotplug/Linux/init.d/xendomains
===================================================================
--- xen-unstable.hg.orig/tools/hotplug/Linux/init.d/xendomains
2010-09-13 10:44:48.000000000 -0700
+++ xen-unstable.hg/tools/hotplug/Linux/init.d/xendomains
2010-09-13 10:45:11.000000000 -0700
@@ -46,9 +46,13 @@
        exit 0
 fi

-LOCKFILE=/var/lock/subsys/xendomains
-XENDOM_CONFIG=/etc/sysconfig/xendomains
-
+if [ -d /etc/sysconfig ]; then
+       LOCKFILE=/var/lock/subsys/xendomains
+       XENDOM_CONFIG=/etc/sysconfig/xendomains
+else
+       LOCKFILE=/var/lock/xendomains
+       XENDOM_CONFIG=/etc/default/xendomains
+fi
 test -r $XENDOM_CONFIG || { echo "$XENDOM_CONFIG not existing";
        if [ "$1" = "stop" ]; then exit 0;
        else exit 6; fi; }
Index: xen-unstable.hg/tools/hotplug/Linux/init.d/xend
===================================================================
--- xen-unstable.hg.orig/tools/hotplug/Linux/init.d/xend
2010-09-13 13:53:19.000000000 -0700
+++ xen-unstable.hg/tools/hotplug/Linux/init.d/xend     2010-09-13
13:56:52.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.
+       # This makes it Red Had/Debian agnostic
+       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

Attachment: sysconfig-alias.patch
Description: Text Data

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel