From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:59433) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SwVYR-0004lW-Mq for qemu-devel@nongnu.org; Wed, 01 Aug 2012 05:49:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SwVYQ-0000vX-Hv for qemu-devel@nongnu.org; Wed, 01 Aug 2012 05:49:23 -0400 Received: from e28smtp04.in.ibm.com ([122.248.162.4]:33918) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SwVYP-0000vH-UT for qemu-devel@nongnu.org; Wed, 01 Aug 2012 05:49:22 -0400 Received: from /spool/local by e28smtp04.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 1 Aug 2012 15:19:17 +0530 Received: from d28av04.in.ibm.com (d28av04.in.ibm.com [9.184.220.66]) by d28relay03.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q719nEZH23265412 for ; Wed, 1 Aug 2012 15:19:14 +0530 Received: from d28av04.in.ibm.com (loopback [127.0.0.1]) by d28av04.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q719nDrd001890 for ; Wed, 1 Aug 2012 19:49:14 +1000 From: Lei Li Date: Wed, 1 Aug 2012 17:48:54 +0800 Message-Id: <1343814538-27591-1-git-send-email-lilei@linux.vnet.ibm.com> Subject: [Qemu-devel] [RFC PATCH 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, stefanha@linux.vnet.ibm.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) Expose the MemCharDriver via the command line like the other CharDriverStates. 2) Wherther to add locking or notification mechanism. Lei Li (4): 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 monitor.c | 2 +- qapi-schema.json | 40 +++++++++++++++++ qemu-char.c | 130 ++++++++++++++++++++++++++++++++++++++++++++++-------- qemu-char.h | 2 +- qmp-commands.hx | 60 ++++++++++++++++++++++++- 5 files changed, 212 insertions(+), 22 deletions(-)