[PATCH] qemu: do not use domain virt type to get default version

Liang Yan lyan at digitalocean.com
Tue May 3 14:06:56 UTC 2022


Hi Cole,

I saw you are the last one working on this part, even quite long time 
ago, :-)

Could you give it a quick review? I just want to know the if small 
change messed something else,

or maybe not worth to change it.


Thanks,

Liang

On 4/28/22 09:39, Liang Yan wrote:
> Could anyone give it a review? Thanks.
>
> A scenario is that it will cause below error when disabled tcg from 
> qemu side:
>
> lyan at xryan:~/virt/qemu$ virsh version
> Compiled against library: libvirt 8.0.0
> Using library: libvirt 8.0.0
> Using API: QEMU 8.0.0
> error: failed to get the hypervisor version
> error: internal error: Cannot find suitable emulator for x86_64
>
> I am not sure if it is expected. From my understanding, it may not be 
> reasonable,  because hypervisor could also use kvm or hvf. My first 
> thought was to add more domain virt type to 
> 'virQEMUCapsGetDefaultVersion', but after looking into 
> 'virCapabilitiesDomainDataLookupInternal', I noticed that it works 
> same if I set domain virt type to 'NONE', it will iterate all domains 
> to find a 'emulator' and 'guest' based on 'ostype' and 'arch'. This is 
> a version issue so no need to change qemu capabilities cache search 
> logic which I am not quite familiar with.
>
>
> Let me know if there are any problems, thanks.
>
> Regards,
>
> Liang
>
>
> On 4/26/22 16:38, Liang Yan wrote:
>> We do not need VIR_DOMAIN_VIRT_QEMU to get qemu default
>> version. With the 'os_type' and 'arch'in capabilities,
>> we could identify 'emulator' which is enough to get the version.
>>
>> Actually VIR_DOMAIN_VIRT_QEMU is not the only domain virt type for
>> qemu driver, there are VIR_DOMAIN_VIRT_KVM and VIR_DOMAIN_VIRT_HVF.
>> If TCG is disabled in qemu, it will cause the error that could not
>> find suitable emulater when access version.
>>
>> Signed-off-by: Liang Yan <lyan at digtalocean.com>
>> ---
>>   src/qemu/qemu_capabilities.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
>> index b91db851bb..9a0b7ebeb4 100644
>> --- a/src/qemu/qemu_capabilities.c
>> +++ b/src/qemu/qemu_capabilities.c
>> @@ -1857,7 +1857,7 @@ int virQEMUCapsGetDefaultVersion(virCaps *caps,
>>         hostarch = virArchFromHost();
>>       if (!(capsdata = virCapabilitiesDomainDataLookup(caps,
>> -            VIR_DOMAIN_OSTYPE_HVM, hostarch, VIR_DOMAIN_VIRT_QEMU,
>> +            VIR_DOMAIN_OSTYPE_HVM, hostarch, VIR_DOMAIN_VIRT_NONE,
>>               NULL, NULL))) {
>>           virReportError(VIR_ERR_INTERNAL_ERROR,
>>                          _("Cannot find suitable emulator for %s"),



More information about the libvir-list mailing list