virArch arch,
virDomainVirtType domaintype,
const char *emulator,
- const char *machinetype)
+ const char *machinetype,
+ bool reportError)
{
virCapsGuest *foundguest = NULL;
virCapsGuestDomain *founddomain = NULL;
/* XXX check default_emulator, see how it uses this */
if (!foundguest) {
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
+
+ if (!reportError)
+ return NULL;
+
if (ostype)
virBufferAsprintf(&buf, "ostype=%s ",
virDomainOSTypeToString(ostype));
virReportError(VIR_ERR_INVALID_ARG,
_("could not find capabilities for %1$s"),
virBufferCurrentContent(&buf));
- return ret;
+ return NULL;
}
ret = g_new0(virCapsDomainData, 1);
* @domaintype: domain type to search for, of enum virDomainVirtType
* @emulator: Emulator path to search for
* @machinetype: Machine type to search for
+ * @reportError: whether to report error if no match is found
*
* Search capabilities for the passed values, and if found return
* virCapabilitiesDomainDataLookup filled in with the default values
virArch arch,
int domaintype,
const char *emulator,
- const char *machinetype)
+ const char *machinetype,
+ bool reportError)
{
virCapsDomainData *ret;
ret = virCapabilitiesDomainDataLookupInternal(caps, ostype,
caps->host.arch,
domaintype,
- emulator, machinetype);
+ emulator, machinetype,
+ reportError);
if (ret)
return ret;
}
return virCapabilitiesDomainDataLookupInternal(caps, ostype,
arch, domaintype,
- emulator, machinetype);
+ emulator, machinetype,
+ reportError);
}
capsdata = virCapabilitiesDomainDataLookup(caps, ostype,
arch,
virttype,
- NULL, NULL);
+ NULL, NULL,
+ true);
return capsdata != NULL;
}
g_autofree virCapsDomainData *capsdata = NULL;
if (!(capsdata = virCapabilitiesDomainDataLookup(caps, def->os.type,
- def->os.arch, def->virtType, NULL, NULL)))
+ def->os.arch,
+ def->virtType, NULL, NULL,
+ true))) {
return NULL;
+ }
retemu = g_strdup(capsdata->emulator);
}
if (!(capsdata = virCapabilitiesDomainDataLookup(caps, def->os.type,
- VIR_ARCH_NONE, def->virtType, NULL, NULL)))
+ VIR_ARCH_NONE,
+ def->virtType, NULL,
+ NULL, true))) {
goto out;
+ }
def->os.arch = capsdata->arch;
def->os.machine = g_strdup(capsdata->machinetype);
hostarch = virArchFromHost();
if (!(capsdata = virCapabilitiesDomainDataLookup(caps,
- VIR_DOMAIN_OSTYPE_HVM, hostarch, VIR_DOMAIN_VIRT_NONE,
- NULL, NULL))) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Cannot find suitable emulator for %1$s"),
- virArchToString(hostarch));
+ VIR_DOMAIN_OSTYPE_HVM,
+ hostarch,
+ VIR_DOMAIN_VIRT_NONE,
+ NULL, NULL,
+ true))) {
return -1;
}