[PATCH v2 2/4] Get more libvirt errors from virt-aa-helper

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]