qemu: domain: Tolerate NULL @disk in qemuDomainPrepareDiskSourceData

In some cases we want to prepare a @src which is not meant to belong to
a disk and thus does not require us to copy the data. Allow passing in
NULL @disk into qemuDomainPrepareDiskSourceData.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
This commit is contained in:
Peter Krempa 2019-10-08 15:17:32 +02:00
parent b663201b23
commit ec042d3731

View File

@ -15082,6 +15082,9 @@ void
qemuDomainPrepareDiskSourceData(virDomainDiskDefPtr disk,
virStorageSourcePtr src)
{
if (!disk)
return;
/* transfer properties valid only for the top level image */
if (src == disk->src)
src->detect_zeroes = disk->detect_zeroes;