All of lore.kernel.org
 help / color / mirror / Atom feed
From: Libo Chen <clbchenlibo.chen-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
To: containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
Cc: serge.hallyn-GeWIH/nMZzLQT0dZR+AlfA@public.gmane.org,
	LKML <linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	David Miller <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
Subject: Q: use vlan in container
Date: Thu, 28 Nov 2013 14:17:39 +0800	[thread overview]
Message-ID: <5296E003.80804@huawei.com> (raw)

Hello LXC experts,

	I meet a problem. When using vlan as network device in suse11 system container,
I can not use halt to stop this container. It hung on "eth0 is still used from interfaces eth0" in cycle.

The config file:

lxc.network.type = vlan
lxc.network.flags = up
lxc.network.link = eth0
lxc.network.name = eth0
lxc.network.vlan.id = 1301
lxc.network.ipv4 = 128.5.131.100/24


The reason is in the shell command /sbin/ifdown, see below:

######################################################################
# Shut down depending interfaces
#
# Check if there are interfaces which depend on this interface. If yes these
# have to be shut down first.
# For example these might be bonding or vlan interfaces. Note that we don't
# catch all types of depending interfaces currently. See function
# 'get_depending_ifaces' in file 'functions' for details.
#
test "$SCRIPTNAME" = ifdown && DEP_IFACES=`get_depending_ifaces $INTERFACE`
if [ "$?" = 0 -a "$NODEPS" != yes ] ; then
        message "`printf "    %-9s is still used from interfaces %s" \
                         $INTERFACE "$DEP_IFACES"`"
        for DI in $DEP_IFACES; do
                ifdown $DI -o $OPTIONS
        done

        message "`printf "    %-9s now going down itself" $INTERFACE`"
        # check if iface is (still) avaliable
        # [bonding master may go down itself
        #  while the last slave gets removed]
        if ! is_iface_available $INTERFACE; then
                exit $R_SUCCESS
        fi
fi


$DEP_IFACES is also eth0 in this scene, so ifdown will call ifdown again and again.

if we set lxc.network.name = eth1, it will be ok, so can we add a judgment to make
lxc.network.link and lxc.network.name are not equal in lxc-start command.

simple implement like:

	if [ lxc.network.type == vlan ] ; then
		if [ lxc.network.link == lxc.network.name ] ; then
			return false
		fi
	fi


Is it reasonable?  or any other way to achieve this?

WARNING: multiple messages have this Message-ID (diff)
From: Libo Chen <clbchenlibo.chen@huawei.com>
To: <containers@lists.linux-foundation.org>
Cc: <serge.hallyn@ubuntu.com>, LKML <linux-kernel@vger.kernel.org>,
	<gaofeng@cn.fujitsu.com>, David Miller <davem@davemloft.net>,
	Li Zefan <lizefan@huawei.com>,
	Huang Qiang <h.huangqiang@huawei.com>,
	Wengmeiling <wengmeiling.weng@huawei.com>
Subject: Q: use vlan in container
Date: Thu, 28 Nov 2013 14:17:39 +0800	[thread overview]
Message-ID: <5296E003.80804@huawei.com> (raw)

Hello LXC experts,

	I meet a problem. When using vlan as network device in suse11 system container,
I can not use halt to stop this container. It hung on "eth0 is still used from interfaces eth0" in cycle.

The config file:

lxc.network.type = vlan
lxc.network.flags = up
lxc.network.link = eth0
lxc.network.name = eth0
lxc.network.vlan.id = 1301
lxc.network.ipv4 = 128.5.131.100/24


The reason is in the shell command /sbin/ifdown, see below:

######################################################################
# Shut down depending interfaces
#
# Check if there are interfaces which depend on this interface. If yes these
# have to be shut down first.
# For example these might be bonding or vlan interfaces. Note that we don't
# catch all types of depending interfaces currently. See function
# 'get_depending_ifaces' in file 'functions' for details.
#
test "$SCRIPTNAME" = ifdown && DEP_IFACES=`get_depending_ifaces $INTERFACE`
if [ "$?" = 0 -a "$NODEPS" != yes ] ; then
        message "`printf "    %-9s is still used from interfaces %s" \
                         $INTERFACE "$DEP_IFACES"`"
        for DI in $DEP_IFACES; do
                ifdown $DI -o $OPTIONS
        done

        message "`printf "    %-9s now going down itself" $INTERFACE`"
        # check if iface is (still) avaliable
        # [bonding master may go down itself
        #  while the last slave gets removed]
        if ! is_iface_available $INTERFACE; then
                exit $R_SUCCESS
        fi
fi


$DEP_IFACES is also eth0 in this scene, so ifdown will call ifdown again and again.

if we set lxc.network.name = eth1, it will be ok, so can we add a judgment to make
lxc.network.link and lxc.network.name are not equal in lxc-start command.

simple implement like:

	if [ lxc.network.type == vlan ] ; then
		if [ lxc.network.link == lxc.network.name ] ; then
			return false
		fi
	fi


Is it reasonable?  or any other way to achieve this?




             reply	other threads:[~2013-11-28  6:17 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-28  6:17 Libo Chen [this message]
2013-11-28  6:17 ` Q: use vlan in container Libo Chen
     [not found] ` <5296E003.80804-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2013-11-29  5:05   ` Serge Hallyn
2013-11-29  5:05     ` Serge Hallyn
2013-11-29  6:40     ` Libo Chen
2013-11-29  6:40       ` Libo Chen
     [not found]       ` <529836CD.1080900-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2013-11-29 14:18         ` Serge Hallyn
2013-11-29 14:18           ` Serge Hallyn
2013-11-30  1:46           ` Libo Chen
2013-11-30  1:46             ` Libo Chen

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=5296E003.80804@huawei.com \
    --to=clbchenlibo.chen-hv44wf8li93qt0dzr+alfa@public.gmane.org \
    --cc=containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
    --cc=davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=serge.hallyn-GeWIH/nMZzLQT0dZR+AlfA@public.gmane.org \
    /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.