doc = NULL;
}
- if (!(cpu = cpuBaseline(cpus, ncpus, models, nmodels, flags)))
+ if (!(cpu = cpuBaseline(cpus, ncpus, models, nmodels,
+ !!(flags & VIR_CONNECT_BASELINE_CPU_MIGRATABLE))))
goto error;
if ((flags & VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES) &&
* @ncpus: number of CPUs in @cpus
* @models: list of CPU models that can be considered for the baseline CPU
* @nmodels: number of CPU models in @models
- * @flags: bitwise-OR of virConnectBaselineCPUFlags
+ * @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 array 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.
*
- * If @flags includes VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES then libvirt
- * will explicitly list all CPU features that are part of the host CPU,
- * without this flag features that are part of the CPU model will not be
- * listed.
- *
* Returns baseline CPU definition or NULL on error.
*/
virCPUDefPtr
unsigned int ncpus,
const char **models,
unsigned int nmodels,
- unsigned int flags)
+ bool migratable)
{
struct cpuArchDriver *driver;
size_t i;
return NULL;
}
- return driver->baseline(cpus, ncpus, models, nmodels, flags);
+ return driver->baseline(cpus, ncpus, models, nmodels, migratable);
}
unsigned int ncpus,
const char **models,
unsigned int nmodels,
- unsigned int flags);
+ bool migratable);
typedef int
(*virCPUArchUpdate)(virCPUDefPtr guest,
unsigned int ncpus,
const char **models,
unsigned int nmodels,
- unsigned int flags);
+ bool migratable);
int
virCPUUpdate(virArch arch,
unsigned int ncpus ATTRIBUTE_UNUSED,
const char **models ATTRIBUTE_UNUSED,
unsigned int nmodels ATTRIBUTE_UNUSED,
- unsigned int flags)
+ bool migratable ATTRIBUTE_UNUSED)
{
virCPUDefPtr cpu = NULL;
- virCheckFlags(VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES |
- VIR_CONNECT_BASELINE_CPU_MIGRATABLE, NULL);
-
if (VIR_ALLOC(cpu) < 0 ||
VIR_STRDUP(cpu->model, cpus[0]->model) < 0) {
virCPUDefFree(cpu);
unsigned int ncpus,
const char **models ATTRIBUTE_UNUSED,
unsigned int nmodels ATTRIBUTE_UNUSED,
- unsigned int flags)
+ bool migratable ATTRIBUTE_UNUSED)
{
struct ppc64_map *map;
const struct ppc64_model *model;
virCPUDefPtr cpu = NULL;
size_t i;
- virCheckFlags(VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES |
- VIR_CONNECT_BASELINE_CPU_MIGRATABLE, NULL);
-
if (!(map = ppc64LoadMap()))
goto error;
const char **models,
unsigned int nmodels,
const char *preferred,
- unsigned int flags)
+ bool migratable)
{
int ret = -1;
virCPUx86MapPtr map;
ssize_t i;
int rc;
- virCheckFlags(VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES |
- VIR_CONNECT_BASELINE_CPU_MIGRATABLE, -1);
-
if (!cpuData || x86DataCopy(&data, cpuData) < 0)
return -1;
/* Remove non-migratable features if requested
* Note: this only works as long as no CPU model contains non-migratable
* features directly */
- if (flags & VIR_CONNECT_BASELINE_CPU_MIGRATABLE) {
+ if (migratable) {
i = 0;
while (i < cpuModel->nfeatures) {
if (x86FeatureIsMigratable(cpuModel->features[i].name, map)) {
unsigned int nmodels,
const char *preferred)
{
- return x86Decode(cpu, &data->data.x86, models, nmodels, preferred, 0);
+ return x86Decode(cpu, &data->data.x86, models, nmodels, preferred, false);
}
unsigned int ncpus,
const char **models,
unsigned int nmodels,
- unsigned int flags)
+ bool migratable)
{
virCPUx86MapPtr map = NULL;
virCPUx86ModelPtr base_model = NULL;
const char *modelName;
bool matchingNames = true;
- virCheckFlags(VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES |
- VIR_CONNECT_BASELINE_CPU_MIGRATABLE, NULL);
-
if (!(map = virCPUx86GetMap()))
goto error;
virCPUx86DataAddCPUIDInt(&base_model->data, &vendor->cpuid) < 0)
goto error;
- if (x86Decode(cpu, &base_model->data, models, nmodels, modelName, flags) < 0)
+ if (x86Decode(cpu, &base_model->data, models, nmodels, modelName, migratable) < 0)
goto error;
if (STREQ_NULLABLE(cpu->model, modelName))
if (!(translated = virCPUDefCopyWithoutModel(cpu)))
goto cleanup;
- if (x86Decode(translated, &model->data, models, nmodels, NULL, 0) < 0)
+ if (x86Decode(translated, &model->data, models, nmodels, NULL, false) < 0)
goto cleanup;
for (i = 0; i < cpu->nfeatures; i++) {
if (!(cpus = cpuTestLoadMultiXML(data->arch, data->name, &ncpus)))
goto cleanup;
- baseline = cpuBaseline(cpus, ncpus, NULL, 0, data->flags);
+ baseline = cpuBaseline(cpus, ncpus, NULL, 0,
+ !!(data->flags & VIR_CONNECT_BASELINE_CPU_MIGRATABLE));
if (baseline &&
(data->flags & VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES) &&