]> xenbits.xensource.com Git - libvirt.git/commitdiff
Get more libvirt errors from virt-aa-helper
authorCédric Bosdonnat <cbosdonnat@suse.com>
Thu, 25 Jun 2015 08:36:52 +0000 (10:36 +0200)
committerCédric Bosdonnat <cbosdonnat@suse.com>
Fri, 10 Jul 2015 09:30:36 +0000 (11:30 +0200)
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

src/security/security_apparmor.c
src/security/virt-aa-helper.c

index 4134a173aed1bc6cf9ddab007f752ad95062927b..16b8f879d095899493e4f80dafd87c8215d47eb3 100644 (file)
@@ -196,6 +196,10 @@ load_profile(virSecurityManagerPtr mgr,
         }
     }
 
+    virCommandAddEnvFormat(cmd,
+                           "LIBVIRT_LOG_OUTPUTS=%d:stderr",
+                           virLogGetDefaultPriority());
+
     virCommandSetInputBuffer(cmd, xml);
     rc = virCommandRun(cmd, NULL);
 
index 18454c8525c3c7c0be07e2560656b3f6388376ce..f8a9cf22526cce7e5b2e19b99217febafc98fb50 100644 (file)
@@ -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)