render / rpms / libvirt

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