Memory: Use consistent type for all memory elements.

Domain memory elements such as max_balloon and cur_balloon are
implemented as 'unsigned long long', whereas the 'memory' element
in NUMA cells is implemented as 'unsigned int'.

Use the same data type (unsigned long long) for 'memory' element
in NUMA cells.

Signed-off-by: Prerna Saxena <prerna@linux.vnet.ibm.com>
This commit is contained in:
Prerna Saxena 2014-10-31 16:07:21 +05:30 committed by Michal Privoznik
parent 44686f6523
commit d426431fde
3 changed files with 6 additions and 6 deletions

View File

@ -496,7 +496,7 @@ virCPUDefParseXML(xmlNodePtr node,
goto error;
}
ret = virStrToLong_ui(memory, NULL, 10, &def->cells[cur_cell].mem);
ret = virStrToLong_ull(memory, NULL, 10, &def->cells[cur_cell].mem);
if (ret == -1) {
virReportError(VIR_ERR_XML_ERROR, "%s",
_("Invalid 'memory' attribute in NUMA cell"));
@ -702,7 +702,7 @@ virCPUDefFormatBuf(virBufferPtr buf,
virBufferAddLit(buf, "<cell");
virBufferAsprintf(buf, " id='%zu'", i);
virBufferAsprintf(buf, " cpus='%s'", def->cells[i].cpustr);
virBufferAsprintf(buf, " memory='%d'", def->cells[i].mem);
virBufferAsprintf(buf, " memory='%llu'", def->cells[i].mem);
if (memAccess)
virBufferAsprintf(buf, " memAccess='%s'",
virMemAccessTypeToString(memAccess));

View File

@ -105,7 +105,7 @@ typedef virCellDef *virCellDefPtr;
struct _virCellDef {
virBitmapPtr cpumask; /* CPUs that are part of this node */
char *cpustr; /* CPUs stored in string form for dumpxml */
unsigned int mem; /* Node memory in kB */
unsigned long long mem; /* Node memory in kB */
virMemAccess memAccess;
};

View File

@ -6693,7 +6693,7 @@ qemuBuildNumaArgStr(virQEMUDriverConfigPtr cfg,
}
for (i = 0; i < def->cpu->ncells; i++) {
int cellmem = VIR_DIV_UP(def->cpu->cells[i].mem, 1024);
unsigned long long cellmem = VIR_DIV_UP(def->cpu->cells[i].mem, 1024);
def->cpu->cells[i].mem = cellmem * 1024;
virMemAccess memAccess = def->cpu->cells[i].memAccess;
@ -6799,7 +6799,7 @@ qemuBuildNumaArgStr(virQEMUDriverConfigPtr cfg,
virBufferAddLit(&buf, "memory-backend-ram");
}
virBufferAsprintf(&buf, ",size=%dM,id=ram-node%zu", cellmem, i);
virBufferAsprintf(&buf, ",size=%lluM,id=ram-node%zu", cellmem, i);
if (virDomainNumatuneMaybeFormatNodeset(def->numatune, nodeset,
&nodemask, i) < 0)
@ -6849,7 +6849,7 @@ qemuBuildNumaArgStr(virQEMUDriverConfigPtr cfg,
virQEMUCapsGet(qemuCaps, QEMU_CAPS_OBJECT_MEMORY_FILE)) {
virBufferAsprintf(&buf, ",memdev=ram-node%zu", i);
} else {
virBufferAsprintf(&buf, ",mem=%d", cellmem);
virBufferAsprintf(&buf, ",mem=%llu", cellmem);
}
virCommandAddArgBuffer(cmd, &buf);