]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: Improve some qemu.conf error reporting
authorCole Robinson <crobinso@redhat.com>
Wed, 30 Jun 2010 18:14:37 +0000 (14:14 -0400)
committerCole Robinson <crobinso@redhat.com>
Fri, 2 Jul 2010 14:29:56 +0000 (10:29 -0400)
Log some info if we can't find a config file. Make parse failures
fatal, and actually raise an error message.

src/qemu/qemu_conf.c

index ce42bd6043433c0180a60e724ad95509b29ee252..988220b15233e0b96ac51b567a25d871b872b64c 100644 (file)
@@ -133,16 +133,21 @@ int qemudLoadDriverConfig(struct qemud_driver *driver,
     /* Just check the file is readable before opening it, otherwise
      * libvirt emits an error.
      */
-    if (access (filename, R_OK) == -1) return 0;
+    if (access (filename, R_OK) == -1) {
+        VIR_INFO("Could not read qemu config file %s", filename);
+        return 0;
+    }
 
     conf = virConfReadFile (filename, 0);
-    if (!conf) return 0;
+    if (!conf) {
+        return -1;
+    }
 
 
 #define CHECK_TYPE(name,typ) if (p && p->type != (typ)) {               \
         qemuReportError(VIR_ERR_INTERNAL_ERROR,                         \
-                         "remoteReadConfigFile: %s: %s: expected type " #typ, \
-                         filename, (name));                             \
+                        "%s: %s: expected type " #typ,                  \
+                        filename, (name));                              \
         virConfFree(conf);                                              \
         return -1;                                                      \
     }