diff --git a/bin/helpers b/bin/helpers index 1cd99716c..d9474774d 100644 --- a/bin/helpers +++ b/bin/helpers @@ -69,6 +69,16 @@ enableNICSRIOV() ( parentNIC="${1}" numVFS="${2:-"7"}" + if ! [ -d "/sys/class/net/${parentNIC}" ]; then + echo "${parentNIC} is not present, wrong name?" + return 1 + fi + + if ! [ -e "/sys/class/net/${parentNIC}/device/sriov_numvfs" ]; then + echo "${parentNIC} does not support SRIOV VFs" + return 1 + fi + echo "${numVFS}" > "/sys/class/net/${parentNIC}/device/sriov_numvfs" ip link set "${parentNIC}" up sleep 10 diff --git a/bin/local-run b/bin/local-run index 3730543dc..2ab4edf5c 100755 --- a/bin/local-run +++ b/bin/local-run @@ -9,4 +9,4 @@ test_name="$(basename "${script}")" echo "==> Running the job ${test_name} against ${lxd_snap_channel}" >&2 sed -e "1 a LXD_SNAP_CHANNEL=${lxd_snap_channel}" -e "1 r bin/helpers" "${script}" > "${_script}" -exec bash "${_script}" +exec bash "${_script}" "${*}" diff --git a/tests/network b/tests/network index 579aee7e0..202b5b66d 100755 --- a/tests/network +++ b/tests/network @@ -4,7 +4,7 @@ set -eux # Install LXD install_lxd -parentNIC="${1:-"$(ip route | awk '/^default/ {print $5}')"}" +parentNIC="${1}" # Enable SR-IOV on nic and bring up enableNICSRIOV "${parentNIC}" diff --git a/tests/network-sriov b/tests/network-sriov index f01747b6c..89f26aa4b 100755 --- a/tests/network-sriov +++ b/tests/network-sriov @@ -4,7 +4,7 @@ set -eu # Install LXD install_lxd -parentNIC="${1:-"$(ip route | awk '/^default/ {print $5}')"}" +parentNIC="${1}" # Enable SR-IOV on nic and bring up enableNICSRIOV "${parentNIC}"