Skip to content

Commit

Permalink
environment check: precisely check kernel option
Browse files Browse the repository at this point in the history
Longhorn 3157

Signed-off-by: Derek Su <derek.su@suse.com>
derekbit authored and innobead committed Dec 26, 2022
1 parent c83497b commit 62998ad
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions scripts/environment_check.sh
Original file line number Diff line number Diff line change
@@ -318,19 +318,19 @@ check_nfs_client_kernel_support() {
local nfs_client_kernel_configs=("CONFIG_NFS_V4_1" "CONFIG_NFS_V4_2")

for config in "${nfs_client_kernel_configs[@]}"; do
declare -A nodes
declare -A nodes=()

for pod in ${pods}; do
node=`kubectl get ${pod} --no-headers -o=custom-columns=:.spec.nodeName`
res=`kubectl exec -t $pod -- nsenter --mount=/proc/1/ns/mnt -- bash -c "grep -E \"^# ${config}\" /boot/config-$(uname -r)" > /dev/null 2>&1`
res=`kubectl exec -t $pod -- nsenter --mount=/proc/1/ns/mnt -- bash -c "grep -E \"^# ${config} is not set\" /boot/config-$(uname -r)" > /dev/null 2>&1`
if [[ $? == 0 ]]; then
all_found=false
nodes["${node}"]="${node}"
else
res=`kubectl exec -t $pod -- nsenter --mount=/proc/1/ns/mnt -- bash -c "grep -E ${config} /boot/config-$(uname -r)" > /dev/null 2>&1`
res=`kubectl exec -t $pod -- nsenter --mount=/proc/1/ns/mnt -- bash -c "grep -E \"^${config}=\" /boot/config-$(uname -r)" > /dev/null 2>&1`
if [[ $? != 0 ]]; then
all_found=false
warn "Unable to check kernel config ${config}"
warn "Unable to check kernel config ${config} on node ${node}"
fi
fi
done

0 comments on commit 62998ad

Please sign in to comment.