Score:0

How do I find architectures supported by an emulator for use when defining a libvirt domain?

tg flag

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.

pt flag
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.
infinitesteps avatar
tg flag
`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
Score:0
vn flag

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.

infinitesteps avatar
tg flag
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 avatar
tg flag
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
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.