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

[libvirt] [PATCH 21/23] qemu_conf: split out virQEMUDriverConfigLoadDefaultTLSEntry



Split out parts of the config parsing code to make
the parent function easier to read.

Signed-off-by: Ján Tomko <jtomko redhat com>
---
 src/qemu/qemu_conf.c | 28 ++++++++++++++++++++--------
 1 file changed, 20 insertions(+), 8 deletions(-)

diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index 7eecb3ef91..0877a5b7c1 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -423,6 +423,24 @@ virQEMUDriverConfigHugeTLBFSInit(virHugeTLBFSPtr hugetlbfs,
 }
 
 
+static int
+virQEMUDriverConfigLoadDefaultTLSEntry(virQEMUDriverConfigPtr cfg,
+                                       virConfPtr conf)
+{
+    int rv;
+
+    if ((rv = virConfGetValueString(conf, "default_tls_x509_cert_dir", &cfg->defaultTLSx509certdir)) < 0)
+        return -1;
+    cfg->checkdefaultTLSx509certdir = (rv == 1);
+    if (virConfGetValueBool(conf, "default_tls_x509_verify", &cfg->defaultTLSx509verify) < 0)
+        return -1;
+    if (virConfGetValueString(conf, "default_tls_x509_secret_uuid",
+                              &cfg->defaultTLSx509secretUUID) < 0)
+        return -1;
+
+    return 0;
+}
+
 static int
 virQEMUDriverConfigLoadVNCEntry(virQEMUDriverConfigPtr cfg,
                                 virConfPtr conf)
@@ -485,6 +503,7 @@ virQEMUDriverConfigLoadSPICEEntry(virQEMUDriverConfigPtr cfg,
     return 0;
 }
 
+
 static int
 virQEMUDriverConfigLoadSpecificTLSEntry(virQEMUDriverConfigPtr cfg,
                                         virConfPtr conf)
@@ -1003,7 +1022,6 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr cfg,
 {
     virConfPtr conf = NULL;
     int ret = -1;
-    int rv;
     char **hugetlbfs = NULL;
     char *corestr = NULL;
 
@@ -1018,13 +1036,7 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr cfg,
     if (!(conf = virConfReadFile(filename, 0)))
         goto cleanup;
 
-    if ((rv = virConfGetValueString(conf, "default_tls_x509_cert_dir", &cfg->defaultTLSx509certdir)) < 0)
-        goto cleanup;
-    cfg->checkdefaultTLSx509certdir = (rv == 1);
-    if (virConfGetValueBool(conf, "default_tls_x509_verify", &cfg->defaultTLSx509verify) < 0)
-        goto cleanup;
-    if (virConfGetValueString(conf, "default_tls_x509_secret_uuid",
-                              &cfg->defaultTLSx509secretUUID) < 0)
+    if (virQEMUDriverConfigLoadDefaultTLSEntry(cfg, conf) < 0)
         goto cleanup;
 
     if (virQEMUDriverConfigLoadVNCEntry(cfg, conf) < 0)
-- 
2.20.1


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