]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu_conf: split out virQEMUDriverConfigLoadSaveEntry
authorJán Tomko <jtomko@redhat.com>
Tue, 15 Jan 2019 11:24:02 +0000 (12:24 +0100)
committerJán Tomko <jtomko@redhat.com>
Fri, 18 Jan 2019 11:55:06 +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 00c3e5507eac7fc9e759945b29acd677ca65a819..61d6d619dc3f2bcfa12f5557bba2f8f3634d2618 100644 (file)
@@ -423,6 +423,27 @@ virQEMUDriverConfigHugeTLBFSInit(virHugeTLBFSPtr hugetlbfs,
 }
 
 
+static int
+virQEMUDriverConfigLoadSaveEntry(virQEMUDriverConfigPtr cfg,
+                                 virConfPtr conf)
+{
+    if (virConfGetValueString(conf, "save_image_format", &cfg->saveImageFormat) < 0)
+        return -1;
+    if (virConfGetValueString(conf, "dump_image_format", &cfg->dumpImageFormat) < 0)
+        return -1;
+    if (virConfGetValueString(conf, "snapshot_image_format", &cfg->snapshotImageFormat) < 0)
+        return -1;
+    if (virConfGetValueString(conf, "auto_dump_path", &cfg->autoDumpPath) < 0)
+        return -1;
+    if (virConfGetValueBool(conf, "auto_dump_bypass_cache", &cfg->autoDumpBypassCache) < 0)
+        return -1;
+    if (virConfGetValueBool(conf, "auto_start_bypass_cache", &cfg->autoStartBypassCache) < 0)
+        return -1;
+
+    return 0;
+}
+
+
 static int
 virQEMUDriverConfigLoadProcessEntry(virQEMUDriverConfigPtr cfg,
                                     virConfPtr conf)
@@ -969,19 +990,7 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr cfg,
         goto cleanup;
     }
 
-
-    if (virConfGetValueString(conf, "save_image_format", &cfg->saveImageFormat) < 0)
-        goto cleanup;
-    if (virConfGetValueString(conf, "dump_image_format", &cfg->dumpImageFormat) < 0)
-        goto cleanup;
-    if (virConfGetValueString(conf, "snapshot_image_format", &cfg->snapshotImageFormat) < 0)
-        goto cleanup;
-
-    if (virConfGetValueString(conf, "auto_dump_path", &cfg->autoDumpPath) < 0)
-        goto cleanup;
-    if (virConfGetValueBool(conf, "auto_dump_bypass_cache", &cfg->autoDumpBypassCache) < 0)
-        goto cleanup;
-    if (virConfGetValueBool(conf, "auto_start_bypass_cache", &cfg->autoStartBypassCache) < 0)
+    if (virQEMUDriverConfigLoadSaveEntry(cfg, conf) < 0)
         goto cleanup;
 
     if (virQEMUDriverConfigLoadProcessEntry(cfg, conf) < 0)