Remove the call to the validating function from the function which sets stuff up. Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx> --- src/qemu/qemu_domain.c | 11 +++++++---- src/qemu/qemu_domain.h | 6 ++++++ tests/qemublocktest.c | 3 +++ 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index d327440ec4..f616641c26 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -4477,7 +4477,7 @@ qemuDomainDeviceDefValidateVideo(const virDomainVideoDef *video) } -static int +int qemuDomainValidateStorageSource(virStorageSourcePtr src, virQEMUCapsPtr qemuCaps) { @@ -8101,6 +8101,9 @@ qemuDomainDetermineDiskChain(virQEMUDriverPtr driver, goto cleanup; for (n = src; virStorageSourceIsBacking(n); n = n->backingStore) { + if (qemuDomainValidateStorageSource(n, priv->qemuCaps) < 0) + goto cleanup; + if (qemuDomainPrepareDiskSourceData(disk, n, cfg, priv->qemuCaps) < 0) goto cleanup; } @@ -12412,9 +12415,6 @@ qemuDomainPrepareDiskSourceData(virDomainDiskDefPtr disk, src->debugLevel = cfg->glusterDebugLevel; } - if (qemuDomainValidateStorageSource(src, qemuCaps) < 0) - return -1; - /* transfer properties valid for the full chain */ src->iomode = disk->iomode; src->cachemode = disk->cachemode; @@ -12465,6 +12465,9 @@ qemuDomainPrepareDiskSource(virDomainDiskDefPtr disk, { qemuDomainPrepareDiskCachemode(disk); + if (qemuDomainValidateStorageSource(disk->src, priv->qemuCaps) < 0) + return -1; + if (qemuDomainPrepareDiskSourceTLS(disk->src, cfg) < 0) return -1; diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index 36b000be60..f17157b951 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -1009,6 +1009,12 @@ qemuDomainPrepareDiskSourceData(virDomainDiskDefPtr disk, virQEMUCapsPtr qemuCaps) ATTRIBUTE_RETURN_CHECK; + +int +qemuDomainValidateStorageSource(virStorageSourcePtr src, + virQEMUCapsPtr qemuCaps); + + int qemuDomainPrepareDiskSource(virDomainDiskDefPtr disk, qemuDomainObjPrivatePtr priv, diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c index 7f39f61018..ec882b43e1 100644 --- a/tests/qemublocktest.c +++ b/tests/qemublocktest.c @@ -219,6 +219,9 @@ testQemuDiskXMLToProps(const void *opaque) if (testQemuDiskXMLToJSONFakeSecrets(n) < 0) goto cleanup; + if (qemuDomainValidateStorageSource(n, data->qemuCaps) < 0) + goto cleanup; + if (qemuDomainPrepareDiskSourceData(disk, n, NULL, data->qemuCaps) < 0) goto cleanup; -- 2.16.2 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list