提交 88860bb9 编写于 作者: P Peter Krempa

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: NPeter Krempa <pkrempa@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
上级 9b6a636d
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册