Skip to contentSkip to conversation

Q: use vlan in container

DISCUSSION Libo Chen 2 participants 5 messages Nov 28, 2013 – Nov 30, 2013

lore
Share & tools
lore

Libo Chen

author
#0 lore 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?

#1 lore raw
Quoted 21 lines · Libo Chen

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

Quoted 10 lines
# 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

Should the proper fix be to fix this script so that it doesn't call ifdown recursively if $DI = $INTERFACE ?

Quoted 31 lines

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?

author
#2 lore raw
Quoted 33 lines · Serge Hallyn
Quoted 21 lines · Libo Chen

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

Quoted 10 lines
# 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
Quoted 2 lines

Should the proper fix be to fix this script so that it doesn't call ifdown recursively if $DI = $INTERFACE ?

Hi Serge,

yes, I had try this way before as below:

for DI in $DEP_IFACES; do
if [ "$DI" != "$INTERFACE" ] ; then
ifdown $DI -o $OPTIONS
fi
done

It works well, but I have no idea it is safe enough and no side effects?

Thanks,
Libo

Quoted 35 lines
Quoted 21 lines

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:

Quoted 11 lines
	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?

.

#3 lore raw
Quoted 41 lines · Libo Chen
Quoted 33 lines · Serge Hallyn
Quoted 21 lines · Libo Chen

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

Quoted 10 lines
# 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
Quoted 2 lines

Should the proper fix be to fix this script so that it doesn't call ifdown recursively if $DI = $INTERFACE ?

Hi Serge,

yes, I had try this way before as below:

Quoted 7 lines

for DI in $DEP_IFACES; do
if [ "$DI" != "$INTERFACE" ] ; then
ifdown $DI -o $OPTIONS
fi
done

It works well, but I have no idea it is safe enough and no side effects?

It's safe enough and should have no side effects itself. But I recommend you first look up how get_depending_ifaces() is implemented. That's where this really should be fixed, and if it turns out that the proper fix for *that* is in the kernel then that's ok.

-serge

author
#4 lore raw
Quoted 48 lines · Serge Hallyn
Quoted 47 lines · Libo Chen
Quoted 33 lines · Serge Hallyn
Quoted 21 lines · Libo Chen

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

Quoted 10 lines
# 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
Quoted 2 lines

Should the proper fix be to fix this script so that it doesn't call ifdown recursively if $DI = $INTERFACE ?

Hi Serge,

yes, I had try this way before as below:

for DI in $DEP_IFACES; do
if [ "$DI" != "$INTERFACE" ] ; then
ifdown $DI -o $OPTIONS
fi
done

Quoted 7 lines
Quoted 1 line

It works well, but I have no idea it is safe enough and no side effects?

It's safe enough and should have no side effects itself. But I recommend you first look up how get_depending_ifaces() is implemented. That's where this really should be fixed, and if it turns out that the proper fix for *that* is in the kernel then that's ok.

thank you for your suggestion.

Libo

Quoted 5 lines

-serge

.