aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries/bash/function
diff options
context:
space:
mode:
authorJuraj Linkeš <juraj.linkes@pantheon.tech>2021-11-12 14:34:52 +0100
committerPeter Mikus <pmikus@cisco.com>2022-01-19 12:08:34 +0000
commit9744be3170135285c6d7017134e5ae70e75d9afb (patch)
tree3c10e82c11f4e5a02a8df9a58d7b8c6ce0f2cc30 /resources/libraries/bash/function
parent54c9554e142d26447163f7ab7539e23d49d2f866 (diff)
fix(vpp_device): pci address existence condition
The function get_pci_addr could check a different PCI_ADDR in case the netdev device directory doesn't exit. Move the check so that it always uses the proper PCI_ADDR and add a failure case when the netdev device directory doesn't exist. Change-Id: Ibadfea3fba34509cd3ea8f906ac5962c0f01dd17 Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>
Diffstat (limited to 'resources/libraries/bash/function')
-rw-r--r--resources/libraries/bash/function/device.sh8
1 files changed, 5 insertions, 3 deletions
diff --git a/resources/libraries/bash/function/device.sh b/resources/libraries/bash/function/device.sh
index 1ad113ddba..86d482068a 100644
--- a/resources/libraries/bash/function/device.sh
+++ b/resources/libraries/bash/function/device.sh
@@ -518,9 +518,11 @@ function get_pci_addr () {
PCI_ADDR=$(basename $(readlink /sys/class/net/${NETDEV}/device)) || {
die "Failed to get PCI address of linux network interface!"
}
- fi
- if [ ! -d /sys/bus/pci/devices/${PCI_ADDR} ]; then
- die "PCI device ${NETDEV} doesn't exist!"
+ if [ ! -d /sys/bus/pci/devices/${PCI_ADDR} ]; then
+ die "PCI device ${PCI_ADDR} doesn't exist!"
+ fi
+ else
+ die "Can't get device info of interface ${NETDEV}!"
fi
}