render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
0a7476
From b947ae5274f9a4227f81f13a7973958daeb8d922 Mon Sep 17 00:00:00 2001
0a7476
Message-Id: <b947ae5274f9a4227f81f13a7973958daeb8d922@dist-git>
0a7476
From: Michal Privoznik <mprivozn@redhat.com>
0a7476
Date: Thu, 11 Apr 2019 15:14:24 -0400
0a7476
Subject: [PATCH] qemu_hotplug: Properly check for qemuMonitorDelDevice retval
0a7476
0a7476
Luckily, the function returns only 0 or -1 so all the checks work
0a7476
as expected. Anyway, our rule is that a positive value means
0a7476
success so if the function ever returns a positive value these
0a7476
checks will fail. Make them check for a negative value properly.
0a7476
0a7476
At the same time fix qemuDomainDetachExtensionDevice() reval
0a7476
check. It is somewhat related to the aim of this patch.
0a7476
0a7476
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
0a7476
(cherry picked from commit 8b71b0c727398469b95d025e3ec92b881969412f)
0a7476
0a7476
Partially-Resolves: https://bugzilla.redhat.com/1658198
0a7476
Signed-off-by: Laine Stump <laine@redhat.com>
0a7476
0a7476
Conflicts: src/qemu/qemu_hotplug.c - qemuDomainDetachExtensionDevice() was added
0a7476
                           upstream
0a7476
Signed-off-by: Laine Stump <laine@laine.org>
0a7476
Message-Id: <20190411191453.24055-13-laine@redhat.com>
0a7476
Acked-by: Michal Privoznik <mprivozn@redhat.com>
0a7476
---
0a7476
 src/qemu/qemu_hotplug.c | 6 +++---
0a7476
 1 file changed, 3 insertions(+), 3 deletions(-)
0a7476
0a7476
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
0a7476
index b5ccaf4021..963b87f798 100644
0a7476
--- a/src/qemu/qemu_hotplug.c
0a7476
+++ b/src/qemu/qemu_hotplug.c
0a7476
@@ -4929,7 +4929,7 @@ int qemuDomainDetachControllerDevice(virQEMUDriverPtr driver,
0a7476
         qemuDomainMarkDeviceForRemoval(vm, &detach->info);
0a7476
 
0a7476
     qemuDomainObjEnterMonitor(driver, vm);
0a7476
-    if (qemuMonitorDelDevice(priv->mon, detach->info.alias)) {
0a7476
+    if (qemuMonitorDelDevice(priv->mon, detach->info.alias) < 0) {
0a7476
         ignore_value(qemuDomainObjExitMonitor(driver, vm));
0a7476
         goto cleanup;
0a7476
     }
0a7476
@@ -6441,7 +6441,7 @@ qemuDomainDetachInputDevice(virDomainObjPtr vm,
0a7476
         qemuDomainMarkDeviceForRemoval(vm, &input->info);
0a7476
 
0a7476
     qemuDomainObjEnterMonitor(driver, vm);
0a7476
-    if (qemuMonitorDelDevice(priv->mon, input->info.alias)) {
0a7476
+    if (qemuMonitorDelDevice(priv->mon, input->info.alias) < 0) {
0a7476
         ignore_value(qemuDomainObjExitMonitor(driver, vm));
0a7476
         goto cleanup;
0a7476
     }
0a7476
@@ -6484,7 +6484,7 @@ qemuDomainDetachVsockDevice(virDomainObjPtr vm,
0a7476
         qemuDomainMarkDeviceForRemoval(vm, &vsock->info);
0a7476
 
0a7476
     qemuDomainObjEnterMonitor(driver, vm);
0a7476
-    if (qemuMonitorDelDevice(priv->mon, vsock->info.alias)) {
0a7476
+    if (qemuMonitorDelDevice(priv->mon, vsock->info.alias) < 0) {
0a7476
         ignore_value(qemuDomainObjExitMonitor(driver, vm));
0a7476
         goto cleanup;
0a7476
     }
0a7476
-- 
0a7476
2.21.0
0a7476