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