Skip to content

Commit

Permalink
Merge pull request #43 from simondeziel/parentNIC
Browse files Browse the repository at this point in the history
Improve `enableNICSRIOV`
  • Loading branch information
tomponline authored Dec 11, 2023
2 parents f72b960 + 576acb0 commit d71b230
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
10 changes: 10 additions & 0 deletions bin/helpers
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion bin/local-run
Original file line number Diff line number Diff line change
Expand Up @@ -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}" "${*}"
2 changes: 1 addition & 1 deletion tests/network
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down
2 changes: 1 addition & 1 deletion tests/network-sriov
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down

0 comments on commit d71b230

Please sign in to comment.