From: Cédric Bosdonnat Date: Thu, 25 Jun 2015 08:36:52 +0000 (+0200) Subject: Get more libvirt errors from virt-aa-helper X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=a55a5e7cfed57223820478da89422756121fb37c;p=people%2Fliuw%2Flibxenctrl-split%2Flibvirt.git Get more libvirt errors from virt-aa-helper Initializing libvirt log in virt-aa-helper and getting it to output libvirt log to stderr. This will help debugging problems happening in libvirt functions called from within virt-aa-helper --- diff --git a/src/security/security_apparmor.c b/src/security/security_apparmor.c index 4134a173a..16b8f879d 100644 --- a/src/security/security_apparmor.c +++ b/src/security/security_apparmor.c @@ -196,6 +196,10 @@ load_profile(virSecurityManagerPtr mgr, } } + virCommandAddEnvFormat(cmd, + "LIBVIRT_LOG_OUTPUTS=%d:stderr", + virLogGetDefaultPriority()); + virCommandSetInputBuffer(cmd, xml); rc = virCommandRun(cmd, NULL); diff --git a/src/security/virt-aa-helper.c b/src/security/virt-aa-helper.c index 18454c852..f8a9cf225 100644 --- a/src/security/virt-aa-helper.c +++ b/src/security/virt-aa-helper.c @@ -41,6 +41,7 @@ #include "virbuffer.h" #include "viralloc.h" #include "vircommand.h" +#include "virlog.h" #include "security_driver.h" #include "security_apparmor.h" @@ -1272,6 +1273,9 @@ main(int argc, char **argv) exit(EXIT_FAILURE); } + /* Initialize the log system */ + virLogSetFromEnv(); + /* clear the environment */ environ = NULL; if (setenv("PATH", "/sbin:/usr/sbin", 1) != 0)