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

Conversation

sever-sever
Copy link
Member

@sever-sever sever-sever commented Nov 5, 2024

Change Summary

Not all NICs could provide ring-buffers info requested by ethtool in JSON format
For example 'vif' Xen/XCP-NG interfaces
Fix it

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes)
  • Migration from an old Vyatta component to vyos-1x, please link to related PR inside obsoleted component
  • Other (please describe):

Related Task(s)

Related PR(s)

Component(s) name

ethtool

Proposed changes

How to test

XEN/XCP-ng vif before the fix:

Traceback (most recent call last):
  File "/usr/libexec/vyos/conf_mode/interfaces_ethernet.py", line 354, in <module>
    verify(c)
  File "/usr/libexec/vyos/conf_mode/interfaces_ethernet.py", line 274, in verify
    verify_ethernet(ethernet)
  File "/usr/libexec/vyos/conf_mode/interfaces_ethernet.py", line 310, in verify_ethernet
    ethtool = Ethtool(ifname)
              ^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/vyos/ethtool.py", line 105, in __init__
    self._ring_buffer = loads(out)[0]
                        ~~~~~~~~~~^^^
IndexError: list index out of range

After the fix configuration applies without errors

Smoketest result

Checklist:

  • I have read the CONTRIBUTING document
  • I have linked this PR to one or more Phabricator Task(s)
  • I have run the components SMOKETESTS if applicable
  • My commit headlines contain a valid Task id
  • My change requires a change to the documentation
  • I have updated the documentation accordingly

Copy link

github-actions bot commented Nov 5, 2024

👍
No issues in PR Title / Commit Title

@dmbaturin dmbaturin changed the title T6764: Ethtool not all NICs can show ring-buffers T6764: Fix unhandled exception on ethtool output parsing for Xen NICs Nov 5, 2024
@@ -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.

Not all NICs could provide ring-buffers info requested by ethtool
in JSON format
For example 'vif' Xen/XCP-NG interfaces
Fix it
Copy link

github-actions bot commented Nov 5, 2024

CI integration 👍 passed!

Details

CI logs

  • CLI Smoketests (no interfaces) 👍 passed
  • CLI Smoketests (interfaces only) 👍 passed
  • Config tests 👍 passed
  • RAID1 tests 👍 passed
  • TPM tests 👍 passed

@sever-sever sever-sever merged commit 09ca8e2 into vyos:current Nov 5, 2024
15 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

4 participants