Traceback when checking linkspeed for some interface types

Bug #1990481 reported by Frode Nordahl
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
charm-magpie
Fix Committed
Medium
Unassigned

Bug Description

2022-09-22 06:33:29 ERROR unit.magpie/0.juju-log server.go:316 magpie:0: Hook error:
Traceback (most recent call last):
  File "/var/lib/juju/agents/unit-magpie-0/.venv/lib/python3.8/site-packages/charms/reactive/__init__.py", line 74, in main
    bus.dispatch(restricted=restricted_mode)
  File "/var/lib/juju/agents/unit-magpie-0/.venv/lib/python3.8/site-packages/charms/reactive/bus.py", line 390, in dispatch
    _invoke(other_handlers)
  File "/var/lib/juju/agents/unit-magpie-0/.venv/lib/python3.8/site-packages/charms/reactive/bus.py", line 359, in _invoke
    handler.invoke()
  File "/var/lib/juju/agents/unit-magpie-0/.venv/lib/python3.8/site-packages/charms/reactive/bus.py", line 181, in invoke
    self._action(*args)
  File "/var/lib/juju/agents/unit-magpie-0/charm/reactive/magpie.py", line 135, in check_all_node
    _set_states(check_nodes(nodes))
  File "/var/lib/juju/agents/unit-magpie-0/charm/lib/charms/layer/magpie_tools.py", line 623, in check_nodes
    link_speed = get_link_speed(primary_iface)
  File "/var/lib/juju/agents/unit-magpie-0/charm/lib/charms/layer/magpie_tools.py", line 609, in get_link_speed
    return int(f.read())
OSError: [Errno 22] Invalid argument

And sure enough:
$ cat /sys/class/net/br-enp5s0/speed
cat: /sys/class/net/br-enp5s0/speed: Invalid argument

The charm code should probably be updated to gracefully handle this situation.

Frode Nordahl (fnordahl)
Changed in charm-magpie:
status: New → Triaged
importance: Undecided → Medium
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to charm-magpie (master)
Changed in charm-magpie:
status: Triaged → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to charm-magpie (master)

Reviewed: https://review.opendev.org/c/openstack/charm-magpie/+/858862
Committed: https://opendev.org/openstack/charm-magpie/commit/921ea2d4520364aa2386fdecd6f94368c96e4855
Submitter: "Zuul (22348)"
Branch: master

commit 921ea2d4520364aa2386fdecd6f94368c96e4855
Author: Frode Nordahl <email address hidden>
Date: Thu Sep 22 10:27:15 2022 +0200

    Gracefully handle Invalid argument from /sys/.../speed

    Not all interfaces support retrieval of link speed through sysfs,
    gracefully handle those that don't.

    Closes-Bug: #1990481
    Change-Id: I2f43cd67bab52704c80da569912b7770f4c1877b

Changed in charm-magpie:
status: In Progress → Fix Committed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.