[PATCH] qemuBuildNumaCommandLine: Fix @masterInitiator check

Michal Privoznik posted 1 patch 3 years, 8 months ago
Test syntax-check failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/ccf627c110a178afa529818474e555bca62fc165.1594215575.git.mprivozn@redhat.com
src/qemu/qemu_command.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] qemuBuildNumaCommandLine: Fix @masterInitiator check
Posted by Michal Privoznik 3 years, 8 months ago
A few commits ago, in aeecbc87b73, I've implemented command line
generation for ACPI HMAT. For this, we need to know if at least
one guest NUMA node has vCPUs. This is tracked in
@masterInitiator variable, which is initialized to -1, then we
iterate through guest NUMA nodes and break the loop if we find a
node with a vCPU. After the loop, if masterInitiator is still
negative then no NUMA node has a vCPU and we error out. But this
exact check was missing comparison for negativeness.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---

Pushed under oops and trivial rules.

 src/qemu/qemu_command.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 7f215b4cc6..f06a2f2754 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -7312,7 +7312,7 @@ qemuBuildNumaCommandLine(virQEMUDriverConfigPtr cfg,
         }
     }
 
-    if (masterInitiator) {
+    if (masterInitiator < 0) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                        _("At least one NUMA node has to have CPUs"));
         goto cleanup;
-- 
2.26.2