All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bruce Edge <bruce.edge@gmail.com>
To: Sander Eikelenboom <linux@eikelenboom.it>
Cc: "xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>,
	Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Subject: Re: [patch] Xen build - Debian vs Redhat layout patch options
Date: Tue, 14 Sep 2010 07:18:34 -0700	[thread overview]
Message-ID: <AANLkTi=cVuU5Pxkj_z94GeioMBQcgT+kF3BoaXSF2mw7@mail.gmail.com> (raw)
In-Reply-To: <1556665822.20100914084545@eikelenboom.it>

On Mon, Sep 13, 2010 at 11:45 PM, Sander Eikelenboom
<linux@eikelenboom.it> 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@eu.citrix.com> 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@gmail.com>
>
>> Signed-off-by: Bruce Edge <bruce.edge@gmail.com>
>
>> 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@eikelenboom.it
>
>

  reply	other threads:[~2010-09-14 14:18 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-07  0:07 Xen build - Debian vs Redhat layout patch options Bruce Edge
2010-07-07 11:19 ` Stefano Stabellini
2010-09-13 23:53   ` [patch] " Bruce Edge
2010-09-14  0:23     ` Mike Viau
2010-09-14  6:45     ` Sander Eikelenboom
2010-09-14 14:18       ` Bruce Edge [this message]
2010-09-14 14:31     ` Olaf Hering
2010-09-14 17:05     ` Ian Jackson
2010-09-14 17:13       ` Bruce Edge
2010-09-14 18:56       ` Bruce Edge
2010-09-15 10:03         ` Ian Jackson
2010-09-15 16:06           ` Bruce Edge
2010-09-15 16:16             ` Olaf Hering
2010-09-16 16:29             ` Ian Jackson
2010-09-16 18:52               ` Bruce Edge
2010-09-16 20:45                 ` Olaf Hering
2010-09-16 20:56                   ` Bruce Edge
2010-09-16 20:59                     ` Olaf Hering
2010-09-16 21:02                       ` Bruce Edge
2010-09-17 16:11                         ` Ian Jackson
2010-09-17 17:05                           ` Bruce Edge
2010-09-17 17:52                             ` Ian Jackson
2010-09-17 18:13                               ` Bruce Edge
2010-09-16 20:24               ` Dan Magenheimer
2010-09-16 20:34                 ` Dan Magenheimer
2010-09-17 15:01               ` [patch] Xen build - Debian vs Redhat layout patch options [and 1 more messages] Ian Jackson
     [not found]   ` <AANLkTim48T7Y3Pq0_nS1zZ5jWH_kXrS8JceWLf-yUOM6@mail.gmail.com>
2011-01-04 21:09     ` Xen build - Debian vs Redhat layout patch options user virtual
2011-01-06 15:02       ` Stefano Stabellini
2011-01-11 17:37       ` Ian Jackson
2011-01-20 13:45         ` user virtual
     [not found]           ` <AANLkTimCA_T1QsfCVfABtW8776Mkg3toBtmHYHgea56=@mail.gmail.com>
2011-01-19 22:34             ` xen-unstable: ImportError: No module named xen.xm chris
2011-01-20  8:38               ` Ian Campbell
2011-01-20 16:49                 ` [Xen-devel] " chris
2011-01-20 16:54                   ` Ian Campbell
2011-01-20 17:23                     ` chris
2011-01-20 17:38                       ` Ian Campbell
2011-01-21 18:20                         ` [Xen-users] " Mike Viau
2011-01-21 19:16                           ` Ian Jackson
2011-01-26 14:51                           ` Re: [Xen-devel] " Ian Jackson
2011-01-26 17:32                             ` Mike Viau
     [not found]                 ` <m2n.s.1PfxnK-153952@chiark.greenend.org.uk>
2011-01-20 18:19                   ` Ian Jackson
2011-01-20 18:35                     ` chris
2011-01-21 18:59                       ` [Xen-devel] Re: xen-unstable: ImportError: No module named xen.xm [and 1 more messages] Ian Jackson
2011-01-21 15:30           ` Xen build - Debian vs Redhat layout patch options user virtual
2011-01-21 17:28             ` Bruce Edge
2011-01-21 18:42               ` Ian Jackson
2011-07-13 13:41                 ` User Virtual
2011-01-21 17:29             ` Stefano Stabellini
2011-01-21 18:40               ` Ian Jackson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='AANLkTi=cVuU5Pxkj_z94GeioMBQcgT+kF3BoaXSF2mw7@mail.gmail.com' \
    --to=bruce.edge@gmail.com \
    --cc=linux@eikelenboom.it \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.