[libvirt] [PATCH v2 05/12] qemu: hotplug: Remove code handling possible missing disk source format

Peter Krempa posted 12 patches 7 years, 4 months ago
[libvirt] [PATCH v2 05/12] qemu: hotplug: Remove code handling possible missing disk source format
Posted by Peter Krempa 7 years, 4 months ago
qemu media changing code tried to assume old media's format for the new
one if that was not specified. Since the format will always be present
it does not make sense to keep the code around.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
---
 src/qemu/qemu_hotplug.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index ad7023c085..8123c12a26 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -250,14 +250,9 @@ qemuDomainChangeMediaLegacy(virQEMUDriverPtr driver,
         if (qemuGetDriveSourceString(newsrc, NULL, &sourcestr) < 0)
             goto cleanup;

-        if (virStorageSourceGetActualType(newsrc) != VIR_STORAGE_TYPE_DIR) {
-            if (newsrc->format > 0) {
-                format = virStorageFileFormatTypeToString(newsrc->format);
-            } else {
-                if (disk->src->format > 0)
-                    format = virStorageFileFormatTypeToString(disk->src->format);
-            }
-        }
+        if (virStorageSourceGetActualType(newsrc) != VIR_STORAGE_TYPE_DIR)
+            format = virStorageFileFormatTypeToString(newsrc->format);
+
         qemuDomainObjEnterMonitor(driver, vm);
         rc = qemuMonitorChangeMedia(priv->mon,
                                     driveAlias,
-- 
2.17.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list