提交 4a8d1f7d 编写于 作者: P Peter Krempa

qemu: domain: Add helper to initialize detected parts of the backing chain

It will be necessary to initialize various aspects for the detected
members of the backing chain. Add a function that will handle it and
call it from qemuDomainPrepareDiskSource and qemuDomainDetermineDiskChain
Signed-off-by: NPeter Krempa <pkrempa@redhat.com>
上级 8fc5e5bf
......@@ -7399,6 +7399,7 @@ qemuDomainDetermineDiskChain(virQEMUDriverPtr driver,
{
virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
virStorageSourcePtr src = disk->src;
qemuDomainObjPrivatePtr priv = vm->privateData;
int ret = -1;
uid_t uid;
gid_t gid;
......@@ -7467,6 +7468,10 @@ qemuDomainDetermineDiskChain(virQEMUDriverPtr driver,
report_broken) < 0)
goto cleanup;
/* fill in data for the rest of the chain */
if (qemuDomainPrepareDiskSourceChain(disk, src, cfg, priv->qemuCaps) < 0)
goto cleanup;
ret = 0;
cleanup:
......@@ -11803,6 +11808,41 @@ qemuDomainCheckMigrationCapabilities(virQEMUDriverPtr driver,
}
/**
* qemuDomainPrepareDiskSourceChain:
*
* @disk: Disk config object
* @src: source to start from
* @cfg: qemu driver config object
*
* Prepares various aspects of the disk source and it's backing chain. This
* function should be also called for detected backing chains. If @src is NULL
* the root source is used.
*/
int
qemuDomainPrepareDiskSourceChain(virDomainDiskDefPtr disk,
virStorageSourcePtr src,
virQEMUDriverConfigPtr cfg,
virQEMUCapsPtr qemuCaps)
{
virStorageSourcePtr n;
if (!src)
src = disk->src;
for (n = src; virStorageSourceIsBacking(n); n = n->backingStore) {
if (n->type == VIR_STORAGE_TYPE_NETWORK &&
n->protocol == VIR_STORAGE_NET_PROTOCOL_GLUSTER &&
virQEMUCapsGet(qemuCaps, QEMU_CAPS_GLUSTER_DEBUG_LEVEL)) {
n->debug = true;
n->debugLevel = cfg->glusterDebugLevel;
}
}
return 0;
}
int
qemuDomainPrepareDiskSource(virDomainDiskDefPtr disk,
qemuDomainObjPrivatePtr priv,
......@@ -11814,12 +11854,8 @@ qemuDomainPrepareDiskSource(virDomainDiskDefPtr disk,
if (qemuDomainSecretDiskPrepare(priv, disk) < 0)
return -1;
if (disk->src->type == VIR_STORAGE_TYPE_NETWORK &&
disk->src->protocol == VIR_STORAGE_NET_PROTOCOL_GLUSTER &&
virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_GLUSTER_DEBUG_LEVEL)) {
disk->src->debug = true;
disk->src->debugLevel = cfg->glusterDebugLevel;
}
if (qemuDomainPrepareDiskSourceChain(disk, NULL, cfg, priv->qemuCaps) < 0)
return -1;
return 0;
}
......
......@@ -991,6 +991,12 @@ int
qemuDomainCheckMigrationCapabilities(virQEMUDriverPtr driver,
virDomainObjPtr vm,
qemuDomainAsyncJob asyncJob);
int
qemuDomainPrepareDiskSourceChain(virDomainDiskDefPtr disk,
virStorageSourcePtr src,
virQEMUDriverConfigPtr cfg,
virQEMUCapsPtr qemuCaps)
ATTRIBUTE_RETURN_CHECK;
int
qemuDomainPrepareDiskSource(virDomainDiskDefPtr disk,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册