Re: Improve default machine type selection

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 3/16/23 11:56, Jim Fehlig wrote:
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>

To be fair, this config does not work when specifying machine='virt'

# virsh create test.xml
error: Failed to create domain from test.xml
error: internal error: process exited while connecting to monitor: 2023-03-16T21:37:30.895916Z qemu-system-aarch64: KVM is not supported for this guest CPU type 2023-03-16T21:37:30.895989Z qemu-system-aarch64: kvm_init_vcpu: kvm_arch_init_vcpu failed (0): Invalid argument

It worked after adding

<cpu mode='host-passthrough'/>

# virsh create test.xml
error: Failed to create domain from test.xml
error: internal error: Unexpected enum value 0 for virDomainDeviceAddressType


The same error occurs with host-passthrough CPU and default machine type.

Regards,
Jim





[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux