} else {
/* We can have both pagesize and mem source. If that's the case,
* prefer hugepages as those are more specific. */
- if (qemuGetMemoryBackingPath(priv, def, mem->info.alias, &memPath) < 0)
+ if (qemuGetMemoryBackingPath(priv, mem->info.alias, &memPath) < 0)
return -1;
}
return -1;
prealloc = true;
} else if (def->mem.source == VIR_DOMAIN_MEMORY_SOURCE_FILE) {
- if (qemuGetMemoryBackingPath(priv, def, "ram", &mem_path) < 0)
+ if (qemuGetMemoryBackingPath(priv, "ram", &mem_path) < 0)
return -1;
}
/**
* qemuGetMemoryBackingPath:
* @priv: domain private data
- * @def: domain definition
* @alias: memory object alias
* @memPath: constructed path
*
*/
int
qemuGetMemoryBackingPath(qemuDomainObjPrivate *priv,
- const virDomainDef *def,
const char *alias,
char **memPath)
{
- g_autofree char *domainPath = NULL;
-
if (!alias) {
/* This should never happen (TM) */
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
return -1;
}
- if (qemuGetMemoryBackingDomainPath(priv, def, &domainPath) < 0)
- return -1;
+ *memPath = g_strdup_printf("%s/%s", priv->memoryBackingDir, alias);
- *memPath = g_strdup_printf("%s/%s", domainPath, alias);
return 0;
}
char **path);
int qemuGetMemoryBackingPath(qemuDomainObjPrivate *priv,
- const virDomainDef *def,
const char *alias,
char **memPath);
}
if (!build || shouldBuildMB) {
- g_autofree char *path = NULL;
- if (qemuGetMemoryBackingDomainPath(QEMU_DOMAIN_PRIVATE(vm), vm->def, &path) < 0)
- return -1;
-
if (qemuProcessBuildDestroyMemoryPathsImpl(driver, vm,
- path, build) < 0)
+ QEMU_DOMAIN_PRIVATE(vm)->memoryBackingDir,
+ build) < 0)
return -1;
}
{
g_autofree char *path = NULL;
- if (qemuGetMemoryBackingPath(QEMU_DOMAIN_PRIVATE(vm), vm->def, mem->info.alias, &path) < 0)
+ if (qemuGetMemoryBackingPath(QEMU_DOMAIN_PRIVATE(vm), mem->info.alias, &path) < 0)
return -1;
if (unlink(path) < 0 &&