* @cpu: CPU definition stub to be filled in
* @data: internal CPU data to be decoded into @cpu definition
* @models: list of CPU models that can be considered when decoding @data
- * @nmodels: number of CPU models in @models
* @preferred: CPU models that should be used if possible
*
* Decodes internal CPU data into a CPU definition consisting of a CPU model
int
cpuDecode(virCPUDefPtr cpu,
const virCPUData *data,
- const char **models,
- unsigned int nmodels,
+ virDomainCapsCPUModelsPtr models,
const char *preferred)
{
struct cpuArchDriver *driver;
- VIR_DEBUG("cpu=%p, data=%p, nmodels=%u, preferred=%s",
- cpu, data, nmodels, NULLSTR(preferred));
+ VIR_DEBUG("cpu=%p, data=%p, models=%p, preferred=%s",
+ cpu, data, models, NULLSTR(preferred));
if (models) {
size_t i;
- for (i = 0; i < nmodels; i++)
- VIR_DEBUG("models[%zu]=%s", i, NULLSTR(models[i]));
- }
-
- if (models == NULL && nmodels != 0) {
- virReportError(VIR_ERR_INVALID_ARG, "%s",
- _("nonzero nmodels doesn't match with NULL models"));
- return -1;
+ for (i = 0; i < models->nmodels; i++)
+ VIR_DEBUG("models[%zu]=%s", i, models->models[i].name);
}
if (cpu->type > VIR_CPU_TYPE_GUEST ||
return -1;
}
- return driver->decode(cpu, data, models, nmodels, preferred);
+ return driver->decode(cpu, data, models, preferred);
}
* @type: requested type of the CPU
* @nodeInfo: simplified CPU topology (optional)
* @models: list of CPU models that can be considered for host CPU
- * @nmodels: number of CPU models in @models
*
* Create CPU definition describing the host's CPU.
*
virCPUGetHost(virArch arch,
virCPUType type,
virNodeInfoPtr nodeInfo,
- const char **models,
- unsigned int nmodels)
+ virDomainCapsCPUModelsPtr models)
{
struct cpuArchDriver *driver;
virCPUDefPtr cpu = NULL;
- VIR_DEBUG("arch=%s, type=%s, nodeInfo=%p, models=%p, nmodels=%u",
+ VIR_DEBUG("arch=%s, type=%s, nodeInfo=%p, models=%p",
virArchToString(arch), virCPUTypeToString(type), nodeInfo,
- models, nmodels);
+ models);
if (!(driver = cpuGetSubDriver(arch)))
return NULL;
* filled in.
*/
if (driver->getHost) {
- if (driver->getHost(cpu, models, nmodels) < 0 &&
+ if (driver->getHost(cpu, models) < 0 &&
!nodeInfo)
goto error;
} else if (nodeInfo) {
if (virCapabilitiesGetNodeInfo(&nodeinfo))
return NULL;
- return virCPUGetHost(arch, VIR_CPU_TYPE_HOST, &nodeinfo, NULL, 0);
+ return virCPUGetHost(arch, VIR_CPU_TYPE_HOST, &nodeinfo, NULL);
}
* @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
- * @nmodels: number of CPU models in @models
* @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
+ * host 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.
*
virCPUDefPtr
cpuBaseline(virCPUDefPtr *cpus,
unsigned int ncpus,
- const char **models,
- unsigned int nmodels,
+ virDomainCapsCPUModelsPtr models,
bool migratable)
{
struct cpuArchDriver *driver;
size_t i;
- VIR_DEBUG("ncpus=%u, nmodels=%u", ncpus, nmodels);
+ VIR_DEBUG("ncpus=%u, models=%p, migratable=%d", ncpus, models, migratable);
if (cpus) {
for (i = 0; i < ncpus; i++)
VIR_DEBUG("cpus[%zu]=%p", i, cpus[i]);
}
if (models) {
- for (i = 0; i < nmodels; i++)
- VIR_DEBUG("models[%zu]=%s", i, NULLSTR(models[i]));
+ for (i = 0; i < models->nmodels; i++)
+ VIR_DEBUG("models[%zu]=%s", i, models->models[i].name);
}
if (cpus == NULL && ncpus != 0) {
}
}
- if (models == NULL && nmodels != 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- "%s", _("nonzero nmodels doesn't match with NULL models"));
- return NULL;
- }
-
if ((driver = cpuGetSubDriver(cpus[0]->arch)) == NULL)
return NULL;
return NULL;
}
- return driver->baseline(cpus, ncpus, models, nmodels, migratable);
+ return driver->baseline(cpus, ncpus, models, migratable);
}
*
* @model: CPU model to be checked
* @models: list of supported CPU models
- * @nmodels: number of models in @models
*
* Checks whether @model can be found in the list of supported @models.
- * If @models is empty, all models are supported.
+ * If @models is NULL, all models are supported.
*
* Returns true if @model is supported, false otherwise.
*/
bool
virCPUModelIsAllowed(const char *model,
- const char **models,
- unsigned int nmodels)
+ virDomainCapsCPUModelsPtr models)
{
size_t i;
- if (!models || !nmodels)
+ if (!models)
return true;
- for (i = 0; i < nmodels; i++) {
- if (models[i] && STREQ(models[i], model))
+ for (i = 0; i < models->nmodels; i++) {
+ if (STREQ(models->models[i].name, model))
return true;
}
return false;
*
* @arch: CPU architecture
* @cpu: CPU definition to be translated
- * @models: NULL-terminated list of allowed CPU models (NULL if all are allowed)
- * @nmodels: number of CPU models in @models
+ * @models: list of allowed CPU models (NULL if all are allowed)
*
* Translates @cpu model (if allowed by @cpu->fallback) to a closest CPU model
* from @models list.
int
virCPUTranslate(virArch arch,
virCPUDefPtr cpu,
- const char **models,
- unsigned int nmodels)
+ virDomainCapsCPUModelsPtr models)
{
struct cpuArchDriver *driver;
- VIR_DEBUG("arch=%s, cpu=%p, model=%s, models=%p, nmodels=%u",
- virArchToString(arch), cpu, NULLSTR(cpu->model), models, nmodels);
+ VIR_DEBUG("arch=%s, cpu=%p, model=%s, models=%p",
+ virArchToString(arch), cpu, NULLSTR(cpu->model), models);
if (!(driver = cpuGetSubDriver(arch)))
return -1;
cpu->mode == VIR_CPU_MODE_HOST_PASSTHROUGH)
return 0;
- if (virCPUModelIsAllowed(cpu->model, models, nmodels))
+ if (virCPUModelIsAllowed(cpu->model, models))
return 0;
if (cpu->fallback != VIR_CPU_FALLBACK_ALLOW) {
return -1;
}
- if (driver->translate(cpu, models, nmodels) < 0)
+ if (driver->translate(cpu, models) < 0)
return -1;
VIR_DEBUG("model=%s", NULLSTR(cpu->model));
# include "virerror.h"
# include "datatypes.h"
# include "virarch.h"
+# include "domain_capabilities.h"
# include "cpu_conf.h"
# include "cpu_x86_data.h"
# include "cpu_ppc64_data.h"
typedef int
(*cpuArchDecode) (virCPUDefPtr cpu,
const virCPUData *data,
- const char **models,
- unsigned int nmodels,
+ virDomainCapsCPUModelsPtr models,
const char *preferred);
typedef int
typedef int
(*virCPUArchGetHost)(virCPUDefPtr cpu,
- const char **models,
- unsigned int nmodels);
+ virDomainCapsCPUModelsPtr models);
typedef virCPUDefPtr
(*cpuArchBaseline) (virCPUDefPtr *cpus,
unsigned int ncpus,
- const char **models,
- unsigned int nmodels,
+ virDomainCapsCPUModelsPtr models,
bool migratable);
typedef int
typedef int
(*virCPUArchTranslate)(virCPUDefPtr cpu,
- const char **models,
- unsigned int nmodels);
+ virDomainCapsCPUModelsPtr models);
typedef int
(*virCPUArchConvertLegacy)(virCPUDefPtr cpu);
int
cpuDecode (virCPUDefPtr cpu,
const virCPUData *data,
- const char **models,
- unsigned int nmodels,
+ virDomainCapsCPUModelsPtr models,
const char *preferred)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
virCPUGetHost(virArch arch,
virCPUType type,
virNodeInfoPtr nodeInfo,
- const char **models,
- unsigned int nmodels);
+ virDomainCapsCPUModelsPtr models);
virCPUDefPtr
virCPUProbeHost(virArch arch);
virCPUDefPtr
cpuBaseline (virCPUDefPtr *cpus,
unsigned int ncpus,
- const char **models,
- unsigned int nmodels,
+ virDomainCapsCPUModelsPtr models,
bool migratable);
int
bool
virCPUModelIsAllowed(const char *model,
- const char **models,
- unsigned int nmodels)
+ virDomainCapsCPUModelsPtr models)
ATTRIBUTE_NONNULL(1);
int
int
virCPUTranslate(virArch arch,
virCPUDefPtr cpu,
- const char **models,
- unsigned int nmodels)
+ virDomainCapsCPUModelsPtr models)
ATTRIBUTE_NONNULL(2);
int
static virCPUDefPtr
armBaseline(virCPUDefPtr *cpus,
unsigned int ncpus ATTRIBUTE_UNUSED,
- const char **models ATTRIBUTE_UNUSED,
- unsigned int nmodels ATTRIBUTE_UNUSED,
+ virDomainCapsCPUModelsPtr models ATTRIBUTE_UNUSED,
bool migratable ATTRIBUTE_UNUSED)
{
virCPUDefPtr cpu = NULL;
static int
ppc64DriverDecode(virCPUDefPtr cpu,
const virCPUData *data,
- const char **models,
- unsigned int nmodels,
+ virDomainCapsCPUModelsPtr models,
const char *preferred ATTRIBUTE_UNUSED)
{
int ret = -1;
goto cleanup;
}
- if (!virCPUModelIsAllowed(model->name, models, nmodels)) {
+ if (!virCPUModelIsAllowed(model->name, models)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("CPU model %s is not supported by hypervisor"),
model->name);
static int
virCPUppc64GetHost(virCPUDefPtr cpu,
- const char **models,
- unsigned int nmodels)
+ virDomainCapsCPUModelsPtr models)
{
virCPUDataPtr cpuData = NULL;
virCPUppc64Data *data;
#endif
data->pvr[0].mask = 0xfffffffful;
- ret = ppc64DriverDecode(cpu, cpuData, models, nmodels, NULL);
+ ret = ppc64DriverDecode(cpu, cpuData, models, NULL);
cleanup:
virCPUppc64DataFree(cpuData);
static virCPUDefPtr
ppc64DriverBaseline(virCPUDefPtr *cpus,
unsigned int ncpus,
- const char **models ATTRIBUTE_UNUSED,
- unsigned int nmodels ATTRIBUTE_UNUSED,
+ virDomainCapsCPUModelsPtr models ATTRIBUTE_UNUSED,
bool migratable ATTRIBUTE_UNUSED)
{
struct ppc64_map *map;
static int
x86Decode(virCPUDefPtr cpu,
const virCPUx86Data *cpuData,
- const char **models,
- unsigned int nmodels,
+ virDomainCapsCPUModelsPtr models,
const char *preferred,
bool migratable)
{
*/
for (i = map->nmodels - 1; i >= 0; i--) {
candidate = map->models[i];
- if (!virCPUModelIsAllowed(candidate->name, models, nmodels)) {
+ if (!virCPUModelIsAllowed(candidate->name, models)) {
if (preferred && STREQ(candidate->name, preferred)) {
if (cpu->fallback != VIR_CPU_FALLBACK_ALLOW) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
static int
x86DecodeCPUData(virCPUDefPtr cpu,
const virCPUData *data,
- const char **models,
- unsigned int nmodels,
+ virDomainCapsCPUModelsPtr models,
const char *preferred)
{
- return x86Decode(cpu, &data->data.x86, models, nmodels, preferred, false);
+ return x86Decode(cpu, &data->data.x86, models, preferred, false);
}
static int
virCPUx86GetHost(virCPUDefPtr cpu,
- const char **models,
- unsigned int nmodels)
+ virDomainCapsCPUModelsPtr models)
{
virCPUDataPtr cpuData = NULL;
int ret = -1;
cpuidSet(CPUX86_EXTENDED, cpuData) < 0)
goto cleanup;
- ret = x86DecodeCPUData(cpu, cpuData, models, nmodels, NULL);
+ ret = x86DecodeCPUData(cpu, cpuData, models, NULL);
cleanup:
virCPUx86DataFree(cpuData);
static virCPUDefPtr
x86Baseline(virCPUDefPtr *cpus,
unsigned int ncpus,
- const char **models,
- unsigned int nmodels,
+ virDomainCapsCPUModelsPtr models,
bool migratable)
{
virCPUx86MapPtr map = NULL;
virCPUx86DataAddCPUIDInt(&base_model->data, &vendor->cpuid) < 0)
goto error;
- if (x86Decode(cpu, &base_model->data, models, nmodels, modelName, migratable) < 0)
+ if (x86Decode(cpu, &base_model->data, models, modelName, migratable) < 0)
goto error;
if (STREQ_NULLABLE(cpu->model, modelName))
static int
virCPUx86Translate(virCPUDefPtr cpu,
- const char **models,
- unsigned int nmodels)
+ virDomainCapsCPUModelsPtr models)
{
virCPUDefPtr translated = NULL;
virCPUx86MapPtr map;
if (!(translated = virCPUDefCopyWithoutModel(cpu)))
goto cleanup;
- if (x86Decode(translated, &model->data, models, nmodels, NULL, false) < 0)
+ if (x86Decode(translated, &model->data, models, NULL, false) < 0)
goto cleanup;
for (i = 0; i < cpu->nfeatures; i++) {
ret = 0;
if (!(data = libxlCapsNodeData(cpu, phy_info->hw_cap, version)) ||
- cpuDecode(cpu, data, NULL, 0, NULL) < 0) {
+ cpuDecode(cpu, data, NULL, NULL) < 0) {
VIR_WARN("Failed to initialize host cpu features");
goto error;
}
if (!(cpus = virCPUDefListParse(xmlCPUs, ncpus, VIR_CPU_TYPE_HOST)))
goto cleanup;
- if (!(cpu = cpuBaseline(cpus, ncpus, NULL, 0,
+ if (!(cpu = cpuBaseline(cpus, ncpus, NULL,
!!(flags & VIR_CONNECT_BASELINE_CPU_MIGRATABLE))))
goto cleanup;
virQEMUCapsPtr qemuCaps,
virDomainVirtType type)
{
- size_t nmodels;
- char **models;
- virCPUDefPtr cpu;
-
- if (virQEMUCapsGetCPUDefinitions(qemuCaps, type, &models, &nmodels) < 0)
- return NULL;
-
- cpu = virCPUGetHost(hostArch, VIR_CPU_TYPE_GUEST, NULL,
- (const char **) models, nmodels);
-
- virStringListFreeCount(models, nmodels);
- return cpu;
+ return virCPUGetHost(hostArch, VIR_CPU_TYPE_GUEST, NULL,
+ virQEMUCapsGetCPUDefinitions(qemuCaps, type));
}
}
-int
+virDomainCapsCPUModelsPtr
virQEMUCapsGetCPUDefinitions(virQEMUCapsPtr qemuCaps,
- virDomainVirtType type,
- char ***names,
- size_t *count)
+ virDomainVirtType type)
{
- size_t i;
- char **models = NULL;
- virDomainCapsCPUModelsPtr cpus;
-
- *count = 0;
- if (names)
- *names = NULL;
-
if (type == VIR_DOMAIN_VIRT_KVM)
- cpus = qemuCaps->kvmCPUModels;
+ return qemuCaps->kvmCPUModels;
else
- cpus = qemuCaps->tcgCPUModels;
-
- if (!cpus)
- return 0;
-
- if (names && VIR_ALLOC_N(models, cpus->nmodels) < 0)
- return -1;
-
- for (i = 0; i < cpus->nmodels; i++) {
- virDomainCapsCPUModelPtr cpu = cpus->models + i;
- if (models && VIR_STRDUP(models[i], cpu->name) < 0)
- goto error;
- }
-
- if (names)
- *names = models;
- *count = cpus->nmodels;
- return 0;
-
- error:
- virStringListFreeCount(models, i);
- return -1;
+ return qemuCaps->tcgCPUModels;
}
virCPUDataPtr data = NULL;
unsigned long long sigFamily = 0;
unsigned long long sigModel = 0;
- size_t nmodels = 0;
- char **models = NULL;
int ret = -1;
size_t i;
if (virCPUx86DataSetSignature(data, sigFamily, sigModel) < 0)
goto cleanup;
- if (virQEMUCapsGetCPUDefinitions(qemuCaps, type, &models, &nmodels) < 0 ||
- cpuDecode(cpu, data, (const char **) models, nmodels, NULL) < 0)
+ if (cpuDecode(cpu, data,
+ virQEMUCapsGetCPUDefinitions(qemuCaps, type),
+ NULL) < 0)
goto cleanup;
ret = 0;
cleanup:
virCPUDataFree(data);
- virStringListFreeCount(models, nmodels);
return ret;
}
} else if (type == VIR_DOMAIN_VIRT_KVM &&
virCPUGetHostIsSupported(qemuCaps->arch)) {
if (!(fullCPU = virCPUGetHost(qemuCaps->arch, VIR_CPU_TYPE_GUEST,
- NULL, NULL, 0)))
+ NULL, NULL)))
goto error;
for (i = 0; i < cpu->nfeatures; i++) {
const char **name,
size_t count,
virDomainCapsCPUUsable usable);
-int virQEMUCapsGetCPUDefinitions(virQEMUCapsPtr qemuCaps,
- virDomainVirtType type,
- char ***names,
- size_t *count);
+virDomainCapsCPUModelsPtr virQEMUCapsGetCPUDefinitions(virQEMUCapsPtr qemuCaps,
+ virDomainVirtType type);
typedef enum {
/* Host CPU definition reported in domain capabilities. */
if (!(cpus = virCPUDefListParse(xmlCPUs, ncpus, VIR_CPU_TYPE_HOST)))
goto cleanup;
- if (!(baseline = cpuBaseline(cpus, ncpus, NULL, 0,
+ if (!(baseline = cpuBaseline(cpus, ncpus, NULL,
!!(flags & VIR_CONNECT_BASELINE_CPU_MIGRATABLE))))
goto cleanup;
unsigned int flags)
{
int ret = -1;
- size_t nmodels = 0;
- char **models = NULL;
if (!def->cpu)
return 0;
VIR_QEMU_CAPS_HOST_CPU_MIGRATABLE)) < 0)
goto cleanup;
- if (virQEMUCapsGetCPUDefinitions(qemuCaps, def->virtType,
- &models, &nmodels) < 0 ||
- virCPUTranslate(def->os.arch, def->cpu,
- (const char **) models, nmodels) < 0)
+ if (virCPUTranslate(def->os.arch, def->cpu,
+ virQEMUCapsGetCPUDefinitions(qemuCaps, def->virtType)) < 0)
goto cleanup;
def->cpu->fallback = VIR_CPU_FALLBACK_FORBID;
ret = 0;
cleanup:
- virStringListFreeCount(models, nmodels);
return ret;
}
if (!(cpus = virCPUDefListParse(xmlCPUs, ncpus, VIR_CPU_TYPE_HOST)))
goto cleanup;
- if (!(cpu = cpuBaseline(cpus, ncpus, NULL, 0, false)))
+ if (!(cpu = cpuBaseline(cpus, ncpus, NULL, false)))
goto cleanup;
if ((flags & VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES) &&
virArch arch;
const char *host;
const char *name;
- const char **models;
+ virDomainCapsCPUModelsPtr models;
const char *modelsName;
- unsigned int nmodels;
unsigned int flags;
int result;
};
}
if (virCPUUpdate(host->arch, cpu, host) < 0 ||
- virCPUTranslate(host->arch, cpu, data->models, data->nmodels) < 0) {
+ virCPUTranslate(host->arch, cpu, data->models) < 0) {
ret = -1;
goto cleanup;
}
virBufferAsprintf(&buf, "%s+%s", data->host, data->name);
- if (data->nmodels)
+ if (data->modelsName)
virBufferAsprintf(&buf, ",%s", data->modelsName);
virBufferAddLit(&buf, "-result");
if (!(cpus = cpuTestLoadMultiXML(data->arch, data->name, &ncpus)))
goto cleanup;
- baseline = cpuBaseline(cpus, ncpus, NULL, 0,
+ baseline = cpuBaseline(cpus, ncpus, NULL,
!!(data->flags & VIR_CONNECT_BASELINE_CPU_MIGRATABLE));
if (baseline &&
cpu->type = VIR_CPU_TYPE_HOST;
}
- if (cpuDecode(cpu, hostData, NULL, 0, NULL) < 0)
+ if (cpuDecode(cpu, hostData, NULL, NULL) < 0)
goto cleanup;
if (virAsprintf(&result, "cpuid-%s-%s",
#endif
-static const char *model486[] = { "486" };
-static const char *nomodel[] = { "nomodel" };
-static const char *models[] = { "qemu64", "core2duo", "Nehalem" };
-static const char *haswell[] = { "SandyBridge", "Haswell" };
-static const char *ppc_models[] = { "POWER6", "POWER7", "POWER8" };
+static const char *model486_list[] = { "486", NULL };
+static const char *nomodel_list[] = { "nomodel", NULL };
+static const char *models_list[] = { "qemu64", "core2duo", "Nehalem", NULL };
+static const char *haswell_list[] = { "SandyBridge", "Haswell", NULL };
+static const char *ppc_models_list[] = { "POWER6", "POWER7", "POWER8", NULL };
+
+static virDomainCapsCPUModelsPtr
+cpuTestInitModels(const char **list)
+{
+ virDomainCapsCPUModelsPtr cpus;
+ const char **model;
+
+ if (!(cpus = virDomainCapsCPUModelsNew(0)))
+ return NULL;
+
+ for (model = list; *model; model++) {
+ if (virDomainCapsCPUModelsAdd(cpus, *model, -1,
+ VIR_DOMCAPS_CPU_USABLE_UNKNOWN, NULL) < 0)
+ goto error;
+ }
+
+ return cpus;
+
+ error:
+ virObjectUnref(cpus);
+ return NULL;
+}
+
static int
mymain(void)
{
+ virDomainCapsCPUModelsPtr model486 = NULL;
+ virDomainCapsCPUModelsPtr nomodel = NULL;
+ virDomainCapsCPUModelsPtr models = NULL;
+ virDomainCapsCPUModelsPtr haswell = NULL;
+ virDomainCapsCPUModelsPtr ppc_models = NULL;
int ret = 0;
#if WITH_QEMU && WITH_YAJL
virEventRegisterDefaultImpl();
#endif
+ if (!(model486 = cpuTestInitModels(model486_list)) ||
+ !(nomodel = cpuTestInitModels(nomodel_list)) ||
+ !(models = cpuTestInitModels(models_list)) ||
+ !(haswell = cpuTestInitModels(haswell_list)) ||
+ !(ppc_models = cpuTestInitModels(ppc_models_list))) {
+ ret = -1;
+ goto cleanup;
+ }
+
#define DO_TEST(arch, api, name, host, cpu, \
- models, nmodels, flags, result) \
+ models, flags, result) \
do { \
struct data data = { \
arch, host, cpu, models, \
models == NULL ? NULL : #models, \
- nmodels, flags, result \
+ flags, result \
}; \
char *testLabel; \
char *tmp; \
#define DO_TEST_COMPARE(arch, host, cpu, result) \
DO_TEST(arch, cpuTestCompare, \
host "/" cpu " (" #result ")", \
- host, cpu, NULL, 0, 0, result)
+ host, cpu, NULL, 0, result)
#define DO_TEST_UPDATE_ONLY(arch, host, cpu) \
DO_TEST(arch, cpuTestUpdate, \
cpu " on " host, \
- host, cpu, NULL, 0, 0, 0)
+ host, cpu, NULL, 0, 0)
#define DO_TEST_UPDATE(arch, host, cpu, result) \
do { \
ret = -1; \
} else { \
DO_TEST(arch, cpuTestBaseline, label, NULL, \
- "baseline-" name, NULL, 0, flags, result); \
+ "baseline-" name, NULL, flags, result); \
} \
VIR_FREE(label); \
} while (0)
#define DO_TEST_HASFEATURE(arch, host, feature, result) \
DO_TEST(arch, cpuTestHasFeature, \
host "/" feature " (" #result ")", \
- host, feature, NULL, 0, 0, result)
+ host, feature, NULL, 0, result)
#define DO_TEST_GUESTCPU(arch, host, cpu, models, result) \
DO_TEST(arch, cpuTestGuestCPU, \
host "/" cpu " (" #models ")", \
- host, cpu, models, \
- models == NULL ? 0 : sizeof(models) / sizeof(char *), \
- 0, result)
+ host, cpu, models, 0, result)
#if WITH_QEMU && WITH_YAJL
# define DO_TEST_CPUID_JSON(arch, host, json) \
do { \
if (json) { \
DO_TEST(arch, cpuTestJSONCPUID, host, host, \
- NULL, NULL, 0, 0, 0); \
+ NULL, NULL, 0, 0); \
} \
} while (0)
#else
#define DO_TEST_CPUID(arch, host, json) \
do { \
DO_TEST(arch, cpuTestHostCPUID, host, host, \
- NULL, NULL, 0, 0, 0); \
+ NULL, NULL, 0, 0); \
DO_TEST(arch, cpuTestGuestCPUID, host, host, \
- NULL, NULL, 0, 0, 0); \
+ NULL, NULL, 0, 0); \
DO_TEST_CPUID_JSON(arch, host, json); \
if (json) { \
DO_TEST(arch, cpuTestUpdateLive, host, host, \
- NULL, NULL, 0, 0, 0); \
+ NULL, NULL, 0, 0); \
} \
} while (0)
DO_TEST_CPUID(VIR_ARCH_X86_64, "Xeon-W3520", true);
DO_TEST_CPUID(VIR_ARCH_X86_64, "Xeon-X5460", false);
+ cleanup:
#if WITH_QEMU && WITH_YAJL
qemuTestDriverFree(&driver);
#endif
+ virObjectUnref(model486);
+ virObjectUnref(nomodel);
+ virObjectUnref(models);
+ virObjectUnref(haswell);
+ virObjectUnref(ppc_models);
+
return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
}