Comment 7 for bug 1065589

Revision history for this message
Serge Hallyn (serge-hallyn) wrote :

Running 'udevadm monitor' while starting and stopping a container gives:

KERNEL[17237.641503] add /devices/virtual/net/veth7t59jJ (net)
KERNEL[17237.644300] add /devices/virtual/net/veth7t59jJ/queues/rx-0 (queues)
KERNEL[17237.644577] add /devices/virtual/net/veth7t59jJ/queues/tx-0 (queues)
KERNEL[17237.644855] add /devices/virtual/net/vethoLdAjv (net)
KERNEL[17237.644906] add /devices/virtual/net/vethoLdAjv/queues/rx-0 (queues)
KERNEL[17237.644934] add /devices/virtual/net/vethoLdAjv/queues/tx-0 (queues)
KERNEL[17237.649498] add /kernel/slab/nf_conntrack_ffff88007a720000 (slab)
KERNEL[17237.652309] add /devices/virtual/net/lo/queues/rx-0 (queues)
KERNEL[17237.652348] add /devices/virtual/net/lo/queues/tx-0 (queues)
UDEV [17237.657166] add /devices/virtual/net/lo/queues/tx-0 (queues)
UDEV [17237.659337] add /devices/virtual/net/lo/queues/rx-0 (queues)
UDEV [17237.659652] add /kernel/slab/nf_conntrack_ffff88007a720000 (slab)
UDEV [17237.679686] add /devices/virtual/net/veth7t59jJ (net)
UDEV [17237.680836] add /devices/virtual/net/veth7t59jJ/queues/rx-0 (queues)
UDEV [17237.681041] add /devices/virtual/net/veth7t59jJ/queues/tx-0 (queues)
UDEV [17237.698158] add /devices/virtual/net/vethoLdAjv (net)
UDEV [17237.699761] add /devices/virtual/net/vethoLdAjv/queues/rx-0 (queues)
UDEV [17237.699948] add /devices/virtual/net/vethoLdAjv/queues/tx-0 (queues)
KERNEL[17244.427892] remove /devices/virtual/net/eth0/queues/rx-0 (queues)
UDEV [17244.429127] remove /devices/virtual/net/eth0/queues/rx-0 (queues)
KERNEL[17244.429466] remove /devices/virtual/net/eth0/queues/tx-0 (queues)
UDEV [17244.429918] remove /devices/virtual/net/eth0/queues/tx-0 (queues)
KERNEL[17244.431075] remove /devices/virtual/net/vethoLdAjv/queues/rx-0 (queues)
UDEV [17244.431564] remove /devices/virtual/net/vethoLdAjv/queues/rx-0 (queues)
KERNEL[17244.432570] remove /devices/virtual/net/vethoLdAjv/queues/tx-0 (queues)
UDEV [17244.433942] remove /devices/virtual/net/vethoLdAjv/queues/tx-0 (queues)
KERNEL[17244.435509] remove /devices/virtual/net/vethoLdAjv (net)
UDEV [17244.436596] remove /devices/virtual/net/vethoLdAjv (net)
KERNEL[17244.440529] remove /devices/virtual/net/lo/queues/rx-0 (queues)
UDEV [17244.440979] remove /devices/virtual/net/lo/queues/rx-0 (queues)
KERNEL[17244.441098] remove /devices/virtual/net/lo/queues/tx-0 (queues)
UDEV [17244.441492] remove /devices/virtual/net/lo/queues/tx-0 (queues)
KERNEL[17244.706760] remove /kernel/slab/nf_conntrack_ffff88007a720000 (slab)
UDEV [17244.707342] remove /kernel/slab/nf_conntrack_ffff88007a720000 (slab)

Note that while vethoLdAjv has both kernel and udev add and remove, veth7t59jJ
has only the add messages.

My previous comment is likely wrong, because the *renamed* veth7t59jJ (eth0
in the container namespace) does have remove messages, and no add messages.
(My point here being that since we see those messages, for an eth0 in another
network namespace, then we should also be seeing the messages for a veth7t59jJ
while being moved to a new netns if those were being sent - the virtual 'eth0'
does not have a /sys/class/net entry in the initial network namespace either)
Therefore it seems most likely that the kernel is not actually sending the
remove/add messages when a netdev is moved to a new namespace, nor giving
hints when the netdev is renamed (which lxc does after moving it to a new
namespace, obviously, to prevent name conflicts with 'eth0').

SO - lxc could finagle this by emitting upstart signals at
src/lxc/conf.c:lxc_assign_network() or
src/lxc/network.c:lxc_network_move_by_index(), but first it's worth considering
whether the kernel should be sending signals.