render / rpms / libvirt

Forked from rpms/libvirt 4 months ago
Clone
e8e641
From 328cc56c14284fa7c026fd0fc4e4ab5d80bed9dd Mon Sep 17 00:00:00 2001
e8e641
Message-Id: <328cc56c14284fa7c026fd0fc4e4ab5d80bed9dd@dist-git>
e8e641
From: Michal Privoznik <mprivozn@redhat.com>
e8e641
Date: Tue, 14 Mar 2023 17:19:27 +0100
e8e641
Subject: [PATCH] qemuBuildMemoryBackendProps: Join two conditions
e8e641
e8e641
There are two compound conditions in
e8e641
qemuBuildMemoryBackendProps() and each one checks for nodemask
e8e641
for NULL first. Join them into one bigger block.
e8e641
e8e641
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
e8e641
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
e8e641
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
e8e641
(cherry picked from commit 450d932cd9a604d1e7d25c9f239cad08ca5e375c)
e8e641
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2185039
e8e641
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
e8e641
---
e8e641
 src/qemu/qemu_command.c | 26 ++++++++++++++------------
e8e641
 1 file changed, 14 insertions(+), 12 deletions(-)
e8e641
e8e641
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
e8e641
index 5edad046d5..436df47eaa 100644
e8e641
--- a/src/qemu/qemu_command.c
e8e641
+++ b/src/qemu/qemu_command.c
e8e641
@@ -3431,19 +3431,21 @@ qemuBuildMemoryBackendProps(virJSONValue **backendProps,
e8e641
             return -1;
e8e641
     }
e8e641
 
e8e641
-    /* Make sure the requested nodeset is sensible */
e8e641
-    if (nodemask && !virNumaNodesetIsAvailable(nodemask))
e8e641
-        return -1;
e8e641
-
e8e641
-    /* If mode is "restrictive", we should only use cgroups setting allowed memory
e8e641
-     * nodes, and skip passing the host-nodes and policy parameters to QEMU command
e8e641
-     * line which means we will use system default memory policy. */
e8e641
-    if (nodemask && mode != VIR_DOMAIN_NUMATUNE_MEM_RESTRICTIVE) {
e8e641
-        if (virJSONValueObjectAdd(&props,
e8e641
-                                  "m:host-nodes", nodemask,
e8e641
-                                  "S:policy", qemuNumaPolicyTypeToString(mode),
e8e641
-                                  NULL) < 0)
e8e641
+    if (nodemask) {
e8e641
+        /* Make sure the requested nodeset is sensible */
e8e641
+        if (!virNumaNodesetIsAvailable(nodemask))
e8e641
             return -1;
e8e641
+
e8e641
+        /* If mode is "restrictive", we should only use cgroups setting allowed memory
e8e641
+         * nodes, and skip passing the host-nodes and policy parameters to QEMU command
e8e641
+         * line which means we will use system default memory policy. */
e8e641
+        if (mode != VIR_DOMAIN_NUMATUNE_MEM_RESTRICTIVE) {
e8e641
+            if (virJSONValueObjectAdd(&props,
e8e641
+                                      "m:host-nodes", nodemask,
e8e641
+                                      "S:policy", qemuNumaPolicyTypeToString(mode),
e8e641
+                                      NULL) < 0)
e8e641
+                return -1;
e8e641
+        }
e8e641
     }
e8e641
 
e8e641
     /* If none of the following is requested... */
e8e641
-- 
e8e641
2.40.0