diff --git a/scripts/environment_check.sh b/scripts/environment_check.sh index d4f57b4..1f368c7 100755 --- a/scripts/environment_check.sh +++ b/scripts/environment_check.sh @@ -427,6 +427,35 @@ function check_nvme_cli() { return 1 } +function check_sse42_support() { + local pod=$1 + + node=$(kubectl get ${pod} --no-headers -o=custom-columns=:.spec.nodeName) + + machine=$(kubectl exec -i $pod -- nsenter --mount=/proc/1/ns/mnt -- bash -c 'uname -m' 2>/dev/null) + if [ $? -ne 0 ]; then + error "Failed to check machine on node ${node}" + return 1 + fi + + if [ "$machine" = "x86_64" ]; then + sse42_support=$(kubectl exec -i $pod -- nsenter --mount=/proc/1/ns/mnt -- bash -c 'grep -o sse4_2 /proc/cpuinfo | wc -l' 2>/dev/null) + if [ $? -ne 0 ]; then + error "Failed to check SSE4.2 instruction set on node ${node}" + return 1 + fi + + if [ "$sse42_support" -ge 1 ]; then + return 0 + fi + + error "CPU does not support SSE4.2" + return 1 + else + warn "Skip SSE4.2 instruction set check on node ${node} because it is not x86_64" + fi +} + function show_help() { cat <