Unless overridden, libdevmapper logs all messages to stderr. Therefore if something goes wrong in storage_backend_mpath.c or parthelper.c we don't honour user set logging targets. Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx> --- src/util/virlog.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/util/virlog.c b/src/util/virlog.c index dd927f0ba7..51f2d341db 100644 --- a/src/util/virlog.c +++ b/src/util/virlog.c @@ -40,6 +40,9 @@ #if HAVE_SYS_UN_H # include <sys/un.h> #endif +#if WITH_DEVMAPPER +# include <libdevmapper.h> +#endif #include "virerror.h" #include "virlog.h" @@ -258,6 +261,20 @@ virLogPriorityString(virLogPriority lvl) } +#ifdef WITH_DEVMAPPER +static void +virLogDM(int level ATTRIBUTE_UNUSED, + const char *file ATTRIBUTE_UNUSED, + int line ATTRIBUTE_UNUSED, + int dm_errno ATTRIBUTE_UNUSED, + const char *fmt ATTRIBUTE_UNUSED, + ...) +{ + return; +} +#endif + + static int virLogOnceInit(void) { @@ -289,6 +306,12 @@ virLogOnceInit(void) NUL_TERMINATE(virLogHostname); } +#ifdef WITH_DEVMAPPER + /* Ideally, we would not need this. But libdevmapper prints + * error messages to stderr by default. Sad but true. */ + dm_log_with_errno_init(virLogDM); +#endif + virLogUnlock(); return 0; } -- 2.16.1 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list