]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu_conf: split out virQEMUDriverConfigLoadVNCEntry
authorJán Tomko <jtomko@redhat.com>
Mon, 14 Jan 2019 21:15:40 +0000 (22:15 +0100)
committerJán Tomko <jtomko@redhat.com>
Fri, 18 Jan 2019 11:55:07 +0000 (12:55 +0100)
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>
Reviewed-by: John Ferlan <jferlan@redhat.com>
src/qemu/qemu_conf.c

index 4d378d633fb7fa70d9f69408010d7e3965cea3dc..d7ba2aa1e8bb436a3a514d88cb26eb97d777e3f8 100644 (file)
@@ -423,6 +423,37 @@ virQEMUDriverConfigHugeTLBFSInit(virHugeTLBFSPtr hugetlbfs,
 }
 
 
+static int
+virQEMUDriverConfigLoadVNCEntry(virQEMUDriverConfigPtr cfg,
+                                virConfPtr conf)
+{
+    int rv;
+
+    if (virConfGetValueBool(conf, "vnc_auto_unix_socket", &cfg->vncAutoUnixSocket) < 0)
+        return -1;
+    if (virConfGetValueBool(conf, "vnc_tls", &cfg->vncTLS) < 0)
+        return -1;
+    if ((rv = virConfGetValueBool(conf, "vnc_tls_x509_verify", &cfg->vncTLSx509verify)) < 0)
+        return -1;
+    if (rv == 1)
+        cfg->vncTLSx509verifyPresent = true;
+    if (virConfGetValueString(conf, "vnc_tls_x509_cert_dir", &cfg->vncTLSx509certdir) < 0)
+        return -1;
+    if (virConfGetValueString(conf, "vnc_listen", &cfg->vncListen) < 0)
+        return -1;
+    if (virConfGetValueString(conf, "vnc_password", &cfg->vncPassword) < 0)
+        return -1;
+    if (virConfGetValueBool(conf, "vnc_sasl", &cfg->vncSASL) < 0)
+        return -1;
+    if (virConfGetValueString(conf, "vnc_sasl_dir", &cfg->vncSASLdir) < 0)
+        return -1;
+    if (virConfGetValueBool(conf, "vnc_allow_host_audio", &cfg->vncAllowHostAudio) < 0)
+        return -1;
+
+    return 0;
+}
+
+
 static int
 virQEMUDriverConfigLoadNographicsEntry(virQEMUDriverConfigPtr cfg,
                                        virConfPtr conf)
@@ -1001,25 +1032,7 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr cfg,
                               &cfg->defaultTLSx509secretUUID) < 0)
         goto cleanup;
 
-    if (virConfGetValueBool(conf, "vnc_auto_unix_socket", &cfg->vncAutoUnixSocket) < 0)
-        goto cleanup;
-    if (virConfGetValueBool(conf, "vnc_tls", &cfg->vncTLS) < 0)
-        goto cleanup;
-    if ((rv = virConfGetValueBool(conf, "vnc_tls_x509_verify", &cfg->vncTLSx509verify)) < 0)
-        goto cleanup;
-    if (rv == 1)
-        cfg->vncTLSx509verifyPresent = true;
-    if (virConfGetValueString(conf, "vnc_tls_x509_cert_dir", &cfg->vncTLSx509certdir) < 0)
-        goto cleanup;
-    if (virConfGetValueString(conf, "vnc_listen", &cfg->vncListen) < 0)
-        goto cleanup;
-    if (virConfGetValueString(conf, "vnc_password", &cfg->vncPassword) < 0)
-        goto cleanup;
-    if (virConfGetValueBool(conf, "vnc_sasl", &cfg->vncSASL) < 0)
-        goto cleanup;
-    if (virConfGetValueString(conf, "vnc_sasl_dir", &cfg->vncSASLdir) < 0)
-        goto cleanup;
-    if (virConfGetValueBool(conf, "vnc_allow_host_audio", &cfg->vncAllowHostAudio) < 0)
+    if (virQEMUDriverConfigLoadVNCEntry(cfg, conf) < 0)
         goto cleanup;
 
     if (virQEMUDriverConfigLoadNographicsEntry(cfg, conf) < 0)