[Pkg-libvirt-commits] [SCM] Libvirt debian packaging branch, master, updated. debian/0.6.2-2
Guido Günther
agx at sigxcpu.org
Thu Apr 16 14:06:17 UTC 2009
The following commit has been merged in the master branch:
commit bbe7743c8823dcfc27fc31c80875778e912dfa53
Author: Guido Günther <agx at sigxcpu.org>
Date: Thu Apr 16 14:21:35 2009 +0200
respect log priority for qemu domain logs
Closes: #524145
diff --git a/debian/patches/0006-only-log-qemu-monitor-commands-if-default-log-priori.patch b/debian/patches/0006-only-log-qemu-monitor-commands-if-default-log-priori.patch
new file mode 100644
index 0000000..40258fc
--- /dev/null
+++ b/debian/patches/0006-only-log-qemu-monitor-commands-if-default-log-priori.patch
@@ -0,0 +1,109 @@
+From: =?utf-8?q?Guido=20G=C3=BCnther?= <agx at sigxcpu.org>
+Date: Thu, 16 Apr 2009 14:08:33 +0200
+Subject: [PATCH] only log qemu monitor commands if default log priority is VIR_LOG_DEBUG
+
+---
+ src/libvirt_debug.syms | 1 +
+ src/logging.c | 9 +++++++++
+ src/logging.h | 2 ++
+ src/qemu_driver.c | 27 +++++++++++++++------------
+ 4 files changed, 27 insertions(+), 12 deletions(-)
+
+diff --git a/src/libvirt_debug.syms b/src/libvirt_debug.syms
+index 1742a0b..e2e0dbd 100644
+--- a/src/libvirt_debug.syms
++++ b/src/libvirt_debug.syms
+@@ -10,6 +10,7 @@ debugFlag;
+ # logging.h
+ virLogMessage;
+ virLogSetDefaultPriority;
++virLogGetDefaultPriority;
+ virLogDefineFilter;
+ virLogDefineOutput;
+ virLogParseFilters;
+diff --git a/src/logging.c b/src/logging.c
+index 9c8b0b9..c96c8d5 100644
+--- a/src/logging.c
++++ b/src/logging.c
+@@ -326,6 +326,15 @@ int virLogSetDefaultPriority(int priority) {
+ }
+
+ /**
++ * virLogGetDefaultPriority:
++ *
++ * Get the default priority level.
++ */
++int virLogGetDefaultPriority() {
++ return virLogDefaultPriority;
++}
++
++/**
+ * virLogResetFilters:
+ *
+ * Removes the set of logging filters defined.
+diff --git a/src/logging.h b/src/logging.h
+index 7ea8935..614aefb 100644
+--- a/src/logging.h
++++ b/src/logging.h
+@@ -111,6 +111,7 @@ typedef void (*virLogCloseFunc) (void *data);
+ #ifdef ENABLE_DEBUG
+
+ extern int virLogSetDefaultPriority(int priority);
++extern int virLogGetDefaultPriority(void);
+ extern int virLogDefineFilter(const char *match, int priority, int flags);
+ extern int virLogDefineOutput(virLogOutputFunc f, virLogCloseFunc c,
+ void *data, int priority, int flags);
+@@ -131,6 +132,7 @@ extern void virLogMessage(const char *category, int priority,
+ #else /* ENABLE_DEBUG */
+
+ #define virLogSetDefaultPriority(p)
++#define virLogGetDefaultPriority()
+ #define virLogDefineFilter(m, p, f)
+ #define virLogDefineOutput(func, c, d, p, f)
+ #define virLogStartup()
+diff --git a/src/qemu_driver.c b/src/qemu_driver.c
+index 79ee072..d8cd4ee 100644
+--- a/src/qemu_driver.c
++++ b/src/qemu_driver.c
+@@ -1711,25 +1711,28 @@ qemudMonitorCommandExtra(const virDomainObjPtr vm,
+ }
+ }
+
+- /* Log, but ignore failures to write logfile for VM */
+- if (safewrite(vm->logfile, buf, strlen(buf)) < 0) {
+- char ebuf[1024];
+- VIR_WARN(_("Unable to log VM console data: %s\n"),
+- virStrerror(errno, ebuf, sizeof ebuf));
++ if (virLogGetDefaultPriority() <= VIR_LOG_DEBUG) {
++ /* Log, but ignore failures to write logfile for VM */
++ if (safewrite(vm->logfile, buf, strlen(buf)) < 0) {
++ char ebuf[1024];
++ VIR_WARN(_("Unable to log VM console data: %s\n"),
++ virStrerror(errno, ebuf, sizeof ebuf));
++ }
+ }
+-
+ *reply = buf;
+ return 0;
+
+ error:
+ if (buf) {
+- /* Log, but ignore failures to write logfile for VM */
+- if (safewrite(vm->logfile, buf, strlen(buf)) < 0) {
+- char ebuf[1024];
+- VIR_WARN(_("Unable to log VM console data: %s\n"),
+- virStrerror(errno, ebuf, sizeof ebuf));
++ if (virLogGetDefaultPriority() <= VIR_LOG_WARN) {
++ /* Log, but ignore failures to write logfile for VM */
++ if (safewrite(vm->logfile, buf, strlen(buf)) < 0) {
++ char ebuf[1024];
++ VIR_WARN(_("Unable to log VM console data: %s\n"),
++ virStrerror(errno, ebuf, sizeof ebuf));
++ }
++ VIR_FREE(buf);
+ }
+- VIR_FREE(buf);
+ }
+ return -1;
+ }
+--
diff --git a/debian/patches/series b/debian/patches/series
index fcbea71..eba0987 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -3,3 +3,4 @@
0003-allow-libvirt-group-to-access-the-socket.patch
0004-fix-Debian-specific-path-to-hvm-loader.patch
0005-increase-buffer-on-ERANGE.patch
+0006-only-log-qemu-monitor-commands-if-default-log-priori.patch
--
Libvirt debian packaging
More information about the Pkg-libvirt-commits
mailing list