render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
a41c76
From 2145d7b6f4370dfcd7dadae7daf544767cde0392 Mon Sep 17 00:00:00 2001
a41c76
Message-Id: <2145d7b6f4370dfcd7dadae7daf544767cde0392@dist-git>
a41c76
From: Jiri Denemark <jdenemar@redhat.com>
a41c76
Date: Tue, 26 May 2020 10:58:51 +0200
a41c76
Subject: [PATCH] cpu: Change control flow in virCPUUpdateLive
a41c76
MIME-Version: 1.0
a41c76
Content-Type: text/plain; charset=UTF-8
a41c76
Content-Transfer-Encoding: 8bit
a41c76
a41c76
The updateLive CPU sub-driver function is supposed to be called only for
a41c76
a subset of CPU definitions. Let's make it more obvious by turning a
a41c76
negative test and return into a positive check.
a41c76
a41c76
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
a41c76
Reviewed-by: Ján Tomko <jtomko@redhat.com>
a41c76
(cherry picked from commit 68c0b85ecb07c8cefcf4f4a2ffc28e123baa9e8c)
a41c76
a41c76
https://bugzilla.redhat.com/show_bug.cgi?id=1839999
a41c76
a41c76
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
a41c76
Message-Id: <2633727669ca50970bd10abe9b045e24b76028d1.1590483392.git.jdenemar@redhat.com>
a41c76
Reviewed-by: Ján Tomko <jtomko@redhat.com>
a41c76
---
a41c76
 src/cpu/cpu.c | 11 ++++++-----
a41c76
 1 file changed, 6 insertions(+), 5 deletions(-)
a41c76
a41c76
diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c
a41c76
index ae3a0acc10..1cb2dd04f4 100644
a41c76
--- a/src/cpu/cpu.c
a41c76
+++ b/src/cpu/cpu.c
a41c76
@@ -647,13 +647,14 @@ virCPUUpdateLive(virArch arch,
a41c76
     if (!driver->updateLive)
a41c76
         return 1;
a41c76
 
a41c76
-    if (cpu->mode != VIR_CPU_MODE_CUSTOM)
a41c76
-        return 1;
a41c76
+    if (cpu->mode == VIR_CPU_MODE_CUSTOM) {
a41c76
+        if (driver->updateLive(cpu, dataEnabled, dataDisabled) < 0)
a41c76
+            return -1;
a41c76
 
a41c76
-    if (driver->updateLive(cpu, dataEnabled, dataDisabled) < 0)
a41c76
-        return -1;
a41c76
+        return 0;
a41c76
+    }
a41c76
 
a41c76
-    return 0;
a41c76
+    return 1;
a41c76
 }
a41c76
 
a41c76
 
a41c76
-- 
a41c76
2.26.2
a41c76