In some cases we'll need to pass in a backing store which is not
recorded as the backing store of @src. Export backingStore as variable
and fix all callers to pass in the backing store. No semantic changes
for now.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/qemu/qemu_command.c | 12 +++++++++---
src/qemu/qemu_command.h | 1 +
src/qemu/qemu_driver.c | 1 +
3 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index fa8bf39359..9cd46e8ea7 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -10723,11 +10723,12 @@
qemuBuildStorageSourceChainAttachPrepareDrive(virDomainDiskDefPtr disk,
static int
qemuBuildStorageSourceChainAttachPrepareBlockdevOne(qemuBlockStorageSourceChainData
*data,
virStorageSourcePtr src,
+ virStorageSourcePtr backingStore,
virQEMUCapsPtr qemuCaps)
{
VIR_AUTOPTR(qemuBlockStorageSourceAttachData) elem = NULL;
- if (!(elem = qemuBlockStorageSourceAttachPrepareBlockdev(src, src->backingStore,
true)))
+ if (!(elem = qemuBlockStorageSourceAttachPrepareBlockdev(src, backingStore, true)))
return -1;
if (qemuBuildStorageSourceAttachPrepareCommon(src, elem, qemuCaps) < 0)
@@ -10759,7 +10760,9 @@
qemuBuildStorageSourceChainAttachPrepareBlockdev(virStorageSourcePtr top,
return NULL;
for (n = top; virStorageSourceIsBacking(n); n = n->backingStore) {
- if (qemuBuildStorageSourceChainAttachPrepareBlockdevOne(data, n, qemuCaps) <
0)
+ if (qemuBuildStorageSourceChainAttachPrepareBlockdevOne(data, n,
+ n->backingStore,
+ qemuCaps) < 0)
return NULL;
}
@@ -10770,6 +10773,7 @@
qemuBuildStorageSourceChainAttachPrepareBlockdev(virStorageSourcePtr top,
/**
* qemuBuildStorageSourceChainAttachPrepareBlockdevTop:
* @top: storage source chain
+ * @backingStore: a storage source to use as backing of @top
* @qemuCaps: qemu capabilities object
*
* Prepares qemuBlockStorageSourceChainDataPtr for attaching of @top image only
@@ -10777,6 +10781,7 @@
qemuBuildStorageSourceChainAttachPrepareBlockdev(virStorageSourcePtr top,
*/
qemuBlockStorageSourceChainDataPtr
qemuBuildStorageSourceChainAttachPrepareBlockdevTop(virStorageSourcePtr top,
+ virStorageSourcePtr backingStore,
virQEMUCapsPtr qemuCaps)
{
VIR_AUTOPTR(qemuBlockStorageSourceChainData) data = NULL;
@@ -10784,7 +10789,8 @@
qemuBuildStorageSourceChainAttachPrepareBlockdevTop(virStorageSourcePtr top,
if (VIR_ALLOC(data) < 0)
return NULL;
- if (qemuBuildStorageSourceChainAttachPrepareBlockdevOne(data, top, qemuCaps) < 0)
+ if (qemuBuildStorageSourceChainAttachPrepareBlockdevOne(data, top, backingStore,
+ qemuCaps) < 0)
return NULL;
VIR_RETURN_PTR(data);
diff --git a/src/qemu/qemu_command.h b/src/qemu/qemu_command.h
index 6f97e7bc0c..60f9843b03 100644
--- a/src/qemu/qemu_command.h
+++ b/src/qemu/qemu_command.h
@@ -119,6 +119,7 @@ qemuBuildStorageSourceChainAttachPrepareBlockdev(virStorageSourcePtr
top,
qemuBlockStorageSourceChainDataPtr
qemuBuildStorageSourceChainAttachPrepareBlockdevTop(virStorageSourcePtr top,
+ virStorageSourcePtr backingStore,
virQEMUCapsPtr qemuCaps);
char
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 78f5471b79..df677d8f4c 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -18547,6 +18547,7 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm,
}
if (!(crdata = qemuBuildStorageSourceChainAttachPrepareBlockdevTop(mirror,
+
mirror->backingStore,
priv->qemuCaps)))
goto endjob;
}
--
2.21.0