From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=59363 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PPyEo-0005iU-OE for qemu-devel@nongnu.org; Tue, 07 Dec 2010 09:09:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PPyEn-0003VW-5m for qemu-devel@nongnu.org; Tue, 07 Dec 2010 09:09:50 -0500 Received: from e6.ny.us.ibm.com ([32.97.182.146]:53990) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PPyEn-0003VI-0R for qemu-devel@nongnu.org; Tue, 07 Dec 2010 09:09:49 -0500 Received: from d01dlp01.pok.ibm.com (d01dlp01.pok.ibm.com [9.56.224.56]) by e6.ny.us.ibm.com (8.14.4/8.13.1) with ESMTP id oB7E6BnV012107 for ; Tue, 7 Dec 2010 09:11:07 -0500 Received: from d01relay03.pok.ibm.com (d01relay03.pok.ibm.com [9.56.227.235]) by d01dlp01.pok.ibm.com (Postfix) with ESMTP id 484CC7280B8 for ; Tue, 7 Dec 2010 09:09:17 -0500 (EST) Received: from d01av01.pok.ibm.com (d01av01.pok.ibm.com [9.56.224.215]) by d01relay03.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id oB7E9GNY339028 for ; Tue, 7 Dec 2010 09:09:17 -0500 Received: from d01av01.pok.ibm.com (loopback [127.0.0.1]) by d01av01.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id oB7E9GJ8018570 for ; Tue, 7 Dec 2010 09:09:16 -0500 Message-ID: <4CFE400B.7040900@linux.vnet.ibm.com> Date: Tue, 07 Dec 2010 08:09:15 -0600 From: Michael Roth MIME-Version: 1.0 Subject: Re: [Qemu-devel] Re: [RFC][PATCH v5 08/21] virtagent: add agent_viewfile qmp/hmp command References: <1291399402-20366-1-git-send-email-mdroth@linux.vnet.ibm.com> <1291399402-20366-9-git-send-email-mdroth@linux.vnet.ibm.com> <1291673319.2213.8.camel@aglitke> <4CFD6FD5.6000005@linux.vnet.ibm.com> In-Reply-To: <4CFD6FD5.6000005@linux.vnet.ibm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Adam Litke Cc: agl@linux.vnet.ibm.com, stefanha@linux.vnet.ibm.com, Jes.Sorensen@redhat.com, qemu-devel@nongnu.org, aliguori@linux.vnet.ibm.com, ryanh@us.ibm.com, abeekhof@redhat.com On 12/06/2010 05:20 PM, Michael Roth wrote: > On 12/06/2010 04:08 PM, Adam Litke wrote: >> On Fri, 2010-12-03 at 12:03 -0600, Michael Roth wrote: >>> Utilize the getfile RPC to provide a means to view text files in the >>> guest. Getfile can handle binary files as well but we don't advertise >>> that here due to the special handling requiring to store it and provide >>> it back to the user (base64 encoding it for instance). Hence the >>> otherwise confusing "viewfile" as opposed to "getfile". >> >> What happens to the monitor if you use this to view a binary file? > > At the very least we probably get a lot of truncated files from the > binary->string conversion via monitor_printf(). Im not sure how the > qobject/json layer would deal with things. > >> Retrieving binary files progmatically using the QMP interface is a valid >> use case right? > > For getfile (the RPC), but not for viewfile (HMP/QMP). It's doable, but > we'd *have to* pass this data to the user as base64-encoded data at the > QMP level. At the HMP level I think we're good either way, since we > could just base64 decode in the print function. > > So in the case of QMP we'd be pushing complexity to the user in exchange > for not having a seperate plain-text-only interface. > > Either way seems reasonable, but I'd been planning on adding a seperate > `agent_copyfile ` command for dealing with > binary data, and making viewfile quick and easy for plain text (both for > HMP and QMP). > Although, agent_copyfile doesn't seem like the right approach looking at things like future libvirt integration. So we will most likely end up with a QMP command that passes base64-encoded binary data to the end-user for binary data, which we can provide a pretty-printing HMP function to decode. We'd need to take care to differentiate the HMP command from the QMP one however, else we'd have users tempted to do something like: echo "agent_getfile /remotepath/rand.bin" | socat stdin unix-connect:monitor.sock > /localpath/rand.bin to avoid having to decode the data. Would documenting the HMP counterpart as being reliable only for plain-text be sufficient? Or Should be have QMP:agent_getfile() and HMP:agent_viewfile()?