mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
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.
This commit is contained in:
parent
ba08d16d6c
commit
0621f15ac7
@ -4965,7 +4965,8 @@ qemuBuildControllerDevStr(virDomainDefPtr domainDef,
|
|||||||
* qemuBuildMemoryBackendStr:
|
* qemuBuildMemoryBackendStr:
|
||||||
* @size: size of the memory device in kibibytes
|
* @size: size of the memory device in kibibytes
|
||||||
* @pagesize: size of the requested memory page in KiB, 0 for default
|
* @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
|
* @hostNodes: map of host nodes to alloc the memory in, NULL for default
|
||||||
* @autoNodeset: fallback nodeset in case of automatic numa placement
|
* @autoNodeset: fallback nodeset in case of automatic numa placement
|
||||||
* @def: domain definition object
|
* @def: domain definition object
|
||||||
@ -5011,19 +5012,19 @@ qemuBuildMemoryBackendStr(unsigned long long size,
|
|||||||
*backendProps = NULL;
|
*backendProps = NULL;
|
||||||
*backendType = NULL;
|
*backendType = NULL;
|
||||||
|
|
||||||
/* memory devices could provide a invalid guest node */
|
if (guestNode >= 0) {
|
||||||
if (guestNode >= virDomainNumaGetNodeCount(def->numa)) {
|
/* memory devices could provide a invalid guest node */
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
if (guestNode >= virDomainNumaGetNodeCount(def->numa)) {
|
||||||
_("can't add memory backend for guest node '%d' as "
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||||
"the guest has only '%zu' NUMA nodes configured"),
|
_("can't add memory backend for guest node '%d' as "
|
||||||
guestNode, virDomainNumaGetNodeCount(def->numa));
|
"the guest has only '%zu' NUMA nodes configured"),
|
||||||
return -1;
|
guestNode, virDomainNumaGetNodeCount(def->numa));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
memAccess = virDomainNumaGetNodeMemoryAccessMode(def->numa, guestNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(props = virJSONValueNewObject()))
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
memAccess = virDomainNumaGetNodeMemoryAccessMode(def->numa, guestNode);
|
|
||||||
if (virDomainNumatuneGetMode(def->numa, guestNode, &mode) < 0 &&
|
if (virDomainNumatuneGetMode(def->numa, guestNode, &mode) < 0 &&
|
||||||
virDomainNumatuneGetMode(def->numa, -1, &mode) < 0)
|
virDomainNumatuneGetMode(def->numa, -1, &mode) < 0)
|
||||||
mode = VIR_DOMAIN_NUMATUNE_MEM_STRICT;
|
mode = VIR_DOMAIN_NUMATUNE_MEM_STRICT;
|
||||||
@ -5040,6 +5041,10 @@ qemuBuildMemoryBackendStr(unsigned long long size,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* just find the master hugepage in case we don't use NUMA */
|
||||||
|
if (guestNode < 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
if (virBitmapGetBit(hugepage->nodemask, guestNode,
|
if (virBitmapGetBit(hugepage->nodemask, guestNode,
|
||||||
&thisHugepage) < 0) {
|
&thisHugepage) < 0) {
|
||||||
/* Ignore this error. It's not an error after all. Well,
|
/* Ignore this error. It's not an error after all. Well,
|
||||||
@ -5073,6 +5078,9 @@ qemuBuildMemoryBackendStr(unsigned long long size,
|
|||||||
hugepage = NULL;
|
hugepage = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!(props = virJSONValueNewObject()))
|
||||||
|
return -1;
|
||||||
|
|
||||||
if (pagesize || hugepage) {
|
if (pagesize || hugepage) {
|
||||||
if (pagesize) {
|
if (pagesize) {
|
||||||
/* Now lets see, if the huge page we want to use is even mounted
|
/* Now lets see, if the huge page we want to use is even mounted
|
||||||
|
Loading…
x
Reference in New Issue
Block a user