yahoo-eng-team team mailing list archive
-
yahoo-eng-team team
-
Mailing list archive
-
Message #59384
[Bug 1646919] [NEW] reading from /sys/class/net/eth0/carriers raises IOError if interface is down
Public bug reported:
If an interface is "down", reading from several of the sysfs files for
that interface will return EINVAL, which causes Python to raise an
IOError like this:
Dec 02 18:11:09 citest.novalocal cloud-init[413]: [CLOUDINIT] util.py[DEBUG]: failed stage init-local
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/cloudinit/cmd/main.py", line 521, in status_wr
apper
ret = functor(name, args)
File "/usr/lib/python2.7/site-packages/cloudinit/cmd/main.py", line 265, in main_init
init.apply_network_config(bring_up=not args.local)
File "/usr/lib/python2.7/site-packages/cloudinit/stages.py", line 631, in apply_netwo
rk_config
netcfg, src = self._find_networking_config()
File "/usr/lib/python2.7/site-packages/cloudinit/stages.py", line 628, in _find_netwo
rking_config
return (net.generate_fallback_config(), "fallback")
File "/usr/lib/python2.7/site-packages/cloudinit/net/__init__.py", line 146, in gener
ate_fallback_config
carrier = int(sys_netdev_info(interface, 'carrier'))
File "/usr/lib/python2.7/site-packages/cloudinit/net/__init__.py", line 119, in sys_n
etdev_info
data = util.load_file(fname)
File "/usr/lib/python2.7/site-packages/cloudinit/util.py", line 1268, in load_file
pipe_in_out(ifh, ofh, chunk_cb=read_cb)
File "/usr/lib/python2.7/site-packages/cloudinit/util.py", line 1311, in pipe_in_out
data = in_fh.read(chunk_size)
IOError: [Errno 22] Invalid argument
The code calling sys_netdev_info should catch IOError as well as OSError.
A simple reproducer is:
# ip link set eth0 down
# cat /sys/class/net/eth0/carrier
cat: /sys/class/net/eth0/carrier: Invalid argument
** Affects: cloud-init
Importance: Undecided
Status: New
--
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to cloud-init.
https://bugs.launchpad.net/bugs/1646919
Title:
reading from /sys/class/net/eth0/carriers raises IOError if interface
is down
Status in cloud-init:
New
Bug description:
If an interface is "down", reading from several of the sysfs files for
that interface will return EINVAL, which causes Python to raise an
IOError like this:
Dec 02 18:11:09 citest.novalocal cloud-init[413]: [CLOUDINIT] util.py[DEBUG]: failed stage init-local
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/cloudinit/cmd/main.py", line 521, in status_wr
apper
ret = functor(name, args)
File "/usr/lib/python2.7/site-packages/cloudinit/cmd/main.py", line 265, in main_init
init.apply_network_config(bring_up=not args.local)
File "/usr/lib/python2.7/site-packages/cloudinit/stages.py", line 631, in apply_netwo
rk_config
netcfg, src = self._find_networking_config()
File "/usr/lib/python2.7/site-packages/cloudinit/stages.py", line 628, in _find_netwo
rking_config
return (net.generate_fallback_config(), "fallback")
File "/usr/lib/python2.7/site-packages/cloudinit/net/__init__.py", line 146, in gener
ate_fallback_config
carrier = int(sys_netdev_info(interface, 'carrier'))
File "/usr/lib/python2.7/site-packages/cloudinit/net/__init__.py", line 119, in sys_n
etdev_info
data = util.load_file(fname)
File "/usr/lib/python2.7/site-packages/cloudinit/util.py", line 1268, in load_file
pipe_in_out(ifh, ofh, chunk_cb=read_cb)
File "/usr/lib/python2.7/site-packages/cloudinit/util.py", line 1311, in pipe_in_out
data = in_fh.read(chunk_size)
IOError: [Errno 22] Invalid argument
The code calling sys_netdev_info should catch IOError as well as OSError.
A simple reproducer is:
# ip link set eth0 down
# cat /sys/class/net/eth0/carrier
cat: /sys/class/net/eth0/carrier: Invalid argument
To manage notifications about this bug go to:
https://bugs.launchpad.net/cloud-init/+bug/1646919/+subscriptions