if (!(cpus = virCPUDefListParse(xmlCPUs, ncpus, VIR_CPU_TYPE_HOST)))
goto cleanup;
- if (!(cpu = virCPUBaseline(cpus, ncpus, NULL,
+ if (!(cpu = virCPUBaseline(VIR_ARCH_NONE, cpus, ncpus, NULL,
!!(flags & VIR_CONNECT_BASELINE_CPU_MIGRATABLE))))
goto cleanup;
/**
* virCPUBaseline:
*
+ * @arch: CPU architecture, use VIR_ARCH_NONE to autodetect from @cpus
* @cpus: list of host CPU definitions
* @ncpus: number of CPUs in @cpus
* @models: list of CPU models that can be considered for the baseline CPU
* @migratable: requests non-migratable features to be removed from the result
*
* Computes the most feature-rich CPU which is compatible with all given
- * host CPUs. If @models is NULL, all models supported by libvirt will
+ * CPUs. If @models is NULL, all models supported by libvirt will
* be considered when computing the baseline CPU model, otherwise the baseline
* CPU model will be one of the provided CPU @models.
*
* Returns baseline CPU definition or NULL on error.
*/
virCPUDefPtr
-virCPUBaseline(virCPUDefPtr *cpus,
+virCPUBaseline(virArch arch,
+ virCPUDefPtr *cpus,
unsigned int ncpus,
virDomainCapsCPUModelsPtr models,
bool migratable)
struct cpuArchDriver *driver;
size_t i;
- VIR_DEBUG("ncpus=%u, models=%p, migratable=%d", ncpus, models, migratable);
+ VIR_DEBUG("arch=%s, ncpus=%u, models=%p, migratable=%d",
+ virArchToString(arch), ncpus, models, migratable);
if (cpus) {
for (i = 0; i < ncpus; i++)
VIR_DEBUG("cpus[%zu]=%p", i, cpus[i]);
}
}
- if ((driver = cpuGetSubDriver(cpus[0]->arch)) == NULL)
+ if (arch == VIR_ARCH_NONE)
+ arch = cpus[0]->arch;
+
+ if ((driver = cpuGetSubDriver(arch)) == NULL)
return NULL;
if (driver->baseline == NULL) {
virReportError(VIR_ERR_NO_SUPPORT,
_("cannot compute baseline CPU of %s architecture"),
- virArchToString(cpus[0]->arch));
+ virArchToString(arch));
return NULL;
}
virCPUProbeHost(virArch arch);
virCPUDefPtr
-virCPUBaseline(virCPUDefPtr *cpus,
+virCPUBaseline(virArch arch,
+ virCPUDefPtr *cpus,
unsigned int ncpus,
virDomainCapsCPUModelsPtr models,
bool migratable);
if (!(cpus = virCPUDefListParse(xmlCPUs, ncpus, VIR_CPU_TYPE_HOST)))
goto cleanup;
- if (!(cpu = virCPUBaseline(cpus, ncpus, NULL,
+ if (!(cpu = virCPUBaseline(VIR_ARCH_NONE, cpus, ncpus, NULL,
!!(flags & VIR_CONNECT_BASELINE_CPU_MIGRATABLE))))
goto cleanup;
if (!(cpus = virCPUDefListParse(xmlCPUs, ncpus, VIR_CPU_TYPE_HOST)))
goto cleanup;
- if (!(baseline = virCPUBaseline(cpus, ncpus, NULL,
+ if (!(baseline = virCPUBaseline(VIR_ARCH_NONE, cpus, ncpus, NULL,
!!(flags & VIR_CONNECT_BASELINE_CPU_MIGRATABLE))))
goto cleanup;
if (!(cpus = virCPUDefListParse(xmlCPUs, ncpus, VIR_CPU_TYPE_HOST)))
goto cleanup;
- if (!(cpu = virCPUBaseline(cpus, ncpus, NULL, false)))
+ if (!(cpu = virCPUBaseline(VIR_ARCH_NONE, cpus, ncpus, NULL, false)))
goto cleanup;
if ((flags & VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES) &&
if (!(cpus = virCPUDefListParse(xmlCPUs, ncpus, VIR_CPU_TYPE_HOST)))
goto cleanup;
- if (!(cpu = virCPUBaseline(cpus, ncpus, NULL, false)))
+ if (!(cpu = virCPUBaseline(VIR_ARCH_NONE, cpus, ncpus, NULL, false)))
goto cleanup;
if ((flags & VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES) &&
if (!(cpus = cpuTestLoadMultiXML(data->arch, data->name, &ncpus)))
goto cleanup;
- baseline = virCPUBaseline(cpus, ncpus, NULL,
+ baseline = virCPUBaseline(data->arch, cpus, ncpus, NULL,
!!(data->flags & VIR_CONNECT_BASELINE_CPU_MIGRATABLE));
if (baseline &&