[libvirt] [PATCH] qemu: conf: Run through the parser even without config file

Peter Krempa pkrempa at redhat.com
Wed Apr 27 13:39:59 UTC 2016


The parser sets a few defaults if the are not present in the config. We
should run that even when the file is missing.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1325075
---
 src/qemu/qemu_conf.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index 77ef4fe..0bd9f06 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -477,12 +477,11 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr cfg,
      */
     if (access(filename, R_OK) == -1) {
         VIR_INFO("Could not read qemu config file %s", filename);
-        return 0;
+    } else {
+        if (!(conf = virConfReadFile(filename, 0)))
+            goto cleanup;
     }

-    if (!(conf = virConfReadFile(filename, 0)))
-        goto cleanup;
-
 #define CHECK_TYPE(name, typ)                         \
     if (p && p->type != (typ)) {                      \
         virReportError(VIR_ERR_INTERNAL_ERROR,        \
-- 
2.8.1




More information about the libvir-list mailing list