[PATCH] Fix a crash when cloning a volume with no backing store

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

 



Introduced by commit 15213d1, not yet released.
---
 src/storage/storage_backend.c                             | 2 +-
 tests/storagevolxml2argvdata/qcow2-convert-nobacking.argv | 2 ++
 tests/storagevolxml2argvtest.c                            | 3 +++
 3 files changed, 6 insertions(+), 1 deletion(-)
 create mode 100644 tests/storagevolxml2argvdata/qcow2-convert-nobacking.argv

diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c
index 27b02cb..5cada39 100644
--- a/src/storage/storage_backend.c
+++ b/src/storage/storage_backend.c
@@ -887,7 +887,7 @@ virStorageBackendCreateQemuImgCmd(virConnectPtr conn,
          * backing store, not really sure what use it serves though, and it
          * may cause issues with lvm. Untested essentially.
          */
-        if (inputvol &&
+        if (inputvol && inputvol->target.backingStore &&
             STRNEQ_NULLABLE(inputvol->target.backingStore->path,
                             vol->target.backingStore->path)) {
             virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
diff --git a/tests/storagevolxml2argvdata/qcow2-convert-nobacking.argv b/tests/storagevolxml2argvdata/qcow2-convert-nobacking.argv
new file mode 100644
index 0000000..fd1f4c0
--- /dev/null
+++ b/tests/storagevolxml2argvdata/qcow2-convert-nobacking.argv
@@ -0,0 +1,2 @@
+qemu-img convert -f raw -O qcow2 -o encryption=on \
+/var/lib/libvirt/images/sparse.img /var/lib/libvirt/images/OtherDemo.img
diff --git a/tests/storagevolxml2argvtest.c b/tests/storagevolxml2argvtest.c
index 2a45f6f..f9d2d2d 100644
--- a/tests/storagevolxml2argvtest.c
+++ b/tests/storagevolxml2argvtest.c
@@ -237,6 +237,9 @@ mymain(void)
             "qcow2-nobacking-convert-prealloc", flags, FMT_OPTIONS);
     DO_TEST_FAIL("pool-dir", "vol-qcow2",
                  "pool-dir", "vol-file",
+                 "qcow2-convert-nobacking", 0, FMT_OPTIONS);
+    DO_TEST_FAIL("pool-dir", "vol-qcow2",
+                 "pool-dir", "vol-file",
                  "qcow2-convert-prealloc", flags, FMT_OPTIONS);
     DO_TEST("pool-dir", "vol-qcow2",
             NULL, NULL,
-- 
1.8.5.5

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