[libvirt] [PATCH RFC 07/40] qemu: domain: Tolerate NULL @disk in qemuDomainPrepareDiskSourceData

Peter Krempa pkrempa at redhat.com
Fri Oct 18 16:10:52 UTC 2019


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 at redhat.com>
---
 src/qemu/qemu_domain.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 259cf51e2b..3deb69cb63 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -15095,6 +15095,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;
-- 
2.21.0




More information about the libvir-list mailing list