[PATCH] storage: Fix volume cloning for logical volume.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When creating a logical volume with virStorageVolCreateXMLFrom,
"qemu-img convert" is called internally if clonevol is a file volume.
Then, vol->target.format is used as output_fmt parameter but the 
target.format of logical volumes is always 0 because logical volumes 
haven't the volume format type element.

Fortunately, 0 was treated as RAW file format before commit f772b3d9,
so there was no problem. But now, 0 is treated as the type of none,
qemu-img fails with "Unknown file format 'none'".

This patch fixes this issue by treating output block devices as RAW
file format like for input block devices.

Signed-off-by: Atsushi Kumagai <kumagai-atsushi@xxxxxxxxxxxxxxxxx>

diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c
index bb58d4a..2551f1f 100644
--- a/src/storage/storage_backend.c
+++ b/src/storage/storage_backend.c
@@ -652,7 +652,12 @@ virStorageBackendCreateQemuImgCmd(virConnectPtr conn,
     unsigned long long int size_arg;
     bool preallocate = false;

-    const char *type = virStorageFileFormatTypeToString(vol->target.format);
+    /* Treat output block devices as 'raw' format */
+    const char *type =
+        virStorageFileFormatTypeToString(vol->type == VIR_STORAGE_VOL_BLOCK ?
+                                         VIR_STORAGE_FILE_RAW :
+                                         vol->target.format);
+
     const char *backingType = vol->backingStore.path ?
         virStorageFileFormatTypeToString(vol->backingStore.format) : NULL;
-- 
1.7.1

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




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]