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: Peter Krempa <pkrempa(a)redhat.com>
---
src/qemu/qemu_domain.c | 61 ++++++++++++++++++++++++++------------------------
1 file changed, 32 insertions(+), 29 deletions(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index f616641c26..15c2e28604 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -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:
* @disk: Pointer to a hostdev definition
*
@@ -12458,26 +12439,48 @@ qemuDomainPrepareStorageSourcePR(virStorageSourcePtr src,
}
-int
-qemuDomainPrepareDiskSource(virDomainDiskDefPtr disk,
- qemuDomainObjPrivatePtr priv,
- virQEMUDriverConfigPtr cfg)
+/**
+ * qemuDomainPrepareDiskSourceLegacy:
+ * @disk: disk to prepare
+ * @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)
return -1;
- if (qemuDomainPrepareDiskSourceTLS(disk->src, cfg) < 0)
+ if (qemuDomainPrepareDiskSourceData(disk, disk->src, cfg, priv->qemuCaps) <
0)
return -1;
- if (qemuDomainSecretDiskPrepare(priv, disk) < 0)
+ if (qemuDomainSecretStorageSourcePrepare(priv, disk->src,
+ disk->info.alias,
+ disk->info.alias) < 0)
return -1;
- if (qemuDomainPrepareDiskSourceData(disk, disk->src, cfg, priv->qemuCaps) <
0)
+ if (qemuDomainPrepareStorageSourcePR(disk->src, priv, disk->info.alias) <
0)
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 0;
--
2.16.2