[libvirt] [PATCH v2] qemuConnectGetDomainCapabilities: Use wiser defaults
Eric Blake
eblake at redhat.com
Wed Jul 23 17:06:32 UTC 2014
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 at redhat.com>
> ---
>
> 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 604 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140723/24da8695/attachment-0001.sig>
More information about the libvir-list
mailing list