0

When creating a libvirt guest using XML, how do I determine what 'arch' values are valid for <domain><os><type arch=?>? The problem is, for example, arm is invalid and must be armv7l instead. How is one supposed to know that?

The documentation says:

There are also two optional attributes, arch specifying the CPU architecture to virtualization, and machine referring to the machine type. The Capabilities XML provides details on allowed values for these.

When I use the virsh command line or the Python API, I cannot get capabilities without providing an architecture. For example:

connection.getDomainCapabilities('/usr/bin/qemu-system-arm')
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/.../libvirt.py", line 4573, in getDomainCapabilities
    raise libvirtError('virConnectGetDomainCapabilities() failed')
libvirt.libvirtError: invalid argument: architecture from emulator 'armv7l' doesn't match given architecture 'x86_64'

The equivalent virsh command gives me a similar error. So how can I know what architectures are available to send as an argument to getDomainCapabilities?

Aside: to confuse things, virt-manager lists architectures that don't match the internal representation. So for example, when I create an arm machine, the XML generated lists armv7l.

  • Doesn't the output of `virsh capabilities` provide this information? At least on my system, that seems to show all currently available `arch` values and the corresponding emulators. – larsks Oct 05 '22 at 16:04
  • `virsh capabilities` doesn't show me any architectures. For example `virsh capabilities |grep arm` is empty. I think that command lists the host capabilities. It seems like the domain capabilities would be dependent on the emulator – infinitesteps Oct 05 '22 at 16:08

1 Answers1

0

The virsh capabilities output will show you all the emulator architectures that libvirt has been able to detect, by looking for qemu-system-xxxx binaries across $PATH. If you're not seeing architectures you expect listed in that output, then you likely have missing qemu-system-xxx binaries from your installation, or your OS vendor doesn't support those architectures.

DanielB
  • 1,618
  • 7
  • 7
  • I think this is putting me on the right track to figuring it out but not quite there yet. virsh and all qemu bins are in the PATH but still not listed by `virsh capabilities` $ which qemu-system-arm virsh /opt/local/bin/qemu-system-arm /Users/snip/homebrew/bin/virsh – infinitesteps Oct 07 '22 at 16:15
  • Looked at the source code, and it does indeed seem that it is supposed to work the way you described. I have opened a bug report: https://gitlab.com/libvirt/libvirt/-/issues/387 – infinitesteps Oct 07 '22 at 17:08