Pass backing store as an argument rather than extracting it locally and
fix the callers.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/qemu/qemu_block.c | 4 +++-
src/qemu/qemu_block.h | 1 +
src/qemu/qemu_command.c | 2 +-
src/qemu/qemu_migration.c | 4 +++-
4 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c
index fb631276c9..4b5dd30e17 100644
--- a/src/qemu/qemu_block.c
+++ b/src/qemu/qemu_block.c
@@ -1464,6 +1464,7 @@
qemuBlockStorageSourceAttachDataFree(qemuBlockStorageSourceAttachDataPtr data)
/**
* qemuBlockStorageSourceAttachPrepareBlockdev:
* @src: storage source to prepare data from
+ * @backingStore: storage source to use as backing of @src
* @autoreadonly: use 'auto-read-only' feature of qemu
*
* Creates a qemuBlockStorageSourceAttachData structure containing data to attach
@@ -1478,6 +1479,7 @@
qemuBlockStorageSourceAttachDataFree(qemuBlockStorageSourceAttachDataPtr data)
*/
qemuBlockStorageSourceAttachDataPtr
qemuBlockStorageSourceAttachPrepareBlockdev(virStorageSourcePtr src,
+ virStorageSourcePtr backingStore,
bool autoreadonly)
{
VIR_AUTOPTR(qemuBlockStorageSourceAttachData) data = NULL;
@@ -1486,7 +1488,7 @@ qemuBlockStorageSourceAttachPrepareBlockdev(virStorageSourcePtr
src,
return NULL;
if (!(data->formatProps = qemuBlockStorageSourceGetBlockdevProps(src,
-
src->backingStore)) ||
+ backingStore)) ||
!(data->storageProps = qemuBlockStorageSourceGetBackendProps(src, false,
false,
autoreadonly)))
diff --git a/src/qemu/qemu_block.h b/src/qemu/qemu_block.h
index 8c96a9b940..2de614b159 100644
--- a/src/qemu/qemu_block.h
+++ b/src/qemu/qemu_block.h
@@ -109,6 +109,7 @@ VIR_DEFINE_AUTOPTR_FUNC(qemuBlockStorageSourceAttachData,
qemuBlockStorageSourceAttachDataPtr
qemuBlockStorageSourceAttachPrepareBlockdev(virStorageSourcePtr src,
+ virStorageSourcePtr backingStore,
bool autoreadonly);
qemuBlockStorageSourceAttachDataPtr
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 05c35919bf..fa8bf39359 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -10727,7 +10727,7 @@
qemuBuildStorageSourceChainAttachPrepareBlockdevOne(qemuBlockStorageSourceChainD
{
VIR_AUTOPTR(qemuBlockStorageSourceAttachData) elem = NULL;
- if (!(elem = qemuBlockStorageSourceAttachPrepareBlockdev(src, true)))
+ if (!(elem = qemuBlockStorageSourceAttachPrepareBlockdev(src, src->backingStore,
true)))
return -1;
if (qemuBuildStorageSourceAttachPrepareCommon(src, elem, qemuCaps) < 0)
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index bd40a8e70d..e387deb497 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -832,7 +832,9 @@ qemuMigrationSrcNBDStorageCopyBlockdev(virQEMUDriverPtr driver,
/* Migration via blockdev-mirror was supported sooner than the auto-read-only
* feature was added to qemu */
- if (!(data = qemuBlockStorageSourceAttachPrepareBlockdev(copysrc, false)))
+ if (!(data = qemuBlockStorageSourceAttachPrepareBlockdev(copysrc,
+ copysrc->backingStore,
+ false)))
goto cleanup;
if (qemuDomainObjEnterMonitorAsync(driver, vm,
--
2.21.0