Improve default machine type selection

Jim Fehlig jfehlig at suse.com
Thu Mar 16 17:56:09 UTC 2023


On 3/15/23 08:40, Ján Tomko wrote:
> On a Monday in 2023, Jim Fehlig wrote:
>> If an explicit machine type is not specified in the VM config, the qemu driver 
>> will select the first machine type in the list of machine types for the 
>> specified accelerator. See virQEMUCapsGetPreferredMachine
>>
>> https://gitlab.com/libvirt/libvirt/-/blob/master/src/qemu/qemu_capabilities.c#L6133
>>
>> On my test machines, this works reasonably well for x86_64 where the first 
>> machine type is pc-i440fx-7.1. But for aarch64, the first machine is 
>> integratorcp, which is not very useful with maxCpus=1 and other limitations. 
> 
> Is it possible to run such machine with libvirt?

I just did a quick check with libvirt 9.1.0 (qemu is a bit older, at 7.1.0):

# cat test.xml
<domain type='kvm'>
   <name>test</name>
   <memory unit='KiB'>2097152</memory>
   <vcpu placement='static'>1</vcpu>
   <os>
     <type>hvm</type>
     <loader readonly='yes' 
type='pflash'>/usr/share/qemu/aavmf-aarch64-code.bin</loader>
     <nvram template='/usr/share/qemu/aavmf-aarch64-vars.bin'/>
     <boot dev='hd'/>
   </os>
   <clock offset='utc'/>
   <on_poweroff>destroy</on_poweroff>
   <on_reboot>restart</on_reboot>
   <on_crash>destroy</on_crash>
   <devices>
     <emulator>/usr/bin/qemu-system-aarch64</emulator>
     <disk type='file' device='disk'>
       <driver name='qemu' type='qcow2' discard='unmap'/>
       <source file='/var/lib/libvirt/images/test.qcow2'/>
       <target dev='vda' bus='virtio'/>
     </disk>
   </devices>
</domain>
# virsh create test.xml
error: Failed to create domain from test.xml
error: internal error: Unexpected enum value 0 for virDomainDeviceAddressType

I don't _think_ it's a downstream bug, nor fixed in git in the meantime. It 
appears running the old integratorcp machine with libivrt is not possible.

Regards,
Jim



More information about the libvir-list mailing list