54 lines
1.6 KiB
Diff
54 lines
1.6 KiB
Diff
|
From a55a5e7cfed57223820478da89422756121fb37c Mon Sep 17 00:00:00 2001
|
||
|
From: =?UTF-8?q?C=C3=A9dric=20Bosdonnat?= <cbosdonnat@suse.com>
|
||
|
Date: Thu, 25 Jun 2015 10:36:52 +0200
|
||
|
Subject: [PATCH 2/5] 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
|
||
|
---
|
||
|
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 18454c8..f8a9cf2 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)
|
||
|
--
|
||
|
2.1.4
|
||
|
|