Early errors during start of libvirtd didn't have
an error reporting mechanism and caused libvirtd
to exit silently (only the return value indicated
an error).
Libvirt logging is initialized very early using
enviroment variables and the internal error reporting
API is used to report early errors.
v2 changes:
- print errors unconditionaly before logging starts
- fix message to US spelling
v2.5 changes:
- initialize logging from enviroment
- log all early errors using VIR_ERROR
fixes:
https://bugzilla.redhat.com/show_bug.cgi?id=728654
---
daemon/libvirtd.c | 41 ++++++++++++++++++++++++++++++-----------
1 files changed, 30 insertions(+), 11 deletions(-)
diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c
index 53f1002..aa69f80 100644
--- a/daemon/libvirtd.c
+++ b/daemon/libvirtd.c
@@ -1285,11 +1285,14 @@ int main(int argc, char **argv) {
{0, 0, 0, 0}
};
+ /* initialize early logging */
+ virLogSetFromEnv();
+
if (setlocale (LC_ALL, "") == NULL ||
bindtextdomain (PACKAGE, LOCALEDIR) == NULL ||
textdomain(PACKAGE) == NULL ||
virInitialize() < 0) {
- fprintf(stderr, _("%s: initialization failed\n"), argv[0]);
+ VIR_ERROR(_("%s: initialization failed"), argv[0]);
exit(EXIT_FAILURE);
}
Ok, not quiet that early. virInitialize() must be the first libvirt
call made since it initializes threading which is needed by logging.
Daniel
--
|: