On 17.07.2014 11:28, Daniel P. Berrange wrote:
On Thu, Jul 17, 2014 at 11:12:05AM +0200, Michal Privoznik wrote:
> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index 33541d3..7d99435 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -16849,17 +16849,17 @@ qemuConnectGetDomainCapabilities(virConnectPtr conn,
> char *ret = NULL;
> virQEMUDriverPtr driver = conn->privateData;
> virQEMUCapsPtr qemuCaps = NULL;
> - int virttype; /* virDomainVirtType */
> + int virttype = VIR_DOMAIN_VIRT_KVM; /* virDomainVirtType */
Isn't this going to always fail when we run inside a guest which does not
have nested virt? When we know the QEMU binary, we probe to see whether
it can do KVM or not, so could we postpone this decision about virt type
until after we've checked if KVM was available ?
I don't think we can. I mean, in order to construct virDomainCaps object we need to
know the virttype. The KVM is checked later in the process when the object exits already.
What we can do, however, is check for KVM twice. How about this squashed in?
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 7d99435..33d6e47 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -16849,7 +16849,7 @@ qemuConnectGetDomainCapabilities(virConnectPtr conn,
char *ret = NULL;
virQEMUDriverPtr driver = conn->privateData;
virQEMUCapsPtr qemuCaps = NULL;
- int virttype = VIR_DOMAIN_VIRT_KVM; /* virDomainVirtType */
+ int virttype; /* virDomainVirtType */
virDomainCapsPtr domCaps = NULL;
int arch = virArchFromHost(); /* virArch */
@@ -16858,6 +16858,11 @@ qemuConnectGetDomainCapabilities(virConnectPtr conn,
if (virConnectGetDomainCapabilitiesEnsureACL(conn) < 0)
return ret;
+ 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,
Michal