From 09ca8e2a01fcef509d6f39e0abbe7a65fa1eb5b8 Mon Sep 17 00:00:00 2001 From: Viacheslav Hletenko Date: Tue, 5 Nov 2024 20:25:18 +0200 Subject: T6764: Fix unhandled exception on ethtool output parsing for Xen NICs (#4182) Not all NICs could provide ring-buffers info requested by ethtool in JSON format For example 'vif' Xen/XCP-NG interfaces Fix it --- python/vyos/ethtool.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'python/vyos') diff --git a/python/vyos/ethtool.py b/python/vyos/ethtool.py index 21272cc5b..4710a5d40 100644 --- a/python/vyos/ethtool.py +++ b/python/vyos/ethtool.py @@ -23,7 +23,7 @@ from vyos.utils.process import popen # 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: """ @@ -101,8 +101,9 @@ class Ethtool: 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}') + 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) -- cgit v1.2.3