render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
c313de
From 77404a4f0ff85fbc0a2c24afc736ffbd8b82ef4d Mon Sep 17 00:00:00 2001
c313de
Message-Id: <77404a4f0ff85fbc0a2c24afc736ffbd8b82ef4d@dist-git>
c313de
From: Laine Stump <laine@laine.org>
c313de
Date: Mon, 8 Apr 2019 10:57:31 +0200
c313de
Subject: [PATCH] qemu_hotplug: remove erroneous call to
c313de
 qemuDomainDetachExtensionDevice()
c313de
MIME-Version: 1.0
c313de
Content-Type: text/plain; charset=UTF-8
c313de
Content-Transfer-Encoding: 8bit
c313de
c313de
qemuDomainDetachControllerDevice() calls
c313de
qemuDomainDetachExtensionDevice() when the controller type is
c313de
PCI. This is incorrect in multiple ways:
c313de
c313de
* Any code that tears down a device should be in the
c313de
  qemuDomainRemove*Device() function (which is called after libvirt
c313de
  gets a DEVICE_DELETED event from qemu indicating that the guest is
c313de
  finished with the device on its end. The qemuDomainDetach*Device()
c313de
  functions should only contain code that ensures the requested
c313de
  operation is valid, and sends the command to qemu to initiate the
c313de
  unplug.
c313de
c313de
* qemuDomainDetachExtensionDevice() is a function that applies to
c313de
  devices that plug into a PCI slot, *not* necessarily PCI controllers
c313de
  (which is what's being checked in the offending code). The proper
c313de
  way to check for this would be to see if the DeviceInfo for the
c313de
  controller device had a PCI address, not to check if the controller
c313de
  is a PCI controller (the code being removed was doing the latter).
c313de
c313de
* According to commit 1d1e264f1 that added this code (and other
c313de
  support for hotplugging zPCI devices on s390), it's not necessary to
c313de
  explicitly detach the zPCI device when unplugging a PCI device. To
c313de
  quote:
c313de
c313de
       There's no need to implement hot unplug for zPCI as QEMU
c313de
       implements an unplug callback which will unplug both PCI and
c313de
       zPCI device in a cascaded way.
c313de
c313de
  and the evidence bears this out - all the other uses of
c313de
  qemuDomainDetachExtensionDevice() (except one, which I believe is
c313de
  also in error, and is being removed in a separate patch) are only to
c313de
  remove the zPCI extension device in cases where it was successfully
c313de
  added, but there was some other failure later in the hotplug process
c313de
  (so there was no regular PCI device to remove and trigger removal of
c313de
  the zPCI extension device).
c313de
c313de
* PCI controllers are not hot pluggable, so this is dead code
c313de
  anyway. (The only controllers that can currently be
c313de
  hotplugged/unplugged are SCSI controllers).
c313de
c313de
Signed-off-by: Laine Stump <laine@laine.org>
c313de
Reviewed-by: Ján Tomko <jtomko@redhat.com>
c313de
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
c313de
c313de
(cherry picked from commit 143291698358f5a1e693c768893d89038420af25)
c313de
c313de
https://bugzilla.redhat.com/show_bug.cgi?id=1508149
c313de
c313de
Conflicts:
c313de
c313de
  * src/qemu/qemu_hotplug.c
c313de
    + the code dealing with entering and exiting the monitor is
c313de
      quite a bit different because we don't have backported
c313de
      qemuDomainDeleteDevice() downstream
c313de
      - missing 4cd13478ac33
c313de
c313de
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
c313de
Message-Id: <20190408085732.28684-15-abologna@redhat.com>
c313de
Reviewed-by: Laine Stump <laine@redhat.com>
c313de
Reviewed-by: Ján Tomko <jtomko@redhat.com>
c313de
---
c313de
 src/qemu/qemu_hotplug.c | 6 ------
c313de
 1 file changed, 6 deletions(-)
c313de
c313de
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
c313de
index 8394efa739..f16213c6e0 100644
c313de
--- a/src/qemu/qemu_hotplug.c
c313de
+++ b/src/qemu/qemu_hotplug.c
c313de
@@ -5077,17 +5077,11 @@ int qemuDomainDetachControllerDevice(virQEMUDriverPtr driver,
c313de
         qemuDomainMarkDeviceForRemoval(vm, &detach->info);
c313de
 
c313de
     qemuDomainObjEnterMonitor(driver, vm);
c313de
-    if (detach->type == VIR_DOMAIN_CONTROLLER_TYPE_PCI &&
c313de
-        qemuDomainDetachExtensionDevice(priv->mon, &detach->info)) {
c313de
-        goto exit_monitor;
c313de
-    }
c313de
-
c313de
     if (qemuMonitorDelDevice(priv->mon, detach->info.alias)) {
c313de
         ignore_value(qemuDomainObjExitMonitor(driver, vm));
c313de
         goto cleanup;
c313de
     }
c313de
 
c313de
- exit_monitor:
c313de
     if (qemuDomainObjExitMonitor(driver, vm) < 0)
c313de
         goto cleanup;
c313de
 
c313de
-- 
c313de
2.22.0
c313de