fix: enforce Pimox KVM big-core pinning
This commit is contained in:
parent
3fe294614c
commit
3fcb8dff98
|
|
@ -2227,9 +2227,24 @@ rm -f '${remote_tmp}'"
|
|||
|
||||
for entry in ${cpu_map}; do
|
||||
vmid="${entry%%=*}"
|
||||
cpuset="${entry#*=}"
|
||||
pimox_ssh "${host}" "${user}" "${key_path}" "set -eu
|
||||
if sudo '${qm_bin}' status '${vmid}' >/dev/null 2>&1; then
|
||||
sudo '${qm_bin}' set '${vmid}' --hookscript '${script_ref}'
|
||||
if sudo '${qm_bin}' status '${vmid}' | grep -q 'status: running'; then
|
||||
if ! command -v taskset >/dev/null 2>&1; then
|
||||
echo 'taskset is required to enforce Pimox KVM CPU pinning for running VM ${vmid}' >&2
|
||||
exit 1
|
||||
fi
|
||||
pid_file='/var/run/qemu-server/${vmid}.pid'
|
||||
if ! sudo test -r \"\$pid_file\"; then
|
||||
echo 'Pimox VM ${vmid} is running but its QEMU pid file is missing; cannot enforce CPU pinning.' >&2
|
||||
exit 1
|
||||
fi
|
||||
pid=\"\$(sudo cat \"\$pid_file\")\"
|
||||
echo 'Applying Pimox KVM CPU affinity ${cpuset} to running VM ${vmid} pid' \"\$pid\"
|
||||
sudo taskset -a -cp '${cpuset}' \"\$pid\" >/dev/null
|
||||
fi
|
||||
fi"
|
||||
done
|
||||
}
|
||||
|
|
@ -3493,6 +3508,7 @@ run_pimox_pipeline() {
|
|||
fi
|
||||
if [[ -n "${pin_cpu_map// /}" ]]; then
|
||||
pin_hookscript_ref="${pin_hookscript_storage}:snippets/${pin_hookscript_name}"
|
||||
echo "Pimox K8s VM CPU pin map: ${pin_cpu_map}"
|
||||
fi
|
||||
fi
|
||||
if ! [[ "${timeout_seconds}" =~ ^[0-9]+$ && "${timeout_seconds}" -gt 0 ]]; then
|
||||
|
|
|
|||
Loading…
Reference in New Issue