mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-21 20:15:17 +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,
|
||||
virQEMUCapsPtr qemuCaps)
|
||||
{
|
||||
@ -8118,6 +8118,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;
|
||||
}
|
||||
@ -12429,9 +12432,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;
|
||||
@ -12482,6 +12482,9 @@ qemuDomainPrepareDiskSource(virDomainDiskDefPtr disk,
|
||||
{
|
||||
qemuDomainPrepareDiskCachemode(disk);
|
||||
|
||||
if (qemuDomainValidateStorageSource(disk->src, priv->qemuCaps) < 0)
|
||||
return -1;
|
||||
|
||||
if (qemuDomainPrepareDiskSourceTLS(disk->src, cfg) < 0)
|
||||
return -1;
|
||||
|
||||
|
@ -1009,6 +1009,12 @@ qemuDomainPrepareDiskSourceData(virDomainDiskDefPtr disk,
|
||||
virQEMUCapsPtr qemuCaps)
|
||||
ATTRIBUTE_RETURN_CHECK;
|
||||
|
||||
|
||||
int
|
||||
qemuDomainValidateStorageSource(virStorageSourcePtr src,
|
||||
virQEMUCapsPtr qemuCaps);
|
||||
|
||||
|
||||
int
|
||||
qemuDomainPrepareDiskSource(virDomainDiskDefPtr disk,
|
||||
qemuDomainObjPrivatePtr priv,
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user