On 09/20/2018 05:25 PM, Andrea Bolognani wrote:
This is the output of 'virsh capabilities' on my laptop:
<guest>
<os_type>hvm</os_type>
<arch name='x86_64'>
<wordsize>64</wordsize>
<emulator>/usr/bin/qemu-system-x86_64</emulator>
<machine maxCpus='255'>pc-i440fx-3.0</machine>
<machine canonical='pc-i440fx-3.0'
maxCpus='255'>pc</machine>
<machine maxCpus='288'>pc-q35-3.0</machine>
<machine canonical='pc-q35-3.0'
maxCpus='288'>q35</machine>
<!-- Actually way more machine types listed here -->
<domain type='qemu'/>
<domain type='kvm'>
<emulator>/usr/bin/qemu-kvm</emulator>
<machine maxCpus='255'>pc-i440fx-3.0</machine>
<machine canonical='pc-i440fx-3.0'
maxCpus='255'>pc</machine>
<machine maxCpus='288'>pc-q35-3.0</machine>
<machine canonical='pc-q35-3.0'
maxCpus='288'>q35</machine>
<!-- Actually way more machine types listed here -->
</domain>
</arch>
<!-- Other stuff we don't care about -->
</guest>
Notice how all machine types are listed twice, and how we report
that qemu-system-x86_64 for TCG guests qemu-kvm must be used for
KVM guests - which is inaccurate, since the former can run KVM
guests just fine.
After this series, the output is much more reasonable:
<guest>
<os_type>hvm</os_type>
<arch name='x86_64'>
<wordsize>64</wordsize>
<emulator>/usr/bin/qemu-system-x86_64</emulator>
<machine maxCpus='255'>pc-i440fx-3.0</machine>
<machine canonical='pc-i440fx-3.0'
maxCpus='255'>pc</machine>
<machine maxCpus='288'>pc-q35-3.0</machine>
<machine canonical='pc-q35-3.0'
maxCpus='288'>q35</machine>
<!-- Actually way more machine types listed here -->
<domain type='qemu'/>
<domain type='kvm'/>
</arch>
<!-- Other stuff we don't care about -->
</guest>
As a bonus the code gets *simpler* in the process instead of more
complicated, and we even get to shave off ~100 lines! Yay!
Andrea Bolognani (11):
qemu: Move comments to virQEMUCapsGuestIsNative()
qemu: Don't duplicate binary name in capabilities
qemu: Move armv7l-on-aarch64 special case
qemu: Stop looking after finding the first binary
qemu: Expect a single binary in virQEMUCapsInitGuest()
qemu: Remove unnecessary variables
qemu: Don't look for "qemu-kvm" and "kvm" binaries
qemu: Simplify QEMU binary search
qemu: Rename qemubinCaps => qemuCaps
qemu: Refactor virQEMUCapsCacheLookupByArch()
qemu: Prefer qemu-system-* binaries
src/qemu/qemu_capabilities.c | 170 +++++++-----------
src/qemu/qemu_capabilities.h | 4 +-
.../qemucaps2xmloutdata/caps_1.5.3.x86_64.xml | 4 +-
.../qemucaps2xmloutdata/caps_1.6.0.x86_64.xml | 4 +-
.../qemucaps2xmloutdata/caps_1.7.0.x86_64.xml | 4 +-
.../qemucaps2xmloutdata/caps_2.1.1.x86_64.xml | 4 +-
.../caps_2.10.0.aarch64.xml | 4 +-
.../qemucaps2xmloutdata/caps_2.10.0.ppc64.xml | 4 +-
.../qemucaps2xmloutdata/caps_2.10.0.s390x.xml | 4 +-
.../caps_2.10.0.x86_64.xml | 4 +-
.../qemucaps2xmloutdata/caps_2.11.0.s390x.xml | 4 +-
.../caps_2.11.0.x86_64.xml | 4 +-
.../caps_2.12.0.aarch64.xml | 4 +-
.../qemucaps2xmloutdata/caps_2.12.0.ppc64.xml | 4 +-
.../qemucaps2xmloutdata/caps_2.12.0.s390x.xml | 4 +-
.../caps_2.12.0.x86_64.xml | 4 +-
.../qemucaps2xmloutdata/caps_2.4.0.x86_64.xml | 4 +-
.../qemucaps2xmloutdata/caps_2.5.0.x86_64.xml | 4 +-
.../caps_2.6.0.aarch64.xml | 4 +-
.../qemucaps2xmloutdata/caps_2.6.0.ppc64.xml | 4 +-
.../qemucaps2xmloutdata/caps_2.6.0.x86_64.xml | 4 +-
.../qemucaps2xmloutdata/caps_2.7.0.s390x.xml | 4 +-
.../qemucaps2xmloutdata/caps_2.7.0.x86_64.xml | 4 +-
.../qemucaps2xmloutdata/caps_2.8.0.s390x.xml | 4 +-
.../qemucaps2xmloutdata/caps_2.8.0.x86_64.xml | 4 +-
.../qemucaps2xmloutdata/caps_2.9.0.ppc64.xml | 4 +-
.../qemucaps2xmloutdata/caps_2.9.0.s390x.xml | 4 +-
.../qemucaps2xmloutdata/caps_2.9.0.x86_64.xml | 4 +-
.../qemucaps2xmloutdata/caps_3.0.0.ppc64.xml | 4 +-
.../qemucaps2xmloutdata/caps_3.0.0.x86_64.xml | 4 +-
tests/qemucaps2xmltest.c | 2 -
31 files changed, 97 insertions(+), 191 deletions(-)
ACK
Michal