From patchwork Mon Oct 12 08:41:35 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Denis V. Lunev" X-Patchwork-Id: 528977 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id E26271402A8 for ; Mon, 12 Oct 2015 19:42:04 +1100 (AEDT) Received: from localhost ([::1]:53907 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZlYgE-0000am-NB for incoming@patchwork.ozlabs.org; Mon, 12 Oct 2015 04:42:02 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48440) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZlYfw-0000Cj-0t for qemu-devel@nongnu.org; Mon, 12 Oct 2015 04:41:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZlYfs-0001f4-Mi for qemu-devel@nongnu.org; Mon, 12 Oct 2015 04:41:43 -0400 Received: from mailhub.sw.ru ([195.214.232.25]:40760 helo=relay.sw.ru) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZlYfs-0001eg-5W for qemu-devel@nongnu.org; Mon, 12 Oct 2015 04:41:40 -0400 Received: from irbis.sw.ru ([10.30.2.139]) by relay.sw.ru (8.13.4/8.13.4) with ESMTP id t9C8fZm3004832; Mon, 12 Oct 2015 11:41:36 +0300 (MSK) From: "Denis V. Lunev" To: Date: Mon, 12 Oct 2015 11:41:35 +0300 Message-Id: <1444639295-6588-1-git-send-email-den@openvz.org> X-Mailer: git-send-email 2.1.4 X-detected-operating-system: by eggs.gnu.org: OpenBSD 3.x X-Received-From: 195.214.232.25 Cc: Pavel Butsykin , Markus Armbruster , qemu-devel@nongnu.org, Luiz Capitulino , "Denis V. Lunev" Subject: [Qemu-devel] [PATCH 1/1] log hmp/qmp command X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Pavel Butsykin 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 Signed-off-by: Denis V. Lunev CC: Markus Armbruster CC: Luiz Capitulino CC: Eric Blake --- 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 }, };