conf: move NUMA capabilities into self contained object

The NUMA cells are stored directly in the virCapsHostPtr
struct. This moves them into their own struct allowing
them to be stored independantly of the rest of the host
capabilities. The change is used as an excuse to switch
the representation to use a GPtrArray too.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
Daniel P. Berrangé
2019-11-29 09:55:59 +00:00
parent bc1676fc2f
commit 6cc992bd1a
21 changed files with 194 additions and 165 deletions

View File

@@ -1053,10 +1053,10 @@ virCapsPtr virTestGenericCapsInit(void)
* Build NUMA topology with cell id starting from (0 + seq)
* for testing
*/
int
virTestCapsBuildNUMATopology(virCapsPtr caps,
int seq)
virCapsHostNUMAPtr
virTestCapsBuildNUMATopology(int seq)
{
virCapsHostNUMAPtr caps = virCapabilitiesHostNUMANew();
virCapsHostNUMACellCPUPtr cell_cpus = NULL;
int core_id, cell_id;
int id;
@@ -1077,22 +1077,21 @@ virTestCapsBuildNUMATopology(virCapsPtr caps,
}
id++;
if (virCapabilitiesAddHostNUMACell(caps, cell_id + seq,
MAX_MEM_IN_CELL,
MAX_CPUS_IN_CELL, cell_cpus,
VIR_ARCH_NONE, NULL,
VIR_ARCH_NONE, NULL) < 0)
goto error;
virCapabilitiesHostNUMAAddCell(caps, cell_id + seq,
MAX_MEM_IN_CELL,
MAX_CPUS_IN_CELL, cell_cpus,
VIR_ARCH_NONE, NULL,
VIR_ARCH_NONE, NULL);
cell_cpus = NULL;
}
return 0;
return caps;
error:
virCapabilitiesClearHostNUMACellCPUTopology(cell_cpus, MAX_CPUS_IN_CELL);
virCapabilitiesHostNUMAUnref(caps);
VIR_FREE(cell_cpus);
return -1;
return NULL;
}
static virDomainDefParserConfig virTestGenericDomainDefParserConfig = {