Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

T6764: Fix unhandled exception on ethtool output parsing for Xen NICs #4182

Merged
merged 1 commit into from
Nov 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions python/vyos/ethtool.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
# flow control settings
_drivers_without_speed_duplex_flow = ['vmxnet3', 'virtio_net', 'xen_netfront',
'iavf', 'ice', 'i40e', 'hv_netvsc', 'veth', 'ixgbevf',
'tun']
'tun', 'vif']

class Ethtool:
"""
Expand Down Expand Up @@ -101,8 +101,9 @@ def __init__(self, ifname):
self._features = loads(out)[0]

# Get information about NIC ring buffers
out, _ = popen(f'ethtool --json --show-ring {ifname}')
self._ring_buffer = loads(out)[0]
out, err = popen(f'ethtool --json --show-ring {ifname}')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My only concern here: can we differentiate between an expected failure for Xen NICs and similar and an unexpected failure where --show-ring is supposed to work? This approach may hide bugs.

I'm not against merging it as an immediate fix.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It depends on what is "error" from our point of view:

  • unexpected ethtool output
  • a feature is not supported by a NIC
  • both

I have an internal feeling that for our purposes a reason why it failed does not matter, but input from someone deeply familiar with interface config logic is welcomed.

if not bool(err):
self._ring_buffer = loads(out)[0]

# Get current flow control settings, but this is not supported by
# all NICs (e.g. vmxnet3 does not support is)
Expand Down
Loading