networkop / docker-topo

Docker topology builder for network simulations
BSD 3-Clause "New" or "Revised" License
139 stars 41 forks source link

OSError: [Errno 22] failed to open netns using veth interfaces (Fedora 18 host) #28

Open wwade opened 5 years ago

wwade commented 5 years ago

I'm using the topo-extra-files/examples/v2/3-node.ymlsample file. The host is Fedora 18 with a 4.9.76 kernel. I can use the bridge driver to get around this issue for now, it seems.

Here's the last part of docker-topo --debug --create topo-extra-files/examples/v2/3-node.yml

DEBUG:__main__: Attaching container 3-node_cEOS-1 interface eth1 to its link
DEBUG:__main__: Connecting veth-type link to 3-node_cEOS-1
DEBUG:__main__:Connecting 3-node_net-1-a to 3-node_cEOS-1
DEBUG:__main__:Create an interface for container 3-node_cEOS-1: {'ifname': 'eth1', 'stats': None, 'protinfo': None, 'map': None, 'linkinfo': None, 'stats64': None, 'af_spec': None, 'net_ns_fd': 30, 'event': None, 'flags': 4099, '-ports': set(), '+ports': set(), '-ipaddr': set(), '+ipaddr': set(), '-vlans': set(), '+vlans': set()}
Traceback (most recent call last):
  File "/home/wade/ceos/docker-topo/testdir/bin/docker-topo", line 840, in <module>
    main()
  File "/home/wade/ceos/docker-topo/testdir/bin/docker-topo", line 775, in main
    started = [device.start() == 0 for (name, device) in devices.items()]
  File "/home/wade/ceos/docker-topo/testdir/bin/docker-topo", line 775, in <listcomp>
    started = [device.start() == 0 for (name, device) in devices.items()]
  File "/home/wade/ceos/docker-topo/testdir/bin/docker-topo", line 354, in start
    self._attach()
  File "/home/wade/ceos/docker-topo/testdir/bin/docker-topo", line 371, in _attach
    link.connect(self, interface)
  File "/home/wade/ceos/docker-topo/testdir/bin/docker-topo", line 659, in connect
    self.network.connect(device, interface)
  File "/home/wade/ceos/docker-topo/testdir/bin/docker-topo", line 601, in connect
    with IPDB(nl=NetNS(ns_name)) as ns:
  File "/home/wade/ceos/docker-topo/testdir/lib/python3.7/site-packages/pyroute2/netns/nslink.py", line 170, in __init__
    super(NetNS, self).__init__(trnsp_in, trnsp_out)
  File "/home/wade/ceos/docker-topo/testdir/lib/python3.7/site-packages/pyroute2/iproute/linux.py", line 127, in __init__
    super(RTNL_API, self).__init__(*argv, **kwarg)
  File "/home/wade/ceos/docker-topo/testdir/lib/python3.7/site-packages/pyroute2/remote/__init__.py", line 200, in __init__
    raise init['error']
OSError: [Errno 22] failed to open netns: 'e5df19bfe142'

Full log: debug.txt

I also confirmed that e5df19bfe142 existed as /var/run/docker/netns/e5df19bfe142

networkop commented 5 years ago

docker-topo use pyroute2 underneath to talk to netlink api. this seems like an issue with pyroute2. Just to confirm, is this 32-bit x86 Fedora 18? and have you tried running the same as sudo ? there seems to be an opened issue which looks a bit similar.

wwade commented 5 years ago

Hmm, I'd also looked at that thread earlier, and so tried running it with/without sudo. This is 64-bit Fedora 18.

I just tried the repro steps they provided and that test was OK:

(testdir) [wade@us116 config]$ sudo ip netns add test
(testdir) [wade@us116 config]$ sudo python3 rep.py
<pyroute2.ipdb.main.IPDB object at 0x7fd2d9fc36d8>

Perhaps it's something specific to the docker installation / version, then. Thanks for having a look.