提交 0621f15a 编写于 作者: P Peter Krempa

qemu: command: Make qemuBuildMemoryBackendStr usable without NUMA

Make the function usable so that -1 can be passed to it as cell ID so
that we can later enable memory hotplug on non-NUMA guests for certain
architectures.
上级 ba08d16d
......@@ -4965,7 +4965,8 @@ qemuBuildControllerDevStr(virDomainDefPtr domainDef,
* qemuBuildMemoryBackendStr:
* @size: size of the memory device in kibibytes
* @pagesize: size of the requested memory page in KiB, 0 for default
* @guestNode: NUMA node in the guest that the memory object will be attached to
* @guestNode: NUMA node in the guest that the memory object will be attached
* to, or -1 if NUMA is not used in the guest
* @hostNodes: map of host nodes to alloc the memory in, NULL for default
* @autoNodeset: fallback nodeset in case of automatic numa placement
* @def: domain definition object
......@@ -5011,19 +5012,19 @@ qemuBuildMemoryBackendStr(unsigned long long size,
*backendProps = NULL;
*backendType = NULL;
/* memory devices could provide a invalid guest node */
if (guestNode >= virDomainNumaGetNodeCount(def->numa)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("can't add memory backend for guest node '%d' as "
"the guest has only '%zu' NUMA nodes configured"),
guestNode, virDomainNumaGetNodeCount(def->numa));
return -1;
}
if (guestNode >= 0) {
/* memory devices could provide a invalid guest node */
if (guestNode >= virDomainNumaGetNodeCount(def->numa)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("can't add memory backend for guest node '%d' as "
"the guest has only '%zu' NUMA nodes configured"),
guestNode, virDomainNumaGetNodeCount(def->numa));
return -1;
}
if (!(props = virJSONValueNewObject()))
return -1;
memAccess = virDomainNumaGetNodeMemoryAccessMode(def->numa, guestNode);
}
memAccess = virDomainNumaGetNodeMemoryAccessMode(def->numa, guestNode);
if (virDomainNumatuneGetMode(def->numa, guestNode, &mode) < 0 &&
virDomainNumatuneGetMode(def->numa, -1, &mode) < 0)
mode = VIR_DOMAIN_NUMATUNE_MEM_STRICT;
......@@ -5040,6 +5041,10 @@ qemuBuildMemoryBackendStr(unsigned long long size,
continue;
}
/* just find the master hugepage in case we don't use NUMA */
if (guestNode < 0)
continue;
if (virBitmapGetBit(hugepage->nodemask, guestNode,
&thisHugepage) < 0) {
/* Ignore this error. It's not an error after all. Well,
......@@ -5073,6 +5078,9 @@ qemuBuildMemoryBackendStr(unsigned long long size,
hugepage = NULL;
}
if (!(props = virJSONValueNewObject()))
return -1;
if (pagesize || hugepage) {
if (pagesize) {
/* Now lets see, if the huge page we want to use is even mounted
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册