Change qemu-pid detection.

This commit is contained in:
redxef 2024-05-13 19:57:24 +02:00
parent 63387b8f50
commit 7f917c29c9
Signed by: redxef
GPG key ID: 7DAC3AA211CBD921

14
qemu-vm
View file

@ -90,17 +90,11 @@ $SUDO qemu-system-$(uname -m) \
-drive if=pflash,format=raw,readonly=on,file="$EFI_FIRMWARE" \
-drive if=pflash,format=raw,file="$EFI_VARS" \
"${qemu_arguments[@]}" &
qemu_pid="$!"
set +x
while :; do
_l="$(ps --ppid "$qemu_pid" | tail -n+2 || true)"
if [ "$_l" = '' ]; then
echo waiting
sleep .1
continue
fi
qemu_pid="$(awk '{print $1}' <<< "$_l")"
break
qemu_pid=
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)") \