summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorViacheslav Hletenko <v.gletenko@vyos.io>2025-10-16 15:01:19 +0300
committerGitHub <noreply@github.com>2025-10-16 15:01:19 +0300
commit4f46ade201e49d78a376d76f3dfd541c41f8636d (patch)
tree60e6af5f351e1c6a00ecad682f897ac9c0aea75b
parent7c021181e0bc72e965a3f33232678e4b9f61ddc1 (diff)
parenta5b92ceff7d2ba0c5f59a653b5dc636462883680 (diff)
downloadvyos-1x-4f46ade201e49d78a376d76f3dfd541c41f8636d.tar.gz
vyos-1x-4f46ade201e49d78a376d76f3dfd541c41f8636d.zip
Merge pull request #4789 from sever-sever/T7890
T7890: VPP fix verify_dev_driver
-rw-r--r--python/vyos/vpp/control_host.py15
-rwxr-xr-xsrc/conf_mode/vpp.py2
2 files changed, 10 insertions, 7 deletions
diff --git a/python/vyos/vpp/control_host.py b/python/vyos/vpp/control_host.py
index 6a6b9d72f..db1a492c9 100644
--- a/python/vyos/vpp/control_host.py
+++ b/python/vyos/vpp/control_host.py
@@ -23,6 +23,7 @@ from time import sleep
from pyroute2 import IPRoute
+from vyos.ethtool import Ethtool
from vyos.vpp.utils import EthtoolGDrvinfo
@@ -266,14 +267,16 @@ def get_eth_driver(iface: str) -> str:
Returns:
str: kernel module name
"""
- iface_driver: str = ''
driver_dir = Path(f'/sys/class/net/{iface}/device/driver/module')
- if not driver_dir.exists():
- # raise error if device was not found
- raise FileNotFoundError(f'PCI device {iface} not found in ethernet interfaces')
+ # Try to detect via sysfs (works for PCI devices)
+ if driver_dir.exists():
+ return driver_dir.resolve().name
- iface_driver: str = driver_dir.resolve().name
- return iface_driver
+ # Fallback: use ethtool (works for veth, tun, etc.)
+ try:
+ return Ethtool(iface).get_driver_name()
+ except Exception as error:
+ raise Exception(f'Could not determine driver for "{iface}": {error}') from error
def unsafe_noiommu_mode(status: bool) -> None:
diff --git a/src/conf_mode/vpp.py b/src/conf_mode/vpp.py
index 2d8c17e4f..204d8c6b7 100755
--- a/src/conf_mode/vpp.py
+++ b/src/conf_mode/vpp.py
@@ -609,7 +609,7 @@ def initialize_interface(iface, driver, iface_config) -> None:
try:
if control_host.get_eth_driver(f'defunct_{iface}') == 'mlx5_core':
control_host.rename_iface(f'defunct_{iface}', iface)
- except FileNotFoundError:
+ except Exception:
pass
# Replace a driver with original for VMBus interfaces and rename it