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 | 4 ++++
 src/security/virt-aa-helper.c    | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/src/security/security_apparmor.c b/src/security/security_apparmor.c
index 4134a17..16b8f87 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 9e18343..3d57431 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"
@@ -1266,6 +1267,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)
-- 
2.1.4

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to