From a7643da82e0a152304a9283a76107be7ea274749 Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Tue, 3 Sep 2019 13:27:52 +0200 Subject: [PATCH] qemu: block: Explicitly specify backingStore when creating format layer props MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pass in backing store explicitly to qemuBlockStorageSourceGetBlockdevProps and fix the callers. Signed-off-by: Peter Krempa Reviewed-by: Ján Tomko --- src/qemu/qemu_block.c | 8 +++++--- src/qemu/qemu_block.h | 3 ++- tests/qemublocktest.c | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index 54b829efed..fb631276c9 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -1396,15 +1396,16 @@ qemuBlockStorageSourceGetBlockdevFormatProps(virStorageSourcePtr src) * qemuBlockStorageSourceGetBlockdevProps: * * @src: storage source to format + * @backingStore: a storage source to use as backing of @src * * Formats @src into a JSON object which can be used with blockdev-add or * -blockdev. The formatted object contains both the storage and format layer * in nested form including link to the backing chain layer if necessary. */ virJSONValuePtr -qemuBlockStorageSourceGetBlockdevProps(virStorageSourcePtr src) +qemuBlockStorageSourceGetBlockdevProps(virStorageSourcePtr src, + virStorageSourcePtr backingStore) { - virStorageSourcePtr backingStore = src->backingStore; VIR_AUTOPTR(virJSONValue) props = NULL; if (!(props = qemuBlockStorageSourceGetBlockdevFormatProps(src))) @@ -1484,7 +1485,8 @@ qemuBlockStorageSourceAttachPrepareBlockdev(virStorageSourcePtr src, if (VIR_ALLOC(data) < 0) return NULL; - if (!(data->formatProps = qemuBlockStorageSourceGetBlockdevProps(src)) || + if (!(data->formatProps = qemuBlockStorageSourceGetBlockdevProps(src, + src->backingStore)) || !(data->storageProps = qemuBlockStorageSourceGetBackendProps(src, false, false, autoreadonly))) diff --git a/src/qemu/qemu_block.h b/src/qemu/qemu_block.h index a5e970fa1e..8c96a9b940 100644 --- a/src/qemu/qemu_block.h +++ b/src/qemu/qemu_block.h @@ -66,7 +66,8 @@ virURIPtr qemuBlockStorageSourceGetURI(virStorageSourcePtr src); virJSONValuePtr -qemuBlockStorageSourceGetBlockdevProps(virStorageSourcePtr src); +qemuBlockStorageSourceGetBlockdevProps(virStorageSourcePtr src, + virStorageSourcePtr backingStore); virJSONValuePtr qemuBlockStorageGetCopyOnReadProps(virDomainDiskDefPtr disk); diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c index 1bf72a4615..bb0579056e 100644 --- a/tests/qemublocktest.c +++ b/tests/qemublocktest.c @@ -226,7 +226,7 @@ testQemuDiskXMLToProps(const void *opaque) if (qemuDomainPrepareDiskSourceData(disk, n, NULL, data->qemuCaps) < 0) goto cleanup; - if (!(formatProps = qemuBlockStorageSourceGetBlockdevProps(n)) || + if (!(formatProps = qemuBlockStorageSourceGetBlockdevProps(n, n->backingStore)) || !(storageSrcOnlyProps = qemuBlockStorageSourceGetBackendProps(n, false, true, true)) || !(storageProps = qemuBlockStorageSourceGetBackendProps(n, false, false, true))) { if (!data->fail) {