qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Denis V. Lunev" <den@openvz.org>
Cc: Pavel Butsykin <pbutsykin@virtuozzo.com>,
	Markus Armbruster <armbru@redhat.com>,
	qemu-devel@nongnu.org, Luiz Capitulino <lcapitulino@redhat.com>,
	"Denis V. Lunev" <den@openvz.org>
Subject: [Qemu-devel] [PATCH 1/1] log hmp/qmp command
Date: Mon, 12 Oct 2015 11:41:35 +0300	[thread overview]
Message-ID: <1444639295-6588-1-git-send-email-den@openvz.org> (raw)

From: Pavel Butsykin <pbutsykin@virtuozzo.com>

This log would be very welcome for long-term diagnostics of the system
in the production. This log is at least necessary to understand what
has been happened on the system and to identify issues at higher-level
subsystems (libvirt, etc).

Signed-off-by: Pavel Butsykin <pbutsykin@virtuozzo.com>
Signed-off-by: Denis V. Lunev <den@openvz.org>
CC: Markus Armbruster <armbru@redhat.com>
CC: Luiz Capitulino <lcapitulino@redhat.com>
CC: Eric Blake <eblake@redhat.com>
---
 include/qemu/log.h | 1 +
 monitor.c          | 4 ++++
 qemu-log.c         | 1 +
 3 files changed, 6 insertions(+)

diff --git a/include/qemu/log.h b/include/qemu/log.h
index f880e66..dfb587e 100644
--- a/include/qemu/log.h
+++ b/include/qemu/log.h
@@ -41,6 +41,7 @@ static inline bool qemu_log_enabled(void)
 #define LOG_UNIMP          (1 << 10)
 #define LOG_GUEST_ERROR    (1 << 11)
 #define CPU_LOG_MMU        (1 << 12)
+#define LOG_CMD            (1 << 13)
 
 /* Returns true if a bit is set in the current loglevel mask
  */
diff --git a/monitor.c b/monitor.c
index 4f1ba2f..a22a798 100644
--- a/monitor.c
+++ b/monitor.c
@@ -2848,6 +2848,8 @@ static void handle_hmp_command(Monitor *mon, const char *cmdline)
     QDict *qdict;
     const mon_cmd_t *cmd;
 
+    qemu_log_mask(LOG_CMD, "hmp \"%s\" requested\n", cmdline);
+
     cmd = monitor_parse_command(mon, &cmdline, mon->cmd_table);
     if (!cmd) {
         return;
@@ -3822,6 +3824,8 @@ static void handle_qmp_command(JSONMessageParser *parser, QList *tokens)
         error_setg(&local_err, QERR_JSON_PARSING);
         goto err_out;
     }
+    qemu_log_mask(LOG_CMD, "qmp \"%s\" requested\n",
+                  qobject_to_json(obj)->string);
 
     input = qmp_check_input_obj(obj, &local_err);
     if (!input) {
diff --git a/qemu-log.c b/qemu-log.c
index 13f3813..66b15ec 100644
--- a/qemu-log.c
+++ b/qemu-log.c
@@ -119,6 +119,7 @@ const QEMULogItem qemu_log_items[] = {
     { LOG_GUEST_ERROR, "guest_errors",
       "log when the guest OS does something invalid (eg accessing a\n"
       "non-existent register)" },
+    { LOG_CMD, "cmd", "log the hmp/qmp commands execution" },
     { 0, NULL, NULL },
 };
 
-- 
2.1.4

             reply	other threads:[~2015-10-12  8:41 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-12  8:41 Denis V. Lunev [this message]
2015-10-12  9:54 ` [Qemu-devel] [PATCH 1/1] log hmp/qmp command Denis V. Lunev
2015-10-12 13:49 ` Eric Blake
2015-10-12 13:58   ` Denis V. Lunev
2015-10-13 13:05 ` Luiz Capitulino
2015-10-13 13:18   ` Denis V. Lunev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1444639295-6588-1-git-send-email-den@openvz.org \
    --to=den@openvz.org \
    --cc=armbru@redhat.com \
    --cc=lcapitulino@redhat.com \
    --cc=pbutsykin@virtuozzo.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).