1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-22 17:34:18 +03:00

qemuBuildMemoryBackendProps: Join two conditions

There are two compound conditions in
qemuBuildMemoryBackendProps() and each one checks for nodemask
for NULL first. Join them into one bigger block.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
This commit is contained in:
Michal Privoznik 2023-03-14 17:19:27 +01:00
parent 7feed1613d
commit 450d932cd9

View File

@ -3437,19 +3437,21 @@ qemuBuildMemoryBackendProps(virJSONValue **backendProps,
return -1;
}
/* Make sure the requested nodeset is sensible */
if (nodemask && !virNumaNodesetIsAvailable(nodemask))
return -1;
/* If mode is "restrictive", we should only use cgroups setting allowed memory
* nodes, and skip passing the host-nodes and policy parameters to QEMU command
* line which means we will use system default memory policy. */
if (nodemask && mode != VIR_DOMAIN_NUMATUNE_MEM_RESTRICTIVE) {
if (virJSONValueObjectAdd(&props,
"m:host-nodes", nodemask,
"S:policy", qemuNumaPolicyTypeToString(mode),
NULL) < 0)
if (nodemask) {
/* Make sure the requested nodeset is sensible */
if (!virNumaNodesetIsAvailable(nodemask))
return -1;
/* If mode is "restrictive", we should only use cgroups setting allowed memory
* nodes, and skip passing the host-nodes and policy parameters to QEMU command
* line which means we will use system default memory policy. */
if (mode != VIR_DOMAIN_NUMATUNE_MEM_RESTRICTIVE) {
if (virJSONValueObjectAdd(&props,
"m:host-nodes", nodemask,
"S:policy", qemuNumaPolicyTypeToString(mode),
NULL) < 0)
return -1;
}
}
/* If none of the following is requested... */