On Thu, Sep 14, 2017 at 08:51:54 -0400, John Ferlan wrote:
Introduce a function to setup any TLS needs for a disk source.
If there's a configuration or other error setting up the disk source
for TLS, then cause the domain startup to fail.
For VxHS, follow the chardevTLS model where if the src->haveTLS hasn't
been configured, then take the system/global cfg->haveTLS setting for
the storage source *and* mark that we've done so via the tlsFromConfig
setting in storage source.
Next, if we are using TLS, then generate an alias into a virStorageSource
'tlsAlias' field that will be used to create the TLS object and added to
the disk object in order to link the two together for QEMU.
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
src/qemu/qemu_domain.c | 71 +++++++++++++++++++++++++++++++++++++++++++++++
src/qemu/qemu_domain.h | 11 ++++++++
src/qemu/qemu_process.c | 4 +++
src/util/virstoragefile.c | 5 +++-
src/util/virstoragefile.h | 6 ++++
5 files changed, 96 insertions(+), 1 deletion(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 05f8e9488..b93b7de63 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
[...]
+
+/* qemuProcessPrepareDiskSource:
+ * @def: live domain definition
+ * @driver: qemu driver
+ *
+ * Iterate through all disk devices to setup/check any that would be
+ * using TLS.
Don't add this here. This function is generic.
+ *
+ * Returns 0 on success, -1 on failure
+ */
+int
+qemuDomainPrepareDiskSource(virDomainDefPtr def,
+ virQEMUDriverConfigPtr cfg)
+{
+ size_t i;
+
+ for (i = 0; i < def->ndisks; i++) {
+ if (qemuDomainPrepareDiskSourceTLS(def->disks[i]->src,
+ def->disks[i]->info.alias,
+ cfg) < 0)
+ return -1;
+ }
+
+ return 0;
+}
+
int
qemuDomainPrepareShmemChardev(virDomainShmemDefPtr shmem)
ACK