Fix a crash when cloning a volume with no backing store

Introduced by commit 15213d1, not yet released.
This commit is contained in:
Ján Tomko 2014-08-01 15:24:20 +02:00
parent 221b1828f9
commit be3cbecd0e
3 changed files with 6 additions and 1 deletions

View File

@ -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",

View File

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

View File

@ -235,6 +235,9 @@ mymain(void)
DO_TEST("pool-dir", "vol-qcow2-nobacking",
"pool-dir", "vol-file",
"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);