From 196508071dbd593a1a826c8b1f99378990471df9 Mon Sep 17 00:00:00 2001 From: redxef Date: Wed, 29 May 2024 12:37:23 +0200 Subject: [PATCH] Wait before setting affinity, retry if fail. --- qemu-vm | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/qemu-vm b/qemu-vm index f93549e..c049921 100755 --- a/qemu-vm +++ b/qemu-vm @@ -104,10 +104,13 @@ while [[ "$qemu_pid" = '' ]]; do qemu_pid="$(pidof qemu-system-$(uname -m) || true)" sleep .1 done -$SUDO qemu-affinity \ - -k $(qemu-vm-cpus decompress_seq "$(qemu-vm-cpus compute_vm $NUM_PROCESSORS)") \ - -i *:$(qemu-vm-cpus compute_vm $NUM_PROCESSORS) \ - -- $qemu_pid +while :; do + sleep .1 + $SUDO qemu-affinity \ + -k $(qemu-vm-cpus decompress_seq "$(qemu-vm-cpus compute_vm $NUM_PROCESSORS)") \ + -i *:$(qemu-vm-cpus compute_vm $NUM_PROCESSORS) \ + -- $qemu_pid && break +done echo 'Startup complete' tail --pid="$qemu_pid" -f /dev/null