diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 387a58180d82150d170a30cc6f1ebe6cb9f6d432..784ba8889cd72e937c260e80fcce28ef4625564e 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -183,6 +183,18 @@ struct _qemuCaps { virObject object; virBitmapPtr flags; + + unsigned int version; + unsigned int kvmVersion; + + char *arch; + + size_t ncpuDefinitions; + char **cpuDefinitions; + + size_t nmachineTypes; + char **machineTypes; + char **machineAliases; }; @@ -1718,6 +1730,21 @@ no_memory: void qemuCapsDispose(void *obj) { qemuCapsPtr caps = obj; + size_t i; + + VIR_FREE(caps->arch); + + for (i = 0 ; i < caps->nmachineTypes ; i++) { + VIR_FREE(caps->machineTypes[i]); + VIR_FREE(caps->machineAliases[i]); + } + VIR_FREE(caps->machineTypes); + VIR_FREE(caps->machineAliases); + + for (i = 0 ; i < caps->ncpuDefinitions ; i++) { + VIR_FREE(caps->cpuDefinitions[i]); + } + VIR_FREE(caps->cpuDefinitions); virBitmapFree(caps->flags); } @@ -1768,3 +1795,54 @@ qemuCapsGet(qemuCapsPtr caps, else return b; } + + +const char *qemuCapsGetArch(qemuCapsPtr caps) +{ + return caps->arch; +} + + +unsigned int qemuCapsGetVersion(qemuCapsPtr caps) +{ + return caps->version; +} + + +unsigned int qemuCapsGetKVMVersion(qemuCapsPtr caps) +{ + return caps->kvmVersion; +} + + +size_t qemuCapsGetCPUDefinitions(qemuCapsPtr caps, + char ***names) +{ + *names = caps->cpuDefinitions; + return caps->ncpuDefinitions; +} + + +size_t qemuCapsGetMachineTypes(qemuCapsPtr caps, + char ***names) +{ + *names = caps->machineTypes; + return caps->nmachineTypes; +} + + +const char *qemuCapsGetCanonicalMachine(qemuCapsPtr caps, + const char *name) + +{ + size_t i; + + for (i = 0 ; i < caps->nmachineTypes ; i++) { + if (!caps->machineAliases[i]) + continue; + if (STREQ(caps->machineAliases[i], name)) + return caps->machineTypes[i]; + } + + return name; +} diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index 67e28ae64345afe66793570f274c3da78a537bc6..05e4ad11c705db9a02ba40a3a62c6d92441060b0 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -164,6 +164,16 @@ bool qemuCapsGet(qemuCapsPtr caps, char *qemuCapsFlagsString(qemuCapsPtr caps); +const char *qemuCapsGetArch(qemuCapsPtr caps); +unsigned int qemuCapsGetVersion(qemuCapsPtr caps); +unsigned int qemuCapsGetKVMVersion(qemuCapsPtr caps); +size_t qemuCapsGetCPUDefinitions(qemuCapsPtr caps, + char ***names); +size_t qemuCapsGetMachineTypes(qemuCapsPtr caps, + char ***names); +const char *qemuCapsGetCanonicalMachine(qemuCapsPtr caps, + const char *name); + virCapsPtr qemuCapsInit(virCapsPtr old_caps); int qemuCapsProbeMachineTypes(const char *binary,