Hello everyone,as a follow-up to yesterdays coversation, I've uploaded the script to my private Git in case anyone wants to take a look at it.
It consists of the actual tool itself and an rc-script that supports start/stop functionality during system boot-up and shutdown. The configuration of the VMs needs to be provided in a (hard-coded) conf.d directory.
However, I want to mention upfront that it was put together hastily and only meets the minimum requirements. Nevertheless, it might serve as inspiration for more sophisticated tooling in the future.
Kind regards Matthias [1] https://forge.petermann-it.de/mpeterma/vmctl On 23.05.23 16:38, Matthias Petermann wrote:
Hi Robert, On 23.05.23 15:51, Robert Nestor wrote:Commenting on your follow-up on Xen startup and how I considered doing this in NVMM. I have a rudamentory script that I use to define/create guest systems which also includes some hooks for starting up guest systems. There’s not currently any way I found in NVMM to send in shutdown commands or instructions though which seem to be available in Xen and KVM. I did put hooks in my script to backup and restore guest systems.Assuming you are using Qemu as the frontend to nvmm you can redirect Qemus "monitor" console to a Unix domain socket.I use this command in my scripts: ``` MONITOR_SOCKET=/tmp/$VM_ID.monitor CONSOLE_SOCKET=/tmp/$VM_ID.consolenohup qemu-system-x86_64 -name $VM_ID -machine pc-q35-7.0 -smp $VM_CORES -m $VM_RAM -accel nvmm \-device virtio-balloon-pci,id=balloon0 \ -k de -boot cd -cdrom $VM_CDROM \ -machine graphics=off -display none -vga none \-object rng-random,filename=/dev/urandom,id=viornd0 \-device virtio-rng-pci,rng=viornd0 \ -object iothread,id=t0 \ $BLK \ -device virtio-net-pci,netdev=vioif0,mac=$VM_MAC \-netdev tap,id=vioif0,ifname=$VM_NETIF,script=no,downscript=no \ -chardev socket,id=monitor,path=$MONITOR_SOCKET,server=on,wait=off \-monitor chardev:monitor \-chardev socket,id=serial0,path=$CONSOLE_SOCKET,server=on,wait=off \-serial chardev:serial0 \ -pidfile /tmp/$VM_ID.pid \ 2>&1 | logger -p local0.notice & ``` Shutdown is possible by sendung the system_powerdown qemu monitor command: ``` MONITOR_SOCKET=/tmp/$VM_ID.monitor echo "system_powerdown" | nc -N -U $MONITOR_SOCKET echo "" ```On my systems this result in an ACPI poweroff event which triggers the shutdown procedure in the NetBSD guest.Kind regards Matthias
smime.p7s
Description: S/MIME Cryptographic Signature