Skip to content

Commit

Permalink
fix(spdk): enable uio_pci_generic and vfio_pci kernel modules
Browse files Browse the repository at this point in the history
According to the [SPDK System Configuration User Guide](https://spdk.io/doc/system_configuration.html),
neither uio_pci_generic nor vfio_pci is universally suitable for all devices and environments.
Therefore, the preflight installation enables both uio_pci_generic and vfio_pci kernel modules,
allowing spdk/setup.sh to automatically select the appropriate module.

Longhorn 9182

Signed-off-by: Derek Su <[email protected]>
  • Loading branch information
derekbit authored and innobead committed Aug 7, 2024
1 parent ea2fb23 commit 47914ac
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions deploy/prerequisite/longhorn-spdk-setup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ metadata:
labels:
app: longhorn-spdk-setup
annotations:
command: &cmd OS=$(grep -E "^ID_LIKE=" /etc/os-release | cut -d '=' -f 2); if [[ -z "${OS}" ]]; then OS=$(grep -E "^ID=" /etc/os-release | cut -d '=' -f 2); fi; if [[ "${OS}" == *"debian"* ]]; then sudo apt-get update -q -y && sudo apt-get install -q -y git; elif [[ "${OS}" == *"suse"* ]]; then sudo zypper --gpg-auto-import-keys -q refresh && sudo zypper --gpg-auto-import-keys -q install -y git; else sudo yum makecache -q -y && sudo yum --setopt=tsflags=noscripts install -q -y git; fi && if [ $? -eq 0 ]; then echo "git install successfully"; else echo "git install failed error code $?"; fi && rm -rf ${SPDK_DIR}; git clone -b longhorn-1.6 https://github.com/longhorn/spdk.git ${SPDK_DIR} && bash ${SPDK_DIR}/scripts/setup.sh ${SPDK_OPTION}; if [ $? -eq 0 ]; then echo "vm.nr_hugepages=$((HUGEMEM/2))" >> /etc/sysctl.conf; echo "SPDK environment is configured successfully"; else echo "Failed to configure SPDK environment error code $?"; fi; rm -rf ${SPDK_DIR}
command: &cmd OS=$(grep -E "^ID_LIKE=" /etc/os-release | cut -d '=' -f 2); if [[ -z "${OS}" ]]; then OS=$(grep -E "^ID=" /etc/os-release | cut -d '=' -f 2); fi; if [[ "${OS}" == *"debian"* ]]; then sudo apt-get update -q -y && sudo apt-get install -q -y git && sudo modprobe vfio_pci && sudo modprobe uio_pci_generic; elif [[ "${OS}" == *"suse"* ]]; then sudo zypper --gpg-auto-import-keys -q refresh && sudo zypper --gpg-auto-import-keys -q install -y git; else sudo yum makecache -q -y && sudo yum --setopt=tsflags=noscripts install -q -y git && sudo modprobe vfio_pci && sudo modprobe uio_pci_generic; fi && if [ $? -eq 0 ]; then echo "git install successfully"; else echo "git install failed error code $?"; fi && rm -rf ${SPDK_DIR}; git clone -b longhorn-1.6 https://github.com/longhorn/spdk.git ${SPDK_DIR} && bash ${SPDK_DIR}/scripts/setup.sh ${SPDK_OPTION}; if [ $? -eq 0 ]; then echo "vm.nr_hugepages=$((HUGEMEM/2))" >> /etc/sysctl.conf; echo "SPDK environment is configured successfully"; else echo "Failed to configure SPDK environment error code $?"; fi; rm -rf ${SPDK_DIR}
spec:
selector:
matchLabels:
Expand All @@ -21,12 +21,12 @@ spec:
initContainers:
- name: longhorn-spdk-setup
command:
- nsenter
- --mount=/proc/1/ns/mnt
- --
- bash
- -c
- *cmd
- nsenter
- --mount=/proc/1/ns/mnt
- --
- bash
- -c
- *cmd
image: alpine:3.12
env:
- name: SPDK_DIR
Expand All @@ -38,7 +38,7 @@ spec:
- name: PCI_ALLOWED
value: "none"
- name: DRIVER_OVERRIDE
value: "uio_pci_generic"
value: ""
securityContext:
privileged: true
containers:
Expand Down

0 comments on commit 47914ac

Please sign in to comment.