mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
qemuBuildMemoryBackendProps: remove useless cleanup label
Signed-off-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
parent
6bb8edafd9
commit
77de0d36df
@ -3431,7 +3431,7 @@ qemuBuildMemoryBackendProps(virJSONValuePtr *backendProps,
|
|||||||
useHugepage = false;
|
useHugepage = false;
|
||||||
} else if (useHugepage && pagesize == 0) {
|
} else if (useHugepage && pagesize == 0) {
|
||||||
if (qemuBuildMemoryGetDefaultPagesize(cfg, &pagesize) < 0)
|
if (qemuBuildMemoryGetDefaultPagesize(cfg, &pagesize) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(props = virJSONValueNewObject()))
|
if (!(props = virJSONValueNewObject()))
|
||||||
@ -3443,70 +3443,70 @@ qemuBuildMemoryBackendProps(virJSONValuePtr *backendProps,
|
|||||||
if (useHugepage &&
|
if (useHugepage &&
|
||||||
(virJSONValueObjectAdd(props, "b:hugetlb", useHugepage, NULL) < 0 ||
|
(virJSONValueObjectAdd(props, "b:hugetlb", useHugepage, NULL) < 0 ||
|
||||||
virJSONValueObjectAdd(props, "U:hugetlbsize", pagesize << 10, NULL) < 0)) {
|
virJSONValueObjectAdd(props, "U:hugetlbsize", pagesize << 10, NULL) < 0)) {
|
||||||
goto cleanup;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (qemuBuildMemoryBackendPropsShare(props, memAccess) < 0)
|
if (qemuBuildMemoryBackendPropsShare(props, memAccess) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
} else if (useHugepage || mem->nvdimmPath || memAccess ||
|
} else if (useHugepage || mem->nvdimmPath || memAccess ||
|
||||||
def->mem.source == VIR_DOMAIN_MEMORY_SOURCE_FILE) {
|
def->mem.source == VIR_DOMAIN_MEMORY_SOURCE_FILE) {
|
||||||
|
|
||||||
if (mem->nvdimmPath) {
|
if (mem->nvdimmPath) {
|
||||||
if (VIR_STRDUP(memPath, mem->nvdimmPath) < 0)
|
if (VIR_STRDUP(memPath, mem->nvdimmPath) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
if (!priv->memPrealloc)
|
if (!priv->memPrealloc)
|
||||||
prealloc = true;
|
prealloc = true;
|
||||||
} else if (useHugepage) {
|
} else if (useHugepage) {
|
||||||
if (qemuGetDomainHupageMemPath(def, cfg, pagesize, &memPath) < 0)
|
if (qemuGetDomainHupageMemPath(def, cfg, pagesize, &memPath) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
if (!priv->memPrealloc)
|
if (!priv->memPrealloc)
|
||||||
prealloc = true;
|
prealloc = true;
|
||||||
} else {
|
} else {
|
||||||
/* We can have both pagesize and mem source. If that's the case,
|
/* We can have both pagesize and mem source. If that's the case,
|
||||||
* prefer hugepages as those are more specific. */
|
* prefer hugepages as those are more specific. */
|
||||||
if (qemuGetMemoryBackingPath(def, cfg, mem->info.alias, &memPath) < 0)
|
if (qemuGetMemoryBackingPath(def, cfg, mem->info.alias, &memPath) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (virJSONValueObjectAdd(props,
|
if (virJSONValueObjectAdd(props,
|
||||||
"B:prealloc", prealloc,
|
"B:prealloc", prealloc,
|
||||||
"s:mem-path", memPath,
|
"s:mem-path", memPath,
|
||||||
NULL) < 0)
|
NULL) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
if (!mem->nvdimmPath &&
|
if (!mem->nvdimmPath &&
|
||||||
discard == VIR_TRISTATE_BOOL_YES) {
|
discard == VIR_TRISTATE_BOOL_YES) {
|
||||||
if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_OBJECT_MEMORY_FILE_DISCARD)) {
|
if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_OBJECT_MEMORY_FILE_DISCARD)) {
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||||
_("this QEMU doesn't support memory discard"));
|
_("this QEMU doesn't support memory discard"));
|
||||||
goto cleanup;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (virJSONValueObjectAdd(props,
|
if (virJSONValueObjectAdd(props,
|
||||||
"B:discard-data", true,
|
"B:discard-data", true,
|
||||||
NULL) < 0)
|
NULL) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (qemuBuildMemoryBackendPropsShare(props, memAccess) < 0)
|
if (qemuBuildMemoryBackendPropsShare(props, memAccess) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
} else {
|
} else {
|
||||||
backendType = "memory-backend-ram";
|
backendType = "memory-backend-ram";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (virJSONValueObjectAdd(props, "U:size", mem->size * 1024, NULL) < 0)
|
if (virJSONValueObjectAdd(props, "U:size", mem->size * 1024, NULL) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
if (mem->alignsize) {
|
if (mem->alignsize) {
|
||||||
if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_OBJECT_MEMORY_FILE_ALIGN)) {
|
if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_OBJECT_MEMORY_FILE_ALIGN)) {
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||||
_("nvdimm align property is not available "
|
_("nvdimm align property is not available "
|
||||||
"with this QEMU binary"));
|
"with this QEMU binary"));
|
||||||
goto cleanup;
|
return -1;
|
||||||
}
|
}
|
||||||
if (virJSONValueObjectAdd(props, "U:align", mem->alignsize * 1024, NULL) < 0)
|
if (virJSONValueObjectAdd(props, "U:align", mem->alignsize * 1024, NULL) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mem->nvdimmPmem) {
|
if (mem->nvdimmPmem) {
|
||||||
@ -3514,10 +3514,10 @@ qemuBuildMemoryBackendProps(virJSONValuePtr *backendProps,
|
|||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||||
_("nvdimm pmem property is not available "
|
_("nvdimm pmem property is not available "
|
||||||
"with this QEMU binary"));
|
"with this QEMU binary"));
|
||||||
goto cleanup;
|
return -1;
|
||||||
}
|
}
|
||||||
if (virJSONValueObjectAdd(props, "s:pmem", "on", NULL) < 0)
|
if (virJSONValueObjectAdd(props, "s:pmem", "on", NULL) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mem->sourceNodes) {
|
if (mem->sourceNodes) {
|
||||||
@ -3525,17 +3525,17 @@ qemuBuildMemoryBackendProps(virJSONValuePtr *backendProps,
|
|||||||
} else {
|
} else {
|
||||||
if (virDomainNumatuneMaybeGetNodeset(def->numa, priv->autoNodeset,
|
if (virDomainNumatuneMaybeGetNodeset(def->numa, priv->autoNodeset,
|
||||||
&nodemask, mem->targetNode) < 0)
|
&nodemask, mem->targetNode) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nodemask) {
|
if (nodemask) {
|
||||||
if (!virNumaNodesetIsAvailable(nodemask))
|
if (!virNumaNodesetIsAvailable(nodemask))
|
||||||
goto cleanup;
|
return -1;
|
||||||
if (virJSONValueObjectAdd(props,
|
if (virJSONValueObjectAdd(props,
|
||||||
"m:host-nodes", nodemask,
|
"m:host-nodes", nodemask,
|
||||||
"S:policy", qemuNumaPolicyTypeToString(mode),
|
"S:policy", qemuNumaPolicyTypeToString(mode),
|
||||||
NULL) < 0)
|
NULL) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If none of the following is requested... */
|
/* If none of the following is requested... */
|
||||||
@ -3555,19 +3555,19 @@ qemuBuildMemoryBackendProps(virJSONValuePtr *backendProps,
|
|||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||||
_("this qemu doesn't support the "
|
_("this qemu doesn't support the "
|
||||||
"memory-backend-file object"));
|
"memory-backend-file object"));
|
||||||
goto cleanup;
|
return -1;
|
||||||
} else if (STREQ(backendType, "memory-backend-ram") &&
|
} else if (STREQ(backendType, "memory-backend-ram") &&
|
||||||
!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_OBJECT_MEMORY_RAM)) {
|
!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_OBJECT_MEMORY_RAM)) {
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||||
_("this qemu doesn't support the "
|
_("this qemu doesn't support the "
|
||||||
"memory-backend-ram object"));
|
"memory-backend-ram object"));
|
||||||
goto cleanup;
|
return -1;
|
||||||
} else if (STREQ(backendType, "memory-backend-memory") &&
|
} else if (STREQ(backendType, "memory-backend-memory") &&
|
||||||
!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_OBJECT_MEMORY_MEMFD)) {
|
!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_OBJECT_MEMORY_MEMFD)) {
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||||
_("this qemu doesn't support the "
|
_("this qemu doesn't support the "
|
||||||
"memory-backend-memfd object"));
|
"memory-backend-memfd object"));
|
||||||
goto cleanup;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
@ -3577,7 +3577,6 @@ qemuBuildMemoryBackendProps(virJSONValuePtr *backendProps,
|
|||||||
&props)))
|
&props)))
|
||||||
ret = -1;
|
ret = -1;
|
||||||
|
|
||||||
cleanup:
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user