[libvirt] [PATCH v2.5] daemon: Add early libvirtd start verbose errors.
Daniel P. Berrange
berrange at redhat.com
Fri Aug 12 10:09:18 UTC 2011
On Fri, Aug 12, 2011 at 11:54:39AM +0200, Peter Krempa wrote:
> 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
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
More information about the libvir-list
mailing list