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

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


  • To: Sander Eikelenboom <linux@xxxxxxxxxxxxxx>
  • From: Bruce Edge <bruce.edge@xxxxxxxxx>
  • Date: Tue, 14 Sep 2010 07:18:34 -0700
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>, Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
  • Delivery-date: Tue, 14 Sep 2010 07:19:22 -0700
  • 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:content-transfer-encoding; b=FT1vq1yUUPlJWdj261ICjckp9S+u6cIa8IoHcJBetInnd78tL+fWIqBYfDFERKppwh /VQjBEcRBvR1fTAnPNQ0i5C7RavUIXgG4QyYhDlmbX/echWk3NsuCS/ms4NvGh5urZLx F9y8TBHl7KbnpLilcKk6B1BWdIWli1EaggHNg=
  • List-id: Xen developer discussion <xen-devel.lists.xensource.com>

On Mon, Sep 13, 2010 at 11:45 PM, Sander Eikelenboom
<linux@xxxxxxxxxxxxxx> wrote:
> Hello Bruce,
>
> I think it would be wise to call the string "debian" instead of "default".
> Since unset is "THE default", and with the string "default" you can specify 
> two kinds of default with complete other behavior which could cause confusion.
>
> --
>
> Sander


Makes sense. I went with "default" as that's the string that replaces
sysconfig, but you're reasoning is sound. I'll replace the option with
debian.

-Bruce




>
> Tuesday, September 14, 2010, 1:53:39 AM, you wrote:
>
>> 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
>
>
>
> --
> Best regards,
>  Sander                            mailto:linux@xxxxxxxxxxxxxx
>
>

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


 


Rackspace

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