|
|
99cbc7 |
From f76ff96c3ea876df4f09af0ed3e75cbaf31837cf Mon Sep 17 00:00:00 2001
|
|
|
99cbc7 |
Message-Id: <f76ff96c3ea876df4f09af0ed3e75cbaf31837cf@dist-git>
|
|
|
99cbc7 |
From: Peter Krempa <pkrempa@redhat.com>
|
|
|
99cbc7 |
Date: Thu, 11 Apr 2019 15:14:28 -0400
|
|
|
99cbc7 |
Subject: [PATCH] qemu: hotplug: Use switch statement for selecting disk bus
|
|
|
99cbc7 |
function
|
|
|
99cbc7 |
MIME-Version: 1.0
|
|
|
99cbc7 |
Content-Type: text/plain; charset=UTF-8
|
|
|
99cbc7 |
Content-Transfer-Encoding: 8bit
|
|
|
99cbc7 |
|
|
|
99cbc7 |
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
|
|
|
99cbc7 |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
|
99cbc7 |
(cherry picked from commit eb437cfdf8f536293e4a4f5ff0f57058b7e6988a)
|
|
|
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-17-laine@redhat.com>
|
|
|
99cbc7 |
Acked-by: Michal Privoznik <mprivozn@redhat.com>
|
|
|
99cbc7 |
---
|
|
|
99cbc7 |
src/qemu/qemu_hotplug.c | 24 ++++++++++++++++++++----
|
|
|
99cbc7 |
1 file changed, 20 insertions(+), 4 deletions(-)
|
|
|
99cbc7 |
|
|
|
99cbc7 |
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
|
|
|
99cbc7 |
index b7db65964e..5e8583ae8b 100644
|
|
|
99cbc7 |
--- a/src/qemu/qemu_hotplug.c
|
|
|
99cbc7 |
+++ b/src/qemu/qemu_hotplug.c
|
|
|
99cbc7 |
@@ -4823,14 +4823,30 @@ qemuDomainDetachDeviceDiskLive(virQEMUDriverPtr driver,
|
|
|
99cbc7 |
switch ((virDomainDiskDevice) disk->device) {
|
|
|
99cbc7 |
case VIR_DOMAIN_DISK_DEVICE_DISK:
|
|
|
99cbc7 |
case VIR_DOMAIN_DISK_DEVICE_LUN:
|
|
|
99cbc7 |
- if (disk->bus == VIR_DOMAIN_DISK_BUS_VIRTIO)
|
|
|
99cbc7 |
+
|
|
|
99cbc7 |
+ switch ((virDomainDiskBus) disk->bus) {
|
|
|
99cbc7 |
+ case VIR_DOMAIN_DISK_BUS_VIRTIO:
|
|
|
99cbc7 |
return qemuDomainDetachVirtioDiskDevice(driver, vm, disk, async);
|
|
|
99cbc7 |
- else if (disk->bus == VIR_DOMAIN_DISK_BUS_SCSI ||
|
|
|
99cbc7 |
- disk->bus == VIR_DOMAIN_DISK_BUS_USB)
|
|
|
99cbc7 |
+
|
|
|
99cbc7 |
+ case VIR_DOMAIN_DISK_BUS_USB:
|
|
|
99cbc7 |
+ case VIR_DOMAIN_DISK_BUS_SCSI:
|
|
|
99cbc7 |
return qemuDomainDetachDiskDevice(driver, vm, disk, async);
|
|
|
99cbc7 |
- else
|
|
|
99cbc7 |
+
|
|
|
99cbc7 |
+ case VIR_DOMAIN_DISK_BUS_IDE:
|
|
|
99cbc7 |
+ case VIR_DOMAIN_DISK_BUS_FDC:
|
|
|
99cbc7 |
+ case VIR_DOMAIN_DISK_BUS_XEN:
|
|
|
99cbc7 |
+ case VIR_DOMAIN_DISK_BUS_UML:
|
|
|
99cbc7 |
+ case VIR_DOMAIN_DISK_BUS_SATA:
|
|
|
99cbc7 |
+ case VIR_DOMAIN_DISK_BUS_SD:
|
|
|
99cbc7 |
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
|
|
|
99cbc7 |
_("This type of disk cannot be hot unplugged"));
|
|
|
99cbc7 |
+ break;
|
|
|
99cbc7 |
+
|
|
|
99cbc7 |
+ case VIR_DOMAIN_DISK_BUS_LAST:
|
|
|
99cbc7 |
+ default:
|
|
|
99cbc7 |
+ virReportEnumRangeError(virDomainDiskBus, disk->bus);
|
|
|
99cbc7 |
+ break;
|
|
|
99cbc7 |
+ }
|
|
|
99cbc7 |
break;
|
|
|
99cbc7 |
|
|
|
99cbc7 |
case VIR_DOMAIN_DISK_DEVICE_CDROM:
|
|
|
99cbc7 |
--
|
|
|
99cbc7 |
2.21.0
|
|
|
99cbc7 |
|