feat: block netvm start until qemu responds to pings

This commit is contained in:
Lance Vick 2025-04-29 19:36:58 -07:00
parent 3985d8ac19
commit 22469ca0b9
Signed by: lrvick
GPG Key ID: 8E47A1EC35A1551D
1 changed files with 11 additions and 2 deletions

View File

@ -82,10 +82,19 @@ function cmd_start(){
-boot order=d \
-chardev socket,path=/var/run/netvm_qga.sock,server=on,wait=off,id=qga0 \
$net_args \
-device qemu-xhci \
-device virtio-serial \
-device virtserialport,chardev=qga0,name=org.qemu.guest_agent.0 &
echo $! > "${LOCKFILE}"
#TODO: Poll here for VM to come up and respond to QMP agent ping
pid=$!
echo "$pid" > "${LOCKFILE}"
until qemu_ga guest-ping; do
ps -p $pid >/dev/null || {
echo "Error: netvm exited unexpectedly";
exit 1;
rm "${LOCKFILE}"
}
sleep 1
done
}
function cmd_stop(){