Skip to content

Instantly share code, notes, and snippets.

@Tahvok
Last active September 13, 2018 13:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Tahvok/6233c0f48568bb7162f1f9c2a2f85509 to your computer and use it in GitHub Desktop.
Save Tahvok/6233c0f48568bb7162f1f9c2a2f85509 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
while read -r instance; do
while read -r current_node_cpus; do
current_node=();
for i in $current_node_cpus; do
current_node[i]=1
done
notfound=()
found_at_least_one=0
while read -r cpu; do
if [[ ! ${current_node[cpu]} ]]; then
notfound+=("$cpu");
else
found_at_least_one=1
fi
done < <(virsh dumpxml "$instance" | awk '/vcpupin/{split($0,a,"="); split(a[3],cpu,"'\''"); print cpu[2]}')
if [[ "$found_at_least_one" == "1" ]] && [[ ${#notfound[@]} -ne 0 ]]; then
echo "CPU pinning on instance $instance is wrong! Probably this are the wrong pins: ${notfound[@]}"
break
fi
done < <(numactl --hard | awk '/cpus:/{split($0,a,":"); print a[2];}')
done < <(virsh list --name --all | grep -v "^$")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment