Skip to content

Commit 249ade9

Browse files
hj-johannes-leemythi
authored andcommitted
qat: fix initcontainer to skip when sriov is already configured
Signed-off-by: Hyeongju Johannes Lee <hyeongju.lee@intel.com>
1 parent 63cfcd2 commit 249ade9

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

build/docker/intel-qat-initcontainer.Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,4 @@ LABEL summary='Intel® QAT initcontainer for Kubernetes'
6262
LABEL description='Intel QAT initcontainer initializes devices'
6363
COPY --from=builder /install_root /
6464
COPY demo/qat-init.sh /usr/local/bin/
65-
ENTRYPOINT ["/usr/local/bin/qat-init.sh"]
65+
ENTRYPOINT [ "/bin/bash", "/usr/local/bin/qat-init.sh"]

build/docker/templates/intel-qat-initcontainer.Dockerfile.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ COPY --from=builder /install_root /
2121

2222
COPY demo/qat-init.sh /usr/local/bin/
2323

24-
ENTRYPOINT ["/usr/local/bin/qat-init.sh"]
24+
ENTRYPOINT [ "/bin/bash", "/usr/local/bin/qat-init.sh"]

demo/qat-init.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
1-
#!/bin/bash
1+
#!/bin/sh -eu
22
ENABLED_QAT_PF_PCIIDS=${ENABLED_QAT_PF_PCIIDS:-37c8 4940 4942}
33
DEVS=$(for pf in $ENABLED_QAT_PF_PCIIDS; do lspci -n | grep -e "$pf" | grep -o -e "^\\S*"; done)
44

55
for dev in $DEVS; do
66
DEVPATH="/sys/bus/pci/devices/0000:$dev"
77
NUMVFS="$DEVPATH/sriov_numvfs"
8-
if test -w "$NUMVFS" -a "$(cat "$NUMVFS")" -eq 0 ; then
8+
if ! test -w "$NUMVFS"; then
9+
echo "error: $NUMVFS is not found or not writable. Check if QAT driver module is loaded"
10+
exit 1
11+
fi
12+
if [ "$(cat "$NUMVFS")" -ne 0 ]; then
13+
echo "$DEVPATH already configured"
14+
else
915
tee "$NUMVFS" < "$DEVPATH/sriov_totalvfs"
1016
fi
1117
done

0 commit comments

Comments
 (0)