qemu guest agent with openbsd

Hello, I have an OpenBSD 7.5 guest running on Debian bookworm with libvirt (9.0) and qemu (7.2). I'd like to use the qemu guest agent in this guest, but I can't seem to figure out how to craft the libvirt xml to expose the serial port in a way that OpenBSD and libvirt can use it together (or if it’s even possible). Per the libvirt docs <https://wiki.libvirt.org/Qemu_guest_agent.html>, I’m currently using:
<channel type='unix'> <source mode='bind'/> <target type='virtio' name='org.qemu.guest_agent.0'/> </channel>
But OpenBSD doesn’t directly support the virtio console driver. Consistent with this 2020 thread <https://undeadly.org/cgi?action=article;sid=20200514073852> from the OpenBSD ports making list, I see the following message in my guest’s dmesg output:
virtio5 at pci0 dev 10 function 0 "Qumranet Virtio Console" rev 0x00 virtio5: no matching child driver; not configured
Thanks to this libvir-list thread <https://listman.redhat.com/archives/libvir-list/2015-October/120250.html> from 2015, I’ve realized that I can manually expose an ISA serial console that will allow me to connect to the guest agent using native qemu tooling; but there doesn’t seem to be a way to create a channel that libvirt can communicate over without virtio console support in the guest. The thread discusses a couple of approaches to resolving this issue with code changes, but it seems like the discussion stalled out before anything happened. Am I missing something or is it still impossible? Thanks!

On Fri, May 10, 2024 at 11:01:06AM GMT, Christian Haumesser via Users wrote:
Hello,
I have an OpenBSD 7.5 guest running on Debian bookworm with libvirt (9.0) and qemu (7.2).
I'd like to use the qemu guest agent in this guest, but I can't seem to figure out how to craft the libvirt xml to expose the serial port in a way that OpenBSD and libvirt can use it together (or if it’s even possible).
Per the libvirt docs <https://wiki.libvirt.org/Qemu_guest_agent.html>, I’m currently using:
<channel type='unix'> <source mode='bind'/> <target type='virtio' name='org.qemu.guest_agent.0'/> </channel>
But OpenBSD doesn’t directly support the virtio console driver. Consistent with this 2020 thread <https://undeadly.org/cgi?action=article;sid=20200514073852> from the OpenBSD ports making list, I see the following message in my guest’s dmesg output:
virtio5 at pci0 dev 10 function 0 "Qumranet Virtio Console" rev 0x00 virtio5: no matching child driver; not configured
Thanks to this libvir-list thread <https://listman.redhat.com/archives/libvir-list/2015-October/120250.html> from 2015, I’ve realized that I can manually expose an ISA serial console that will allow me to connect to the guest agent using native qemu tooling; but there doesn’t seem to be a way to create a channel that libvirt can communicate over without virtio console support in the guest. The thread discusses a couple of approaches to resolving this issue with code changes, but it seems like the discussion stalled out before anything happened.
Am I missing something or is it still impossible?
I just tried on both FreeBSD 14.0 and OpenBSD 7.5. It works out of the box on the former, doesn't seem to work at all on the latter. What I find weird is that a driver seems to exist already: https://man.openbsd.org/viocon.4 A few limitations are listed, and I'm not sure whether any of those are relevant for this scenario. But I've also tried to set up a virtio-console (rather than virtio-serial) and I couldn't get that to work either, despite it supposedly being the whole purpose of the driver. I'm not very familiar with OpenBSD though, so it's entirely possible that I've simply made a mistake somewhere :) In any case, my opinion is that the solution isn't changing libvirt so that exposing multiple isa-serial devices becomes possible, but rather enhancing the OpenBSD driver so that it supports virtio-serial channels, the same way that other operating systems can. The FreeBSD driver can likely be used as inspiration. -- Andrea Bolognani / Red Hat / Virtualization

On Mon, May 13, 2024 at 06:38:12AM GMT, Andrea Bolognani wrote:
What I find weird is that a driver seems to exist already:
https://man.openbsd.org/viocon.4
A few limitations are listed, and I'm not sure whether any of those are relevant for this scenario. But I've also tried to set up a virtio-console (rather than virtio-serial) and I couldn't get that to work either, despite it supposedly being the whole purpose of the driver. I'm not very familiar with OpenBSD though, so it's entirely possible that I've simply made a mistake somewhere :)
Perhaps this line is the culprit: https://github.com/openbsd/src/blob/master/sys/arch/amd64/conf/GENERIC#L715 It looks like the viocon driver is commented out. Maybe there's a way to enable it? -- Andrea Bolognani / Red Hat / Virtualization
participants (2)
-
Andrea Bolognani
-
Christian Haumesser