From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=59189 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q3FDw-0001wf-Lo for qemu-devel@nongnu.org; Fri, 25 Mar 2011 18:11:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q3FDv-0001QI-4e for qemu-devel@nongnu.org; Fri, 25 Mar 2011 18:11:16 -0400 Received: from e38.co.us.ibm.com ([32.97.110.159]:57992) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q3FDu-0001Pw-Rt for qemu-devel@nongnu.org; Fri, 25 Mar 2011 18:11:15 -0400 Received: from d03relay01.boulder.ibm.com (d03relay01.boulder.ibm.com [9.17.195.226]) by e38.co.us.ibm.com (8.14.4/8.13.1) with ESMTP id p2PM8OGf030476 for ; Fri, 25 Mar 2011 16:08:24 -0600 Received: from d03av01.boulder.ibm.com (d03av01.boulder.ibm.com [9.17.195.167]) by d03relay01.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p2PMBBaF098032 for ; Fri, 25 Mar 2011 16:11:11 -0600 Received: from d03av01.boulder.ibm.com (loopback [127.0.0.1]) by d03av01.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p2PMBBr4029796 for ; Fri, 25 Mar 2011 16:11:11 -0600 Message-ID: <4D8D12FD.6000906@linux.vnet.ibm.com> Date: Fri, 25 Mar 2011 17:11:09 -0500 From: Michael Roth MIME-Version: 1.0 References: <1301082479-4058-1-git-send-email-mdroth@linux.vnet.ibm.com> <1301082479-4058-9-git-send-email-mdroth@linux.vnet.ibm.com> <4D8D091D.6030102@us.ibm.com> In-Reply-To: <4D8D091D.6030102@us.ibm.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [RFC][PATCH v1 08/12] qemu-char: add qmp_proxy chardev List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: aliguori@linux.vnet.ibm.com, agl@linux.vnet.ibm.com, qemu-devel@nongnu.org, Jes.Sorensen@redhat.com On 03/25/2011 04:29 PM, Anthony Liguori wrote: > On 03/25/2011 02:47 PM, Michael Roth wrote: >> This allows qemu to be started with guest agent support via: >> >> qemu -chardev qmp_proxy,path=,id=qmp_proxy \ >> -device ...,chardev=qmp_proxy >> >> It is essentially a wrapper for -chardev socket, which takes the extra >> step of setting required defaults and initializing the qmp proxy by >> passing the path argument along. >> >> Not sure if this is the most elegant approach, but in terms of the >> command-line invocation it seems to be the most consistent way to do >> it. >> >> Signed-off-by: Michael Roth >> --- >> qemu-char.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ >> 1 files changed, 46 insertions(+), 0 deletions(-) >> >> diff --git a/qemu-char.c b/qemu-char.c >> index d301925..6ff7698 100644 >> --- a/qemu-char.c >> +++ b/qemu-char.c >> @@ -2275,6 +2275,51 @@ static CharDriverState >> *qemu_chr_open_socket(QemuOpts *opts) >> return NULL; >> } >> >> +#include "qmp-proxy-core.h" >> + >> +extern QmpProxy *qmp_proxy_default; >> + >> +static CharDriverState *qemu_chr_open_qmp_proxy(QemuOpts *opts) >> +{ >> + CharDriverState *chr; >> + QmpProxy *p; >> + const char *path; >> + >> + /* revert to/enforce default socket chardev options for qmp proxy */ >> + path = qemu_opt_get(opts, "path"); >> + if (path == NULL) { >> + path = QMP_PROXY_PATH_DEFAULT; >> + qemu_opt_set_qerr(opts, "path", path); >> + } >> + /* required options for qmp proxy */ >> + qemu_opt_set_qerr(opts, "server", "on"); >> + qemu_opt_set_qerr(opts, "wait", "off"); >> + qemu_opt_set_qerr(opts, "telnet", "off"); > > Why are these options required? The qmp_proxy_new() constructor expects a path to a socket it can connect() to. Not sure about telnet, but the other options are required for this. Well...server=on at least, wait=off needs to be set as well because that's the only way to have the socket chardev set the listening socket to non-block, since qmp_proxy_new() calls connect() on it before we return to the main I/O loop. Although, we probably shouldn't just silently switch out explicitly set options; an error would probably be more appropriate here. > > Regards, > > Anthony Liguori >