conf: Move all NUMA configuration to virDomainNuma

For historical reasons data regarding NUMA configuration were split
between the CPU definition and numatune. We cannot do anything about the
XML still being split, but we certainly can at least store the relevant
data in one place.

This patch moves the NUMA stuff to the right place.
This commit is contained in:
Peter Krempa 2015-02-16 17:28:48 +01:00
parent b9ddb25822
commit 181742d43f
9 changed files with 63 additions and 96 deletions

View File

@ -73,16 +73,11 @@ virCPUDefFreeModel(virCPUDefPtr def)
void void
virCPUDefFree(virCPUDefPtr def) virCPUDefFree(virCPUDefPtr def)
{ {
size_t i;
if (!def) if (!def)
return; return;
virCPUDefFreeModel(def); virCPUDefFreeModel(def);
for (i = 0; i < def->ncells; i++)
virBitmapFree(def->cells[i].cpumask);
VIR_FREE(def->cells);
VIR_FREE(def->vendor_id); VIR_FREE(def->vendor_id);
VIR_FREE(def); VIR_FREE(def);
@ -126,7 +121,6 @@ virCPUDefPtr
virCPUDefCopy(const virCPUDef *cpu) virCPUDefCopy(const virCPUDef *cpu)
{ {
virCPUDefPtr copy; virCPUDefPtr copy;
size_t i;
if (!cpu || VIR_ALLOC(copy) < 0) if (!cpu || VIR_ALLOC(copy) < 0)
return NULL; return NULL;
@ -143,20 +137,6 @@ virCPUDefCopy(const virCPUDef *cpu)
if (virCPUDefCopyModel(copy, cpu, false) < 0) if (virCPUDefCopyModel(copy, cpu, false) < 0)
goto error; goto error;
if (cpu->ncells) {
if (VIR_ALLOC_N(copy->cells, cpu->ncells) < 0)
goto error;
for (i = 0; i < cpu->ncells; i++) {
copy->cells[i].mem = cpu->cells[i].mem;
copy->cells[i].cpumask = virBitmapNewCopy(cpu->cells[i].cpumask);
if (!copy->cells[i].cpumask)
goto error;
}
}
return copy; return copy;
error: error:
@ -429,11 +409,12 @@ virCPUDefParseXML(xmlNodePtr node,
char * char *
virCPUDefFormat(virCPUDefPtr def, virCPUDefFormat(virCPUDefPtr def,
virDomainNumaPtr numa,
bool updateCPU) bool updateCPU)
{ {
virBuffer buf = VIR_BUFFER_INITIALIZER; virBuffer buf = VIR_BUFFER_INITIALIZER;
if (virCPUDefFormatBufFull(&buf, def, updateCPU) < 0) if (virCPUDefFormatBufFull(&buf, def, numa, updateCPU) < 0)
goto cleanup; goto cleanup;
if (virBufferCheckError(&buf) < 0) if (virBufferCheckError(&buf) < 0)
@ -450,6 +431,7 @@ virCPUDefFormat(virCPUDefPtr def,
int int
virCPUDefFormatBufFull(virBufferPtr buf, virCPUDefFormatBufFull(virBufferPtr buf,
virCPUDefPtr def, virCPUDefPtr def,
virDomainNumaPtr numa,
bool updateCPU) bool updateCPU)
{ {
if (!def) if (!def)
@ -489,7 +471,7 @@ virCPUDefFormatBufFull(virBufferPtr buf,
if (virCPUDefFormatBuf(buf, def, updateCPU) < 0) if (virCPUDefFormatBuf(buf, def, updateCPU) < 0)
return -1; return -1;
if (virDomainNumaDefCPUFormat(buf, def) < 0) if (virDomainNumaDefCPUFormat(buf, numa) < 0)
return -1; return -1;
virBufferAdjustIndent(buf, -2); virBufferAdjustIndent(buf, -2);

View File

@ -29,6 +29,7 @@
# include "virxml.h" # include "virxml.h"
# include "virbitmap.h" # include "virbitmap.h"
# include "virarch.h" # include "virarch.h"
# include "numa_conf.h"
# define VIR_CPU_VENDOR_ID_LENGTH 12 # define VIR_CPU_VENDOR_ID_LENGTH 12
@ -90,13 +91,6 @@ struct _virCPUFeatureDef {
int policy; /* enum virCPUFeaturePolicy */ int policy; /* enum virCPUFeaturePolicy */
}; };
typedef struct _virCellDef virCellDef;
typedef virCellDef *virCellDefPtr;
struct _virCellDef {
virBitmapPtr cpumask; /* CPUs that are part of this node */
unsigned long long mem; /* Node memory in kB */
int memAccess; /* virNumaMemAccess */
};
typedef struct _virCPUDef virCPUDef; typedef struct _virCPUDef virCPUDef;
typedef virCPUDef *virCPUDefPtr; typedef virCPUDef *virCPUDefPtr;
@ -115,8 +109,6 @@ struct _virCPUDef {
size_t nfeatures; size_t nfeatures;
size_t nfeatures_max; size_t nfeatures_max;
virCPUFeatureDefPtr features; virCPUFeatureDefPtr features;
size_t ncells;
virCellDefPtr cells;
}; };
@ -145,6 +137,7 @@ virCPUDefIsEqual(virCPUDefPtr src,
char * char *
virCPUDefFormat(virCPUDefPtr def, virCPUDefFormat(virCPUDefPtr def,
virDomainNumaPtr numa,
bool updateCPU); bool updateCPU);
int int
@ -154,6 +147,7 @@ virCPUDefFormatBuf(virBufferPtr buf,
int int
virCPUDefFormatBufFull(virBufferPtr buf, virCPUDefFormatBufFull(virBufferPtr buf,
virCPUDefPtr def, virCPUDefPtr def,
virDomainNumaPtr numa,
bool updateCPU); bool updateCPU);
int int

View File

@ -13517,11 +13517,10 @@ virDomainDefParseXML(xmlDocPtr xml,
} }
if (virDomainNumaDefCPUParseXML(def->cpu, ctxt) < 0) if (virDomainNumaDefCPUParseXML(def->numa, ctxt) < 0)
goto error; goto error;
if (def->cpu && if (virDomainNumaGetCPUCountTotal(def->numa) > def->maxvcpus) {
virDomainNumaGetCPUCountTotal(def->cpu) > def->maxvcpus) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Number of CPUs in <numa> exceeds the" _("Number of CPUs in <numa> exceeds the"
" <vcpu> count")); " <vcpu> count"));
@ -13531,7 +13530,6 @@ virDomainDefParseXML(xmlDocPtr xml,
if (virDomainNumatuneParseXML(def->numa, if (virDomainNumatuneParseXML(def->numa,
def->placement_mode == def->placement_mode ==
VIR_DOMAIN_CPU_PLACEMENT_MODE_STATIC, VIR_DOMAIN_CPU_PLACEMENT_MODE_STATIC,
virDomainNumaGetNodeCount(def->cpu),
ctxt) < 0) ctxt) < 0)
goto error; goto error;
@ -20204,7 +20202,7 @@ virDomainDefFormatInternal(virDomainDefPtr def,
virBufferAddLit(buf, "</features>\n"); virBufferAddLit(buf, "</features>\n");
} }
if (virCPUDefFormatBufFull(buf, def->cpu, if (virCPUDefFormatBufFull(buf, def->cpu, def->numa,
!!(flags & VIR_DOMAIN_DEF_FORMAT_UPDATE_CPU)) < 0) !!(flags & VIR_DOMAIN_DEF_FORMAT_UPDATE_CPU)) < 0)
goto error; goto error;

View File

@ -60,9 +60,12 @@ struct _virDomainNuma {
} memory; /* pinning for all the memory */ } memory; /* pinning for all the memory */
struct _virDomainNumaNode { struct _virDomainNumaNode {
virBitmapPtr nodeset; unsigned long long mem; /* memory size in KiB */
virDomainNumatuneMemMode mode; virBitmapPtr cpumask; /* bitmap of vCPUs corresponding to the node */
} *mem_nodes; /* fine tuning per guest node */ virBitmapPtr nodeset; /* host memory nodes where this guest node resides */
virDomainNumatuneMemMode mode; /* memory mode selection */
virNumaMemAccess memAccess; /* shared memory access configuration */
} *mem_nodes; /* guest node configuration */
size_t nmem_nodes; size_t nmem_nodes;
/* Future NUMA tuning related stuff should go here. */ /* Future NUMA tuning related stuff should go here. */
@ -83,7 +86,6 @@ virDomainNumatuneNodeSpecified(virDomainNumaPtr numatune,
static int static int
virDomainNumatuneNodeParseXML(virDomainNumaPtr numa, virDomainNumatuneNodeParseXML(virDomainNumaPtr numa,
size_t ncells,
xmlXPathContextPtr ctxt) xmlXPathContextPtr ctxt)
{ {
char *tmp = NULL; char *tmp = NULL;
@ -109,19 +111,13 @@ virDomainNumatuneNodeParseXML(virDomainNumaPtr numa,
goto cleanup; goto cleanup;
} }
if (!ncells) { if (!numa->nmem_nodes) {
virReportError(VIR_ERR_XML_ERROR, "%s", virReportError(VIR_ERR_XML_ERROR, "%s",
_("Element 'memnode' is invalid without " _("Element 'memnode' is invalid without "
"any guest NUMA cells")); "any guest NUMA cells"));
goto cleanup; goto cleanup;
} }
VIR_FREE(numa->mem_nodes);
if (VIR_ALLOC_N(numa->mem_nodes, ncells) < 0)
goto cleanup;
numa->nmem_nodes = ncells;
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
int mode = 0; int mode = 0;
unsigned int cellid = 0; unsigned int cellid = 0;
@ -195,7 +191,6 @@ virDomainNumatuneNodeParseXML(virDomainNumaPtr numa,
int int
virDomainNumatuneParseXML(virDomainNumaPtr numa, virDomainNumatuneParseXML(virDomainNumaPtr numa,
bool placement_static, bool placement_static,
size_t ncells,
xmlXPathContextPtr ctxt) xmlXPathContextPtr ctxt)
{ {
char *tmp = NULL; char *tmp = NULL;
@ -251,7 +246,7 @@ virDomainNumatuneParseXML(virDomainNumaPtr numa,
nodeset) < 0) nodeset) < 0)
goto cleanup; goto cleanup;
if (virDomainNumatuneNodeParseXML(numa, ncells, ctxt) < 0) if (virDomainNumatuneNodeParseXML(numa, ctxt) < 0)
goto cleanup; goto cleanup;
ret = 0; ret = 0;
@ -332,8 +327,10 @@ virDomainNumaFree(virDomainNumaPtr numa)
return; return;
virBitmapFree(numa->memory.nodeset); virBitmapFree(numa->memory.nodeset);
for (i = 0; i < numa->nmem_nodes; i++) for (i = 0; i < numa->nmem_nodes; i++) {
virBitmapFree(numa->mem_nodes[i].cpumask);
virBitmapFree(numa->mem_nodes[i].nodeset); virBitmapFree(numa->mem_nodes[i].nodeset);
}
VIR_FREE(numa->mem_nodes); VIR_FREE(numa->mem_nodes);
VIR_FREE(numa); VIR_FREE(numa);
@ -655,7 +652,7 @@ virDomainNumatuneNodesetIsAvailable(virDomainNumaPtr numatune,
int int
virDomainNumaDefCPUParseXML(virCPUDefPtr def, virDomainNumaDefCPUParseXML(virDomainNumaPtr def,
xmlXPathContextPtr ctxt) xmlXPathContextPtr ctxt)
{ {
xmlNodePtr *nodes = NULL; xmlNodePtr *nodes = NULL;
@ -675,9 +672,9 @@ virDomainNumaDefCPUParseXML(virCPUDefPtr def,
goto cleanup; goto cleanup;
} }
if (VIR_ALLOC_N(def->cells, n) < 0) if (VIR_ALLOC_N(def->mem_nodes, n) < 0)
goto cleanup; goto cleanup;
def->ncells = n; def->nmem_nodes = n;
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
int rc; int rc;
@ -702,7 +699,7 @@ virDomainNumaDefCPUParseXML(virCPUDefPtr def,
} }
VIR_FREE(tmp); VIR_FREE(tmp);
if (def->cells[cur_cell].cpumask) { if (def->mem_nodes[cur_cell].cpumask) {
virReportError(VIR_ERR_XML_ERROR, virReportError(VIR_ERR_XML_ERROR,
_("Duplicate NUMA cell info for cell id '%u'"), _("Duplicate NUMA cell info for cell id '%u'"),
cur_cell); cur_cell);
@ -715,11 +712,11 @@ virDomainNumaDefCPUParseXML(virCPUDefPtr def,
goto cleanup; goto cleanup;
} }
if (virBitmapParse(tmp, 0, &def->cells[cur_cell].cpumask, if (virBitmapParse(tmp, 0, &def->mem_nodes[cur_cell].cpumask,
VIR_DOMAIN_CPUMASK_LEN) < 0) VIR_DOMAIN_CPUMASK_LEN) < 0)
goto cleanup; goto cleanup;
if (virBitmapIsAllClear(def->cells[cur_cell].cpumask)) { if (virBitmapIsAllClear(def->mem_nodes[cur_cell].cpumask)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("NUMA cell %d has no vCPUs assigned"), cur_cell); _("NUMA cell %d has no vCPUs assigned"), cur_cell);
goto cleanup; goto cleanup;
@ -728,7 +725,7 @@ virDomainNumaDefCPUParseXML(virCPUDefPtr def,
ctxt->node = nodes[i]; ctxt->node = nodes[i];
if (virDomainParseMemory("./@memory", "./@unit", ctxt, if (virDomainParseMemory("./@memory", "./@unit", ctxt,
&def->cells[cur_cell].mem, true, false) < 0) &def->mem_nodes[cur_cell].mem, true, false) < 0)
goto cleanup; goto cleanup;
if ((tmp = virXMLPropString(nodes[i], "memAccess"))) { if ((tmp = virXMLPropString(nodes[i], "memAccess"))) {
@ -739,7 +736,7 @@ virDomainNumaDefCPUParseXML(virCPUDefPtr def,
goto cleanup; goto cleanup;
} }
def->cells[cur_cell].memAccess = rc; def->mem_nodes[cur_cell].memAccess = rc;
VIR_FREE(tmp); VIR_FREE(tmp);
} }
} }
@ -756,7 +753,7 @@ virDomainNumaDefCPUParseXML(virCPUDefPtr def,
int int
virDomainNumaDefCPUFormat(virBufferPtr buf, virDomainNumaDefCPUFormat(virBufferPtr buf,
virCPUDefPtr def) virDomainNumaPtr def)
{ {
virNumaMemAccess memAccess; virNumaMemAccess memAccess;
char *cpustr; char *cpustr;
@ -794,12 +791,12 @@ virDomainNumaDefCPUFormat(virBufferPtr buf,
unsigned int unsigned int
virDomainNumaGetCPUCountTotal(virCPUDefPtr numa) virDomainNumaGetCPUCountTotal(virDomainNumaPtr numa)
{ {
size_t i; size_t i;
unsigned int ret = 0; unsigned int ret = 0;
for (i = 0; i < numa->ncells; i++) for (i = 0; i < numa->nmem_nodes; i++)
ret += virBitmapCountBits(virDomainNumaGetNodeCpumask(numa, i)); ret += virBitmapCountBits(virDomainNumaGetNodeCpumask(numa, i));
return ret; return ret;
@ -818,43 +815,43 @@ virDomainNumaNew(void)
size_t size_t
virDomainNumaGetNodeCount(virCPUDefPtr numa) virDomainNumaGetNodeCount(virDomainNumaPtr numa)
{ {
if (!numa) if (!numa)
return 0; return 0;
return numa->ncells; return numa->nmem_nodes;
} }
virBitmapPtr virBitmapPtr
virDomainNumaGetNodeCpumask(virCPUDefPtr numa, virDomainNumaGetNodeCpumask(virDomainNumaPtr numa,
size_t node) size_t node)
{ {
return numa->cells[node].cpumask; return numa->mem_nodes[node].cpumask;
} }
virNumaMemAccess virNumaMemAccess
virDomainNumaGetNodeMemoryAccessMode(virCPUDefPtr numa, virDomainNumaGetNodeMemoryAccessMode(virDomainNumaPtr numa,
size_t node) size_t node)
{ {
return numa->cells[node].memAccess; return numa->mem_nodes[node].memAccess;
} }
unsigned long long unsigned long long
virDomainNumaGetNodeMemorySize(virCPUDefPtr numa, virDomainNumaGetNodeMemorySize(virDomainNumaPtr numa,
size_t node) size_t node)
{ {
return numa->cells[node].mem; return numa->mem_nodes[node].mem;
} }
void void
virDomainNumaSetNodeMemorySize(virCPUDefPtr numa, virDomainNumaSetNodeMemorySize(virDomainNumaPtr numa,
size_t node, size_t node,
unsigned long long size) unsigned long long size)
{ {
numa->cells[node].mem = size; numa->mem_nodes[node].mem = size;
} }

View File

@ -29,7 +29,6 @@
# include "virutil.h" # include "virutil.h"
# include "virbitmap.h" # include "virbitmap.h"
# include "virbuffer.h" # include "virbuffer.h"
# include "cpu_conf.h"
typedef struct _virDomainNuma virDomainNuma; typedef struct _virDomainNuma virDomainNuma;
@ -64,9 +63,8 @@ void virDomainNumaFree(virDomainNumaPtr numa);
*/ */
int virDomainNumatuneParseXML(virDomainNumaPtr numa, int virDomainNumatuneParseXML(virDomainNumaPtr numa,
bool placement_static, bool placement_static,
size_t ncells,
xmlXPathContextPtr ctxt) xmlXPathContextPtr ctxt)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(4); ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(3);
int virDomainNumatuneFormatXML(virBufferPtr buf, virDomainNumaPtr numatune) int virDomainNumatuneFormatXML(virBufferPtr buf, virDomainNumaPtr numatune)
ATTRIBUTE_NONNULL(1); ATTRIBUTE_NONNULL(1);
@ -86,15 +84,15 @@ int virDomainNumatuneMaybeGetNodeset(virDomainNumaPtr numatune,
virBitmapPtr *retNodeset, virBitmapPtr *retNodeset,
int cellid); int cellid);
size_t virDomainNumaGetNodeCount(virCPUDefPtr numa) size_t virDomainNumaGetNodeCount(virDomainNumaPtr numa)
ATTRIBUTE_NONNULL(1); ATTRIBUTE_NONNULL(1);
virBitmapPtr virDomainNumaGetNodeCpumask(virCPUDefPtr numa, virBitmapPtr virDomainNumaGetNodeCpumask(virDomainNumaPtr numa,
size_t node) size_t node)
ATTRIBUTE_NONNULL(1); ATTRIBUTE_NONNULL(1);
virNumaMemAccess virDomainNumaGetNodeMemoryAccessMode(virCPUDefPtr numa, virNumaMemAccess virDomainNumaGetNodeMemoryAccessMode(virDomainNumaPtr numa,
size_t node) size_t node)
ATTRIBUTE_NONNULL(1); ATTRIBUTE_NONNULL(1);
unsigned long long virDomainNumaGetNodeMemorySize(virCPUDefPtr numa, unsigned long long virDomainNumaGetNodeMemorySize(virDomainNumaPtr numa,
size_t node) size_t node)
ATTRIBUTE_NONNULL(1); ATTRIBUTE_NONNULL(1);
@ -120,7 +118,7 @@ int virDomainNumatuneSet(virDomainNumaPtr numa,
virBitmapPtr nodeset) virBitmapPtr nodeset)
ATTRIBUTE_NONNULL(1); ATTRIBUTE_NONNULL(1);
void virDomainNumaSetNodeMemorySize(virCPUDefPtr numa, void virDomainNumaSetNodeMemorySize(virDomainNumaPtr numa,
size_t node, size_t node,
unsigned long long size) unsigned long long size)
ATTRIBUTE_NONNULL(1); ATTRIBUTE_NONNULL(1);
@ -143,10 +141,10 @@ bool virDomainNumatuneNodesetIsAvailable(virDomainNumaPtr numatune,
bool virDomainNumatuneNodeSpecified(virDomainNumaPtr numatune, bool virDomainNumatuneNodeSpecified(virDomainNumaPtr numatune,
int cellid); int cellid);
int virDomainNumaDefCPUParseXML(virCPUDefPtr def, xmlXPathContextPtr ctxt); int virDomainNumaDefCPUParseXML(virDomainNumaPtr def, xmlXPathContextPtr ctxt);
int virDomainNumaDefCPUFormat(virBufferPtr buf, virCPUDefPtr def); int virDomainNumaDefCPUFormat(virBufferPtr buf, virDomainNumaPtr def);
unsigned int virDomainNumaGetCPUCountTotal(virCPUDefPtr numa); unsigned int virDomainNumaGetCPUCountTotal(virDomainNumaPtr numa);
#endif /* __NUMA_CONF_H__ */ #endif /* __NUMA_CONF_H__ */

View File

@ -472,7 +472,7 @@ cpuBaselineXML(const char **xmlCPUs,
if (!(cpu = cpuBaseline(cpus, ncpus, models, nmodels, flags))) if (!(cpu = cpuBaseline(cpus, ncpus, models, nmodels, flags)))
goto error; goto error;
cpustr = virCPUDefFormat(cpu, false); cpustr = virCPUDefFormat(cpu, NULL, false);
cleanup: cleanup:
if (cpus) { if (cpus) {

View File

@ -4558,7 +4558,7 @@ qemuBuildMemoryBackendStr(unsigned long long size,
virDomainHugePagePtr hugepage = NULL; virDomainHugePagePtr hugepage = NULL;
virDomainNumatuneMemMode mode; virDomainNumatuneMemMode mode;
const long system_page_size = virGetSystemPageSizeKB(); const long system_page_size = virGetSystemPageSizeKB();
virNumaMemAccess memAccess = virDomainNumaGetNodeMemoryAccessMode(def->cpu, guestNode); virNumaMemAccess memAccess = virDomainNumaGetNodeMemoryAccessMode(def->numa, guestNode);
size_t i; size_t i;
char *mem_path = NULL; char *mem_path = NULL;
@ -4747,7 +4747,7 @@ qemuBuildMemoryCellBackendStr(virDomainDefPtr def,
if (virAsprintf(&alias, "ram-node%zu", cell) < 0) if (virAsprintf(&alias, "ram-node%zu", cell) < 0)
goto cleanup; goto cleanup;
if ((rc = qemuBuildMemoryBackendStr(virDomainNumaGetNodeMemorySize(def->cpu, cell), if ((rc = qemuBuildMemoryBackendStr(virDomainNumaGetNodeMemorySize(def->numa, cell),
0, cell, 0, cell,
NULL, auto_nodeset, NULL, auto_nodeset,
def, qemuCaps, cfg, def, qemuCaps, cfg,
@ -7123,7 +7123,7 @@ qemuBuildNumaArgStr(virQEMUDriverConfigPtr cfg,
bool needBackend = false; bool needBackend = false;
int rc; int rc;
int ret = -1; int ret = -1;
size_t ncells = virDomainNumaGetNodeCount(def->cpu); size_t ncells = virDomainNumaGetNodeCount(def->numa);
const long system_page_size = virGetSystemPageSizeKB(); const long system_page_size = virGetSystemPageSizeKB();
if (virDomainNumatuneHasPerNodeBinding(def->numa) && if (virDomainNumatuneHasPerNodeBinding(def->numa) &&
@ -7177,8 +7177,8 @@ qemuBuildNumaArgStr(virQEMUDriverConfigPtr cfg,
/* using of -numa memdev= cannot be combined with -numa mem=, thus we /* using of -numa memdev= cannot be combined with -numa mem=, thus we
* need to check which approach to use */ * need to check which approach to use */
for (i = 0; i < ncells; i++) { for (i = 0; i < ncells; i++) {
unsigned long long cellmem = virDomainNumaGetNodeMemorySize(def->cpu, i); unsigned long long cellmem = virDomainNumaGetNodeMemorySize(def->numa, i);
virDomainNumaSetNodeMemorySize(def->cpu, i, VIR_ROUND_UP(cellmem, 1024)); virDomainNumaSetNodeMemorySize(def->numa, i, VIR_ROUND_UP(cellmem, 1024));
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_OBJECT_MEMORY_RAM) || if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_OBJECT_MEMORY_RAM) ||
virQEMUCapsGet(qemuCaps, QEMU_CAPS_OBJECT_MEMORY_FILE)) { virQEMUCapsGet(qemuCaps, QEMU_CAPS_OBJECT_MEMORY_FILE)) {
@ -7190,7 +7190,7 @@ qemuBuildNumaArgStr(virQEMUDriverConfigPtr cfg,
if (rc == 0) if (rc == 0)
needBackend = true; needBackend = true;
} else { } else {
if (virDomainNumaGetNodeMemoryAccessMode(def->cpu, i)) { if (virDomainNumaGetNodeMemoryAccessMode(def->numa, i)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("Shared memory mapping is not supported " _("Shared memory mapping is not supported "
"with this QEMU")); "with this QEMU"));
@ -7201,7 +7201,7 @@ qemuBuildNumaArgStr(virQEMUDriverConfigPtr cfg,
for (i = 0; i < ncells; i++) { for (i = 0; i < ncells; i++) {
VIR_FREE(cpumask); VIR_FREE(cpumask);
if (!(cpumask = virBitmapFormat(virDomainNumaGetNodeCpumask(def->cpu, i)))) if (!(cpumask = virBitmapFormat(virDomainNumaGetNodeCpumask(def->numa, i))))
goto cleanup; goto cleanup;
if (strchr(cpumask, ',') && if (strchr(cpumask, ',') &&
@ -7229,7 +7229,7 @@ qemuBuildNumaArgStr(virQEMUDriverConfigPtr cfg,
virBufferAsprintf(&buf, ",memdev=ram-node%zu", i); virBufferAsprintf(&buf, ",memdev=ram-node%zu", i);
else else
virBufferAsprintf(&buf, ",mem=%llu", virBufferAsprintf(&buf, ",mem=%llu",
virDomainNumaGetNodeMemorySize(def->cpu, i) / 1024); virDomainNumaGetNodeMemorySize(def->numa, i) / 1024);
virCommandAddArgBuffer(cmd, &buf); virCommandAddArgBuffer(cmd, &buf);
} }
@ -8321,7 +8321,7 @@ qemuBuildCommandLine(virConnectPtr conn,
virCommandAddArg(cmd, "-m"); virCommandAddArg(cmd, "-m");
def->mem.max_balloon = VIR_DIV_UP(def->mem.max_balloon, 1024) * 1024; def->mem.max_balloon = VIR_DIV_UP(def->mem.max_balloon, 1024) * 1024;
virCommandAddArgFormat(cmd, "%llu", def->mem.max_balloon / 1024); virCommandAddArgFormat(cmd, "%llu", def->mem.max_balloon / 1024);
if (def->mem.nhugepages && !virDomainNumaGetNodeCount(def->cpu)) { if (def->mem.nhugepages && !virDomainNumaGetNodeCount(def->numa)) {
const long system_page_size = virGetSystemPageSizeKB(); const long system_page_size = virGetSystemPageSizeKB();
char *mem_path = NULL; char *mem_path = NULL;
@ -8401,7 +8401,7 @@ qemuBuildCommandLine(virConnectPtr conn,
} }
} }
if (virDomainNumaGetNodeCount(def->cpu)) if (virDomainNumaGetNodeCount(def->numa))
if (qemuBuildNumaArgStr(cfg, def, cmd, qemuCaps, nodeset) < 0) if (qemuBuildNumaArgStr(cfg, def, cmd, qemuCaps, nodeset) < 0)
goto error; goto error;

View File

@ -167,7 +167,7 @@ cpuTestCompareXML(const char *arch,
if (virtTestLoadFile(xml, &expected) < 0) if (virtTestLoadFile(xml, &expected) < 0)
goto cleanup; goto cleanup;
if (!(actual = virCPUDefFormat(cpu, updateCPU))) if (!(actual = virCPUDefFormat(cpu, NULL, updateCPU)))
goto cleanup; goto cleanup;
if (STRNEQ(expected, actual)) { if (STRNEQ(expected, actual)) {

View File

@ -242,8 +242,6 @@ virCapsPtr testQemuCapsInit(void)
ARRAY_CARDINALITY(host_cpu_features), /* nfeatures */ ARRAY_CARDINALITY(host_cpu_features), /* nfeatures */
ARRAY_CARDINALITY(host_cpu_features), /* nfeatures_max */ ARRAY_CARDINALITY(host_cpu_features), /* nfeatures_max */
host_cpu_features, /* features */ host_cpu_features, /* features */
0, /* ncells */
NULL, /* cells */
}; };
if ((caps = virCapabilitiesNew(host_cpu.arch, if ((caps = virCapabilitiesNew(host_cpu.arch,