From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:60203) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TBlaY-00088D-Qx for qemu-devel@nongnu.org; Wed, 12 Sep 2012 07:58:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TBlaS-0007MM-NU for qemu-devel@nongnu.org; Wed, 12 Sep 2012 07:58:38 -0400 Received: from e28smtp02.in.ibm.com ([122.248.162.2]:52877) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TBlaS-0007Lr-3R for qemu-devel@nongnu.org; Wed, 12 Sep 2012 07:58:32 -0400 Received: from /spool/local by e28smtp02.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 12 Sep 2012 17:28:27 +0530 Received: from d28av05.in.ibm.com (d28av05.in.ibm.com [9.184.220.67]) by d28relay04.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q8CBwFlK61669388 for ; Wed, 12 Sep 2012 17:28:16 +0530 Received: from d28av05.in.ibm.com (loopback [127.0.0.1]) by d28av05.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q8CBwCbW007870 for ; Wed, 12 Sep 2012 21:58:14 +1000 From: Lei Li Date: Wed, 12 Sep 2012 19:57:21 +0800 Message-Id: <1347451046-5513-1-git-send-email-lilei@linux.vnet.ibm.com> Subject: [Qemu-devel] [RFC v3 ATCH 0/5] char: expose CirMemCharDriver 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, Lei Li , eblake@redhat.com, armbru@redhat.com, lcapitulino@redhat.com 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', 'format': 'str', 'control': 'str' } } { 'command': 'memchar-read', 'data': {'chardev': 'str', 'size': 'int', 'format': 'str', 'control': 'str' }, 'returns': 'str' } Expose CirMemCharDriver via the command line like: qemu -chardev memchr,id=foo,maxcapacity=640k -serial chardev:foo Introduce HMP command 'console' like: (qemu) console foo Note: Now all of the feature were implemented, this series is just a sketch and not completely tested. Please comment and let me know if this seems like the direction we should be headed, your suggestion would be very appreciated! Known issues: There are still some problems I am fixing, - The circularMemoryDriver need to be improved. - For the 'block' option as sync command, will support it later when we gain the necessary infrastructure. - The HMP command 'console' still have problems to be fixed. Changes since v2: - Add congestion mechanism. For the 'block' option as sync command, will support it later when we gain the necessary infrastructure enhancement. - Add HMP 'console' command so that can interact with multiple chardevs via a single monitor socket. - Make the circular buffer backend and the current MemCharDriver live in parallel, expose a new char backend with circular buffer CirMemCharDriver suggested by Luiz. - Other fixs from Eric and Markus. 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. Lei Li (5): qemu-char: Add new char device CirMemCharDriver Expose CirMemCharDriver via command line QAPI: Introduce memchar-write QMP command QAPI: Introduce memchar-read QMP command HMP: Introduce console command hmp-commands.hx | 72 ++++++++++++++++++ hmp.c | 79 ++++++++++++++++++++ hmp.h | 3 + monitor.c | 18 +++++ monitor.h | 2 + qapi-schema.json | 96 ++++++++++++++++++++++++ qemu-char.c | 212 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ qemu-config.c | 3 + qemu-options.hx | 10 +++ qmp-commands.hx | 76 +++++++++++++++++++ 10 files changed, 571 insertions(+), 0 deletions(-)