Blame SOURCES/libvirt-qemu-hotplug-Use-typecasted-enum-in-qemuDomainDetachDeviceDiskLive.patch

0a7476
From f77f23ddd733b005b989afbe6d28a6a7fdb88197 Mon Sep 17 00:00:00 2001
0a7476
Message-Id: <f77f23ddd733b005b989afbe6d28a6a7fdb88197@dist-git>
0a7476
From: Peter Krempa <pkrempa@redhat.com>
0a7476
Date: Thu, 11 Apr 2019 15:14:27 -0400
0a7476
Subject: [PATCH] qemu: hotplug: Use typecasted enum in
0a7476
 qemuDomainDetachDeviceDiskLive
0a7476
MIME-Version: 1.0
0a7476
Content-Type: text/plain; charset=UTF-8
0a7476
Content-Transfer-Encoding: 8bit
0a7476
0a7476
Use the correct type in switch and populate the missing cases.
0a7476
0a7476
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
0a7476
Reviewed-by: Ján Tomko <jtomko@redhat.com>
0a7476
(cherry picked from commit afa15d78cba36e2c6c6d6ddc5c5258b7add405ba)
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-16-laine@redhat.com>
0a7476
Acked-by: Michal Privoznik <mprivozn@redhat.com>
0a7476
---
0a7476
 src/qemu/qemu_hotplug.c | 11 +++++++++--
0a7476
 1 file changed, 9 insertions(+), 2 deletions(-)
0a7476
0a7476
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
0a7476
index 8047ac773f..b7db65964e 100644
0a7476
--- a/src/qemu/qemu_hotplug.c
0a7476
+++ b/src/qemu/qemu_hotplug.c
0a7476
@@ -4820,7 +4820,7 @@ qemuDomainDetachDeviceDiskLive(virQEMUDriverPtr driver,
0a7476
     }
0a7476
     disk = vm->def->disks[idx];
0a7476
 
0a7476
-    switch (disk->device) {
0a7476
+    switch ((virDomainDiskDevice) disk->device) {
0a7476
     case VIR_DOMAIN_DISK_DEVICE_DISK:
0a7476
     case VIR_DOMAIN_DISK_DEVICE_LUN:
0a7476
         if (disk->bus == VIR_DOMAIN_DISK_BUS_VIRTIO)
0a7476
@@ -4832,11 +4832,18 @@ qemuDomainDetachDeviceDiskLive(virQEMUDriverPtr driver,
0a7476
             virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
0a7476
                            _("This type of disk cannot be hot unplugged"));
0a7476
         break;
0a7476
-    default:
0a7476
+
0a7476
+    case VIR_DOMAIN_DISK_DEVICE_CDROM:
0a7476
+    case VIR_DOMAIN_DISK_DEVICE_FLOPPY:
0a7476
         virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
0a7476
                        _("disk device type '%s' cannot be detached"),
0a7476
                        virDomainDiskDeviceTypeToString(disk->device));
0a7476
         break;
0a7476
+
0a7476
+    case VIR_DOMAIN_DISK_DEVICE_LAST:
0a7476
+    default:
0a7476
+        virReportEnumRangeError(virDomainDiskDevice, disk->device);
0a7476
+        break;
0a7476
     }
0a7476
 
0a7476
     return -1;
0a7476
-- 
0a7476
2.21.0
0a7476