From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:46138) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T4Pl8-0007oL-LA for qemu-devel@nongnu.org; Thu, 23 Aug 2012 01:15:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T4Pl5-0000E6-EG for qemu-devel@nongnu.org; Thu, 23 Aug 2012 01:15:10 -0400 Received: from e28smtp02.in.ibm.com ([122.248.162.2]:48185) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T4Pl4-0008SS-QL for qemu-devel@nongnu.org; Thu, 23 Aug 2012 01:15:07 -0400 Received: from /spool/local by e28smtp02.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 23 Aug 2012 10:45:00 +0530 Received: from d28av03.in.ibm.com (d28av03.in.ibm.com [9.184.220.65]) by d28relay01.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q7N5Eurw3998170 for ; Thu, 23 Aug 2012 10:44:57 +0530 Received: from d28av03.in.ibm.com (loopback [127.0.0.1]) by d28av03.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q7N5EuoV002787 for ; Thu, 23 Aug 2012 15:14:56 +1000 From: Lei Li Date: Thu, 23 Aug 2012 13:14:20 +0800 Message-Id: <1345698866-19794-1-git-send-email-lilei@linux.vnet.ibm.com> Subject: [Qemu-devel] [RFC v2 ATCH 0/4] char: expose MemoryCharDriver to users and provide QMP interface List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: aliguori@us.ibm.com, eblake@redhat.com, Lei Li This RFC series attempts to convert the MemCharDriver to use a circular buffer for input and output, expose it to users by introducing QMP commands memchar_write and memchar_read and via the command line like the other CharDriverStates. Serial ports in qemu always use CharDriverStates as there backends, Right now, all of our backends always try to write the data from the guest to a socket or file. The concern from OpenStack is that this could lead to unbounded disk space usage since they log the serial output. For more detail of the background info: https://bugs.launchpad.net/nova/+bug/832507 So we want to use a circular buffer in QEMU instead, and then OpenStack can periodically read the buffer in QEMU and log it. The QMP commands introduced like: { 'command': 'memchar_write', 'data': {'chardev': 'str', 'size': 'int', 'data': 'str'} } { 'command': 'memchar_read', 'data': {'chardev': 'str', 'size': 'int'}, 'returns': 'str' } Expose MemCharDriver via the command line like: qemu -chardev memchr,max-capacity=640k,id=foo -serial chardev:foo Note: This series is just a incomplete sketch and not completely tested which I am still struggling with, but I want to get this out ealier to have your suggestion. Please comment and let me know if this seems like the direction we should be headed, thanks! TODO: 1) Add congestion mechanism. 2) Add HMP "console" command so that can interact with multiple chardevs via a single monitor socket Changes since v1: - Exposing the MemCharDriver via command line. - Support base64 data format suggested by Anthony and Eric. - Follow the new rule for the name of qmp command from Eric. For the comments of MemCharDriver improvment, which I am working on and will send out within v3 with the rest feature implemented in few days. Lei Li (6): qemu-char: Convert MemCharDriver to circular buffer monitor: Adjust qmp_human_monitor_command to new MemCharDriver QAPI: Introduce memchar_write QMP command QAPI: Introduce memchar_read QMP command Fix enumeration typo error Expose MemCharDriver via command line hmp-commands.hx | 32 ++++++++ hmp.c | 30 ++++++++ hmp.h | 2 + monitor.c | 8 ++- qapi-schema-guest.json | 2 +- qapi-schema.json | 69 +++++++++++++++++- qemu-char.c | 190 +++++++++++++++++++++++++++++++++++++++++++----- qemu-char.h | 2 +- qemu-config.c | 3 + qemu-options.hx | 10 +++ qmp-commands.hx | 64 ++++++++++++++++ 11 files changed, 388 insertions(+), 24 deletions(-)