[lxc-devel] lxc 2.0.x on openSUSE: config file lxc-net ends up in the wrong place

Johannes Kastl mail at ojkastl.de
Fri Mar 18 13:14:26 UTC 2016


Hi all,

I just noticed that on new installs lxc 2.0.0.rc10 does not properly
config its lxcbr0 on openSUSE machines.

The reason is that /usr/lib/lxc/lxc-net searches in
/etc/default/lxc-net for the config, which is put in the directory
/etc/sysconfig/lxc-net during installation.

############### config/init/common/lxc-net.in ###############
#!/bin/sh



distrosysconfdir="@LXC_DISTRO_SYSCONF@"
varrun="@RUNTIME_PATH@/lxc"
varlib="@LOCALSTATEDIR@/lib"

# These can be overridden in @LXC_DISTRO_SYSCONF@/lxc


#   or in @LXC_DISTRO_SYSCONF@/lxc-net
[...]
#############################################

While the path in lxc-net.in is a variable set during configure, the
path to the lxc-net config is hardcoded in the spec:

############### lxc.spec.in ###############
%post
# This test should trigger a network configure on a new install.


if [ ! -f %{_sysconfdir}/sysconfig/lxc-net ] || ! grep -q
'USE_LXC_BRIDGE=' %{_sysconfdir}/sysconfig/lxc-net
then
        # Grab a random 10net subnet.  Need to add test logic...


        while [ true ]
        do
                SUBNET=10.$(($RANDOM % 256)).$(($RANDOM % 256))
                if ! ip -4 route ls | grep -q "^$SUBNET"
                then
                        break
                fi
        done

        cat >  %{_sysconfdir}/sysconfig/lxc-net <<EOF
#############################################

How to solve it? Patching the spec with an %if statement is a
workaround, but I'm not sure if this is a proper long term solution...

Is there a rpm macro for the /etc/default vs. /etc/sysconfig/ directories?

Kind regards,
Johannes

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 244 bytes
Desc: OpenPGP digital signature
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20160318/d1fdd0c5/attachment.sig>


More information about the lxc-devel mailing list