I see, thank you for the extra context and quick response Michal.

I wasn't aware of the userspace SLIRP stack nor the darwin limitation - will give either a try.

My main requirement is basically getting SSH to work, so I can do some provisioning, anything else would be a bonus for me.

Radek Simko


On Thu, Apr 1, 2021 at 11:09 AM Michal Privoznik <mprivozn@redhat.com> wrote:
On 3/31/21 10:39 PM, Radek Simko wrote:
> Thank you Laine and thanks Michal for the detailed explanation.
>
> To add some (missing) context from my side:
>
> I was attempting to virtualize Raspberry Pi on qemu via libvirt, where
> my host machine is macOS (both qemu and libvirt installed via Homebrew)
> and I while trying to set up the network I stumbled upon this:
>
> |$ virsh -c
> qemu:///system?socket=/usr/local/var/run/libvirt/libvirt-sock net-list
> --all error: Failed to get the number of active networks error: this
> function is not supported by the connection driver: virConnectNumOfNetworks|
>
> This error in combination with the compatibility matrix made me think
> it's just not supported.
> What is the right way of interpreting this error/state? Does the host OS
> play a role in the compatibility?

Yes it does.

>
> Are there any known limitations on macOS, or is this likely just a
> broken/misconfigured installation on my side?

Oh, now I get it. You are not building the network (bridge) driver. And
looking into meson.build I can see why:


# there's no use compiling the network driver without the libvirt
# daemon, nor compiling it for macOS, where it breaks the compile
if not get_option('driver_network').disabled() and
conf.has('WITH_LIBVIRTD') and host_machine.system() != 'darwin'
   conf.set('WITH_NETWORK', 1)
endif

https://gitlab.com/libvirt/libvirt/-/blob/master/meson.build#L1649

But I'm not sure whether the comment is still true. I don't have any
access to macOS so I can't confirm nor deny. But since you can, you can
try changing that condition so that WITH_NETWORK is enabled and see
whether compilation fails. On the other hand, I'm not sure whether our
code would be able to talk to macOS and create briges/TAP devices/...

But unless you need something specific for RasPI (i.e. generic
HTTP/HTTPS) is enough, then you don't need libvirt network - you can use
<interface type='user'/>. You can even configure it's IP address should
you need to do so:

https://libvirt.org/formatdomain.html#userspace-slirp-stack

Michal