mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 04:25:18 +00:00
qemu: domain: Split validation and setup of the virStorageSource
Remove the call to the validating function from the function which sets stuff up. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
9b6a636d49
commit
88860bb9d9
@ -4476,7 +4476,7 @@ qemuDomainDeviceDefValidateVideo(const virDomainVideoDef *video)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
int
|
||||||
qemuDomainValidateStorageSource(virStorageSourcePtr src,
|
qemuDomainValidateStorageSource(virStorageSourcePtr src,
|
||||||
virQEMUCapsPtr qemuCaps)
|
virQEMUCapsPtr qemuCaps)
|
||||||
{
|
{
|
||||||
@ -8118,6 +8118,9 @@ qemuDomainDetermineDiskChain(virQEMUDriverPtr driver,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
for (n = src; virStorageSourceIsBacking(n); n = n->backingStore) {
|
for (n = src; virStorageSourceIsBacking(n); n = n->backingStore) {
|
||||||
|
if (qemuDomainValidateStorageSource(n, priv->qemuCaps) < 0)
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
if (qemuDomainPrepareDiskSourceData(disk, n, cfg, priv->qemuCaps) < 0)
|
if (qemuDomainPrepareDiskSourceData(disk, n, cfg, priv->qemuCaps) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
@ -12429,9 +12432,6 @@ qemuDomainPrepareDiskSourceData(virDomainDiskDefPtr disk,
|
|||||||
src->debugLevel = cfg->glusterDebugLevel;
|
src->debugLevel = cfg->glusterDebugLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (qemuDomainValidateStorageSource(src, qemuCaps) < 0)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
/* transfer properties valid for the full chain */
|
/* transfer properties valid for the full chain */
|
||||||
src->iomode = disk->iomode;
|
src->iomode = disk->iomode;
|
||||||
src->cachemode = disk->cachemode;
|
src->cachemode = disk->cachemode;
|
||||||
@ -12482,6 +12482,9 @@ qemuDomainPrepareDiskSource(virDomainDiskDefPtr disk,
|
|||||||
{
|
{
|
||||||
qemuDomainPrepareDiskCachemode(disk);
|
qemuDomainPrepareDiskCachemode(disk);
|
||||||
|
|
||||||
|
if (qemuDomainValidateStorageSource(disk->src, priv->qemuCaps) < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
if (qemuDomainPrepareDiskSourceTLS(disk->src, cfg) < 0)
|
if (qemuDomainPrepareDiskSourceTLS(disk->src, cfg) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
@ -1009,6 +1009,12 @@ qemuDomainPrepareDiskSourceData(virDomainDiskDefPtr disk,
|
|||||||
virQEMUCapsPtr qemuCaps)
|
virQEMUCapsPtr qemuCaps)
|
||||||
ATTRIBUTE_RETURN_CHECK;
|
ATTRIBUTE_RETURN_CHECK;
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
qemuDomainValidateStorageSource(virStorageSourcePtr src,
|
||||||
|
virQEMUCapsPtr qemuCaps);
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
qemuDomainPrepareDiskSource(virDomainDiskDefPtr disk,
|
qemuDomainPrepareDiskSource(virDomainDiskDefPtr disk,
|
||||||
qemuDomainObjPrivatePtr priv,
|
qemuDomainObjPrivatePtr priv,
|
||||||
|
@ -219,6 +219,9 @@ testQemuDiskXMLToProps(const void *opaque)
|
|||||||
if (testQemuDiskXMLToJSONFakeSecrets(n) < 0)
|
if (testQemuDiskXMLToJSONFakeSecrets(n) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
|
if (qemuDomainValidateStorageSource(n, data->qemuCaps) < 0)
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
if (qemuDomainPrepareDiskSourceData(disk, n, NULL, data->qemuCaps) < 0)
|
if (qemuDomainPrepareDiskSourceData(disk, n, NULL, data->qemuCaps) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user