[PATCH v10 1/4] qemu: Introduce qemuDomainSupportTLSChardevTCP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



It's very simple right now, but it's about to get a bit more complicated.

Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx>
---
 src/qemu/qemu_command.c |  2 +-
 src/qemu/qemu_domain.c  | 16 ++++++++++++++++
 src/qemu/qemu_domain.h  |  1 +
 src/qemu/qemu_hotplug.c |  4 ++--
 4 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 8282162..d45a7de 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -4943,7 +4943,7 @@ qemuBuildChrChardevStr(virLogManagerPtr logManager,
         if (dev->data.tcp.listen)
             virBufferAdd(&buf, nowait ? ",server,nowait" : ",server", -1);
 
-        if (cfg->chardevTLS) {
+        if (qemuDomainSupportTLSChardevTCP(cfg)) {
             char *objalias = NULL;
 
             if (qemuBuildTLSx509CommandLine(cmd, cfg->chardevTLSx509certdir,
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 4c118ff..746d94f 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -6298,3 +6298,19 @@ qemuDomainSupportsVideoVga(virDomainVideoDefPtr video,
 
     return true;
 }
+
+
+/* qemuDomainSupportTLSChardevTCP
+ * @cfg: Pointer to driver cfg
+ *
+ * Let's check if this host supports using the TLS environment for chardev.
+ *
+ * Returns true if we want to use TLS, false otherwise.
+ */
+bool
+qemuDomainSupportTLSChardevTCP(virQEMUDriverConfigPtr cfg)
+{
+    if (cfg->chardevTLS)
+        return true;
+    return false;
+}
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index 707a995..7ecafac 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -755,4 +755,5 @@ int qemuDomainCheckMonitor(virQEMUDriverPtr driver,
 bool qemuDomainSupportsVideoVga(virDomainVideoDefPtr video,
                                 virQEMUCapsPtr qemuCaps);
 
+bool qemuDomainSupportTLSChardevTCP(virQEMUDriverConfigPtr cfg);
 #endif /* __QEMU_DOMAIN_H__ */
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 2cb2267..c2b43b1 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -1730,7 +1730,7 @@ int qemuDomainAttachChrDevice(virQEMUDriverPtr driver,
         goto cleanup;
 
     if (dev->type == VIR_DOMAIN_CHR_TYPE_TCP &&
-        cfg->chardevTLS) {
+        qemuDomainSupportTLSChardevTCP(cfg)) {
         if (qemuBuildTLSx509BackendProps(cfg->chardevTLSx509certdir,
                                          dev->data.tcp.listen,
                                          cfg->chardevTLSx509verify,
@@ -4404,7 +4404,7 @@ int qemuDomainDetachChrDevice(virQEMUDriverPtr driver,
         goto cleanup;
 
     if (tmpChr->source.type == VIR_DOMAIN_CHR_TYPE_TCP &&
-        cfg->chardevTLS &&
+        qemuDomainSupportTLSChardevTCP(cfg) &&
         !(objAlias = qemuAliasTLSObjFromChardevAlias(charAlias)))
         goto cleanup;
 
-- 
2.7.4

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]