qemu: do not fill in default pagesize in qemuGetDomainHupageMemPath

Commit 6864d8f740e2502dc7625bdf18ffde4465b14f69 moved this one level up
for qemuBuildMemoryBackendProps but left qemuBuildMemPathStr intact.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Ján Tomko 2019-04-04 13:53:17 +02:00
parent b261c9c3a0
commit 07c6738460
2 changed files with 19 additions and 26 deletions

View File

@ -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)

View File

@ -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;
}
if (!(*memPath = qemuGetDomainHugepagePath(def, &cfg->hugetlbfs[i])))
return -1;
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;
}
if (!(*memPath = qemuGetDomainHugepagePath(def, &cfg->hugetlbfs[i])))
return -1;
return 0;
}