diff options
author | Michal Privoznik <mprivozn@redhat.com> | 2023-03-14 17:19:27 +0100 |
---|---|---|
committer | Michal Privoznik <mprivozn@redhat.com> | 2023-03-15 12:46:46 +0100 |
commit | 450d932cd9a604d1e7d25c9f239cad08ca5e375c (patch) | |
tree | 5b8b5f9090e524902421293a9020b5857a0f83ee /src | |
parent | 7feed1613df72acd6dbcb65513942163b56e6b3a (diff) | |
download | libvirt-450d932cd9a604d1e7d25c9f239cad08ca5e375c.tar.gz |
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>
Diffstat (limited to 'src')
-rw-r--r-- | src/qemu/qemu_command.c | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 929bcc0be1..b0cb252d0b 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -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... */ |