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

Peter Krempa pkrempa at redhat.com
Fri Oct 5 12:14:04 UTC 2018


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 at 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




More information about the libvir-list mailing list