render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
0a7476
From 9eba70b364bae88085b524d528ac71cb4337e57c Mon Sep 17 00:00:00 2001
0a7476
Message-Id: <9eba70b364bae88085b524d528ac71cb4337e57c@dist-git>
0a7476
From: Laine Stump <laine@laine.org>
0a7476
Date: Thu, 11 Apr 2019 15:14:30 -0400
0a7476
Subject: [PATCH] qemu_hotplug: remove unnecessary check for valid PCI address
0a7476
MIME-Version: 1.0
0a7476
Content-Type: text/plain; charset=UTF-8
0a7476
Content-Transfer-Encoding: 8bit
0a7476
0a7476
When support for hotplug/unplug of SCSI controllers was added way back
0a7476
in December 2009 (commit da9d937b), unplug was handled by calling the
0a7476
now-extinct function qemuMonitorRemovePCIDevice(), which required a
0a7476
PCI address as an argument. At the same time, the idea of every device
0a7476
in the config having a PCI address apparently was not yet fully
0a7476
implemented, because the author of the patch including a check for a
0a7476
valid PCI address in the device object.
0a7476
0a7476
These days, all PCI devices are guaranteed to have a valid PCI
0a7476
address. But more important than that, we no longer detach devices by
0a7476
PCI address, but instead use qemuDomainDeleteDevice(), which
0a7476
identifies the device by its alias. So checking for a valid PCI
0a7476
address is just pointless extra code that obscures the high level of
0a7476
similarity between all the individual qemuDomainDetach*Device()
0a7476
functions.
0a7476
0a7476
Signed-off-by: Laine Stump <laine@laine.org>
0a7476
ACKed-by: Peter Krempa <pkrempa@redhat.com>
0a7476
Reviewed-by: Ján Tomko <jtomko@redhat.com>
0a7476
(cherry picked from commit 155064e0ed53b13701ff176c3f92605b1a850a9d)
0a7476
0a7476
Partially-Resolves: https://bugzilla.redhat.com/1658198
0a7476
Signed-off-by: Laine Stump <laine@redhat.com>
0a7476
Signed-off-by: Laine Stump <laine@laine.org>
0a7476
Message-Id: <20190411191453.24055-19-laine@redhat.com>
0a7476
Acked-by: Michal Privoznik <mprivozn@redhat.com>
0a7476
---
0a7476
 src/qemu/qemu_hotplug.c | 16 ----------------
0a7476
 1 file changed, 16 deletions(-)
0a7476
0a7476
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
0a7476
index ffb2e258b5..39e40e2740 100644
0a7476
--- a/src/qemu/qemu_hotplug.c
0a7476
+++ b/src/qemu/qemu_hotplug.c
0a7476
@@ -4915,22 +4915,6 @@ int qemuDomainDetachControllerDevice(virQEMUDriverPtr driver,
0a7476
 
0a7476
     detach = vm->def->controllers[idx];
0a7476
 
0a7476
-    if (detach->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI &&
0a7476
-        detach->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW &&
0a7476
-        detach->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390) {
0a7476
-        virReportError(VIR_ERR_OPERATION_FAILED,
0a7476
-                       _("device with '%s' address cannot be detached"),
0a7476
-                       virDomainDeviceAddressTypeToString(detach->info.type));
0a7476
-        goto cleanup;
0a7476
-    }
0a7476
-
0a7476
-    if (!virDomainDeviceAddressIsValid(&detach->info, detach->info.type)) {
0a7476
-        virReportError(VIR_ERR_OPERATION_FAILED,
0a7476
-                       _("device with invalid '%s' address cannot be detached"),
0a7476
-                       virDomainDeviceAddressTypeToString(detach->info.type));
0a7476
-        goto cleanup;
0a7476
-    }
0a7476
-
0a7476
     if (qemuIsMultiFunctionDevice(vm->def, &detach->info)) {
0a7476
         virReportError(VIR_ERR_OPERATION_FAILED,
0a7476
                        _("cannot hot unplug multifunction PCI device: %s"),
0a7476
-- 
0a7476
2.21.0
0a7476