提交 2e22a561 编写于 作者: P Peter Krempa

qemu: domain: aggregate setup of disk drive options for -drive

When using blockdev the approach to base aliases will change. Add a
helper function that will aggregate all code which needs to be called
with the disk alias for the -drive to setup internal data.

qemuDomainSecretDiskPrepare wrapper is no longer necessary as the
contents were moved to a function which is designed to use the old
aliases.
Signed-off-by: NPeter Krempa <pkrempa@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
上级 88860bb9
...@@ -1555,25 +1555,6 @@ qemuDomainSecretStorageSourcePrepare(qemuDomainObjPrivatePtr priv, ...@@ -1555,25 +1555,6 @@ qemuDomainSecretStorageSourcePrepare(qemuDomainObjPrivatePtr priv,
} }
/* qemuDomainSecretDiskPrepare:
* @priv: pointer to domain private object
* @disk: Pointer to a disk definition
*
* For the right disk, generate the qemuDomainSecretInfo structure.
*
* Returns 0 on success, -1 on failure
*/
static int
qemuDomainSecretDiskPrepare(qemuDomainObjPrivatePtr priv,
virDomainDiskDefPtr disk)
{
return qemuDomainSecretStorageSourcePrepare(priv, disk->src,
disk->info.alias,
disk->info.alias);
}
/* qemuDomainSecretHostdevDestroy: /* qemuDomainSecretHostdevDestroy:
* @disk: Pointer to a hostdev definition * @disk: Pointer to a hostdev definition
* *
...@@ -12475,26 +12456,48 @@ qemuDomainPrepareStorageSourcePR(virStorageSourcePtr src, ...@@ -12475,26 +12456,48 @@ qemuDomainPrepareStorageSourcePR(virStorageSourcePtr src,
} }
int /**
qemuDomainPrepareDiskSource(virDomainDiskDefPtr disk, * qemuDomainPrepareDiskSourceLegacy:
qemuDomainObjPrivatePtr priv, * @disk: disk to prepare
virQEMUDriverConfigPtr cfg) * @priv: VM private data
* @cfg: qemu driver config
*
* Prepare any disk source relevant data for use with the -drive command line.
*/
static int
qemuDomainPrepareDiskSourceLegacy(virDomainDiskDefPtr disk,
qemuDomainObjPrivatePtr priv,
virQEMUDriverConfigPtr cfg)
{ {
qemuDomainPrepareDiskCachemode(disk);
if (qemuDomainValidateStorageSource(disk->src, priv->qemuCaps) < 0) if (qemuDomainValidateStorageSource(disk->src, priv->qemuCaps) < 0)
return -1; return -1;
if (qemuDomainPrepareDiskSourceTLS(disk->src, cfg) < 0) if (qemuDomainPrepareDiskSourceData(disk, disk->src, cfg, priv->qemuCaps) < 0)
return -1; return -1;
if (qemuDomainSecretDiskPrepare(priv, disk) < 0) if (qemuDomainSecretStorageSourcePrepare(priv, disk->src,
disk->info.alias,
disk->info.alias) < 0)
return -1; return -1;
if (qemuDomainPrepareDiskSourceData(disk, disk->src, cfg, priv->qemuCaps) < 0) if (qemuDomainPrepareStorageSourcePR(disk->src, priv, disk->info.alias) < 0)
return -1; return -1;
if (qemuDomainPrepareStorageSourcePR(disk->src, priv, disk->info.alias) < 0) return 0;
}
int
qemuDomainPrepareDiskSource(virDomainDiskDefPtr disk,
qemuDomainObjPrivatePtr priv,
virQEMUDriverConfigPtr cfg)
{
qemuDomainPrepareDiskCachemode(disk);
if (qemuDomainPrepareDiskSourceLegacy(disk, priv, cfg) < 0)
return -1;
if (qemuDomainPrepareDiskSourceTLS(disk->src, cfg) < 0)
return -1; return -1;
return 0; return 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册