Re: [PATCH v2] qemuConnectGetDomainCapabilities: Use wiser defaults

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

 



On 07/23/2014 10:40 AM, Michal Privoznik wrote:
> Up to now, users have to pass two arguments at least: domain virt type
> ('qemu' vs 'kvm') and one of emulatorbin or architecture. This is not
> much user friendly. Nowadays users mostly use KVM and share the host
> architecture with the guest. So now, the API (and subsequently virsh
> command) can be called with all NULLs  (without any arguments).

> 
>  # virsh domcapabilities
>  <domainCapabilities>
>    <path>/usr/bin/qemu-system-x86_64</path>
>    <domain>kvm</domain>
>    <machine>pc-i440fx-2.1</machine>
>    <arch>x86_64</arch>
>    <vcpu max='255'/>
>  </domainCapabilities>

Nice - it gives a sane answer for the default setup.

> 
> Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
> ---
> 
> Notes:
>     It would be nice to have this in the same release as the new API it's fixing.

Agreed.


> +    int arch = virArchFromHost(); /* virArch */
>  
>      virCheckFlags(0, ret);
> -    virCheckNonNullArgReturn(virttype_str, ret);
>  
>      if (virConnectGetDomainCapabilitiesEnsureACL(conn) < 0)
>          return ret;
>  
> -    if ((virttype = virDomainVirtTypeFromString(virttype_str)) < 0) {
> +    if (qemuHostdevHostSupportsPassthroughLegacy())
> +        virttype = VIR_DOMAIN_VIRT_KVM;
> +    else
> +        virttype = VIR_DOMAIN_VIRT_QEMU;
> +
> +    if (virttype_str &&
> +        (virttype = virDomainVirtTypeFromString(virttype_str)) < 0) {
>          virReportError(VIR_ERR_INVALID_ARG,
>                         _("unknown virttype: %s"),
>                         virttype_str);
> @@ -16924,9 +16929,6 @@ qemuConnectGetDomainCapabilities(virConnectPtr conn,

Not shown, but arch is reassigned to arch_str if one was provided,
before the next query of arch...

>  
>          arch_from_caps = virQEMUCapsGetArch(qemuCaps);
>  
> -        if (arch == VIR_ARCH_NONE)
> -            arch = arch_from_caps;
> -
>          if (arch_from_caps != arch) {
>              virReportError(VIR_ERR_INVALID_ARG,
>                             _("architecture from emulator '%s' doesn't "

...so this error message is still okay.

ACK.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[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]