Commit 6864d8f740e2502dc7625bdf18ffde4465b14f69 moved this one level up
for qemuBuildMemoryBackendProps but left qemuBuildMemPathStr intact.
Signed-off-by: Ján Tomko <jtomko(a)redhat.com>
---
src/qemu/qemu_command.c | 8 +++++---
src/qemu/qemu_conf.c | 35 +++++++++++++----------------------
2 files changed, 18 insertions(+), 25 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index aaca75900b..79b9a5d4f9 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -7847,9 +7847,11 @@ qemuBuildMemPathStr(virQEMUDriverConfigPtr cfg,
* if user requested file allocation. */
if (def->mem.nhugepages &&
def->mem.hugepages[0].size != system_page_size) {
- if (qemuGetDomainHupageMemPath(def, cfg,
- def->mem.hugepages[0].size,
- &mem_path) < 0)
+ unsigned long long pagesize = def->mem.hugepages[0].size;
+ if (!pagesize &&
+ qemuBuildMemoryGetDefaultPagesize(cfg, &pagesize) < 0)
+ return -1;
+ if (qemuGetDomainHupageMemPath(def, cfg, pagesize, &mem_path) < 0)
return -1;
} else if (def->mem.source == VIR_DOMAIN_MEMORY_SOURCE_FILE) {
if (qemuGetMemoryBackingPath(def, cfg, "ram", &mem_path) < 0)
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index 41ce0a978d..4bec885c6b 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -1926,8 +1926,6 @@ qemuGetDomainDefaultHugepath(const virDomainDef *def,
/**
* qemuGetDomainHupageMemPath: Construct HP enabled memory backend path
*
- * If no specific hugepage size is requested (@pagesize is zero)
- * the default hugepage size is used).
* The resulting path is stored at @memPath.
*
* Returns 0 on success,
@@ -1948,29 +1946,22 @@ qemuGetDomainHupageMemPath(const virDomainDef *def,
return -1;
}
- if (!pagesize) {
- if (!(*memPath = qemuGetDomainDefaultHugepath(def,
- cfg->hugetlbfs,
- cfg->nhugetlbfs)))
- return -1;
- } else {
- for (i = 0; i < cfg->nhugetlbfs; i++) {
- if (cfg->hugetlbfs[i].size == pagesize)
- break;
- }
-
- if (i == cfg->nhugetlbfs) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Unable to find any usable hugetlbfs "
- "mount for %llu KiB"),
- pagesize);
- return -1;
- }
+ for (i = 0; i < cfg->nhugetlbfs; i++) {
+ if (cfg->hugetlbfs[i].size == pagesize)
+ break;
+ }
- if (!(*memPath = qemuGetDomainHugepagePath(def, &cfg->hugetlbfs[i])))
- return -1;
+ if (i == cfg->nhugetlbfs) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Unable to find any usable hugetlbfs "
+ "mount for %llu KiB"),
+ pagesize);
+ return -1;
}
+ if (!(*memPath = qemuGetDomainHugepagePath(def, &cfg->hugetlbfs[i])))
+ return -1;
+
return 0;
}
--
2.19.2