Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
L
libvirt
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Libvirt Packaging Team
libvirt
Commits
bbe7743c
Commit
bbe7743c
authored
16 years ago
by
Guido Günther
Browse files
Options
Downloads
Patches
Plain Diff
respect log priority for qemu domain logs
Closes: #524145
parent
031b9c1f
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
debian/patches/0006-only-log-qemu-monitor-commands-if-default-log-priori.patch
+109
-0
109 additions, 0 deletions
...nly-log-qemu-monitor-commands-if-default-log-priori.patch
debian/patches/series
+1
-0
1 addition, 0 deletions
debian/patches/series
with
110 additions
and
0 deletions
debian/patches/0006-only-log-qemu-monitor-commands-if-default-log-priori.patch
0 → 100644
+
109
−
0
View file @
bbe7743c
From: =?utf-8?q?Guido=20G=C3=BCnther?= <agx@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;
}
--
This diff is collapsed.
Click to expand it.
debian/patches/series
+
1
−
0
View file @
bbe7743c
...
...
@@ -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
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment