From a5b92ceff7d2ba0c5f59a653b5dc636462883680 Mon Sep 17 00:00:00 2001 From: Viacheslav Date: Fri, 10 Oct 2025 12:48:57 +0000 Subject: T7890: VPP fix verify_dev_driver The verify_dev_driver must return bool value, but it a device does not have PCI address (for example veth interface) it returns Traceback Fix this --- python/vyos/vpp/control_host.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'python') 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: -- cgit v1.2.3