qemu: block: explicitly pass backing store to qemuBlockStorageSourceAttachPrepareBlockdev

Pass backing store as an argument rather than extracting it locally and
fix the callers.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2019-09-03 13:58:34 +02:00
parent eee85c2349
commit 7b47a8f814
4 changed files with 8 additions and 3 deletions

View File

@ -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)))

View File

@ -109,6 +109,7 @@ VIR_DEFINE_AUTOPTR_FUNC(qemuBlockStorageSourceAttachData,
qemuBlockStorageSourceAttachDataPtr
qemuBlockStorageSourceAttachPrepareBlockdev(virStorageSourcePtr src,
virStorageSourcePtr backingStore,
bool autoreadonly);
qemuBlockStorageSourceAttachDataPtr

View File

@ -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)

View File

@ -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,