Parallels: Include CPU info in the capabilities XML

Openstack uses (or will start to using) CPU info from the
capabilities XML. So this section is expanded, added CPU info
about arch, type and info about number of cores, sockets and threads.

Signed-off-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
Alexander Burluka 2014-06-05 09:50:06 +04:00 committed by Eric Blake
parent d1c69d4158
commit 4d06af97d3

View File

@ -118,8 +118,11 @@ parallelsDomObjFreePrivate(void *p)
static virCapsPtr
parallelsBuildCapabilities(void)
{
virCapsPtr caps;
virCapsPtr caps = NULL;
virCPUDefPtr cpu = NULL;
virCPUDataPtr data = NULL;
virCapsGuestPtr guest;
virNodeInfo nodeinfo;
if ((caps = virCapabilitiesNew(virArchFromHost(),
0, 0)) == NULL)
@ -148,11 +151,32 @@ parallelsBuildCapabilities(void)
"parallels", NULL, NULL, 0, NULL) == NULL)
goto error;
if (VIR_ALLOC(cpu) < 0)
goto error;
if (nodeGetInfo(&nodeinfo))
goto error;
cpu->arch = caps->host.arch;
cpu->type = VIR_CPU_TYPE_HOST;
cpu->sockets = nodeinfo.sockets;
cpu->cores = nodeinfo.cores;
cpu->threads = nodeinfo.threads;
caps->host.cpu = cpu;
if (!(data = cpuNodeData(cpu->arch))
|| cpuDecode(cpu, data, NULL, 0, NULL) < 0) {
goto cleanup;
}
cleanup:
cpuDataFree(data);
return caps;
error:
virObjectUnref(caps);
return NULL;
goto cleanup;
}
static char *