Example systemd scripts to setup SR-IOV on nodes

Signed-off-by Saikrishna Edupuganti <saikrishna.edupuganti@intel.com>
This commit is contained in:
Saikrishna
2019-01-01 08:56:44 -08:00
committed by Manohar Castelino
parent aecda4bf65
commit 39f3e063d3
4 changed files with 30 additions and 3 deletions
+6 -2
View File
@@ -9,8 +9,12 @@ directories on the host with the necessary binaries and configuration files.
Replace `flannel` configuration in the delegates section with contents of your
default network's cni configuration in [multus-conf.yaml](clr-k8s-examples/9-multi-network/multus-conf.yaml).
The device plugin, will discover any SR-IOV enabled devices on the host as per the
configuration in [sriov-conf.yaml](clr-k8s-examples/9-multi-network/sriov-conf.yaml).
The device plugin will register the SR-IOV enabled devices on the host, specified
as `rootDevices` in [sriov-conf.yaml](clr-k8s-examples/9-multi-network/sriov-conf.yaml).
> Helper [systemd](clr-k8s-examples/9-multi-network/systemd/sriov.service) example config
is provided, which enables SR-IOV for the above `rootDevices`
> NOTE: This assumes homogenous nodes in the cluster
@@ -11,7 +11,7 @@ data:
[
{
"resourceName": "sriov",
"rootDevices": ["0000:07:00.0"],
"rootDevices": ["07:00.0", "07:00.1"],
"sriovMode": true,
"deviceType": "netdevice"
}
@@ -0,0 +1,9 @@
[Unit]
Description=Create VFs on ens785f0 ens785f1 interfaces
[Service]
Type=oneshot
ExecStart=/usr/bin/sriov.sh ens785f0 ens785f1
[Install]
WantedBy=default.target
+14
View File
@@ -0,0 +1,14 @@
#!/bin/bash
# Usage: sriov.sh ens785f0 ens785f1 ...
for pf in "$@"; do
echo "Resetting $pf"
echo 0 | tee /sys/class/net/$pf/device/sriov_numvfs
NUM_VFS=$(cat /sys/class/net/$pf/device/sriov_totalvfs)
echo "Enabling $NUM_VFS for $pf"
echo $NUM_VFS | tee /sys/class/net/$pf/device/sriov_numvfs
ip link set $pf up
#for ((i = 0 ; i < ${NUM_VFS} ; i++ )); do ip link set $pf vf $i spoofchk off; done
for ((i = 0; i < ${NUM_VFS}; i++)); do ip link set dev $pf vf $i state enable; done
done