]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemuBuildMemoryBackendProps: Join two conditions
authorMichal Privoznik <mprivozn@redhat.com>
Tue, 14 Mar 2023 16:19:27 +0000 (17:19 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Wed, 15 Mar 2023 11:46:46 +0000 (12:46 +0100)
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>
src/qemu/qemu_command.c

index 929bcc0be1629981fe900cfa403c900f088b4e9b..b0cb252d0b195ae90802fbf2224c7dadd58fb1e1 100644 (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... */