From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48988) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YIlT7-0002f6-06 for qemu-devel@nongnu.org; Tue, 03 Feb 2015 16:57:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YIlT3-0006BO-At for qemu-devel@nongnu.org; Tue, 03 Feb 2015 16:57:12 -0500 Received: from mx1.redhat.com ([209.132.183.28]:48900) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YIlT3-0006BK-3W for qemu-devel@nongnu.org; Tue, 03 Feb 2015 16:57:09 -0500 Message-ID: <54D14431.4040104@redhat.com> Date: Tue, 03 Feb 2015 14:57:05 -0700 From: Eric Blake MIME-Version: 1.0 References: <1420031214-6053-1-git-send-email-den@openvz.org> <1420031214-6053-5-git-send-email-den@openvz.org> In-Reply-To: <1420031214-6053-5-git-send-email-den@openvz.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="kT2xiC471pik0mx7Hb1F7AoGs7LGMwimA" Subject: Re: [Qemu-devel] [PATCH 4/8] guest agent: add guest-pipe-open List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Denis V. Lunev" Cc: qemu-devel@nongnu.org, Simon Zolin , Michael Roth This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --kT2xiC471pik0mx7Hb1F7AoGs7LGMwimA Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 12/31/2014 06:06 AM, Denis V. Lunev wrote: > From: Simon Zolin >=20 > Creates a FIFO pair that can be used with existing file read/write > interfaces to communicate with processes spawned via the forthcoming > guest-file-exec interface. >=20 > Signed-off-by: Simon Zolin > Acked-by: Roman Kagan > Signed-off-by: Denis V. Lunev > CC: Michael Roth > --- > +++ b/qga/qapi-schema.json > @@ -212,12 +212,33 @@ > 'returns': 'int' } > =20 > ## > +# @guest-pipe-open > +# > +# Open a pipe to in the guest to associated with a qga-spawned process= es > +# for communication. > +# > +# Returns: Guest file handle on success, as per guest-file-open. This > +# handle is useable with the same interfaces as a handle returned by s/useable/usable/ > +# guest-file-open. > +# > +# Since: 2.3 > +## > +{ 'command': 'guest-pipe-open', > + 'data': { 'mode': 'str' }, > + 'returns': 'int' } I'm not a fan of returning a bare 'int' - it is not extensible. Better is returning a dictionary, such as 'returns': { 'fd': 'int' }. That way, if we ever find a reason to return multiple pieces of information, we just return a larger dictionary. Yeah, I know guest-pipe-open breaks the rules here, and so consistency may be an argument in favor of also breaking the rules. I don't like 'mode' encoded as a raw string. Make it an enum type (as in { 'enum':'PipeMode', 'data':['read', 'write']} ... 'mode':'PipeMode') or even a bool (as in 'read':'bool') This only returns ONE end of a pipe (good for when the host is piping data into the child, or when the child is piping data into the host). But isn't your goal to also make it possible to string together multiple child processes where the output of one is the input of the other (no host involvement)? How would you wire that up? > + > +## > # @guest-file-close: > # > # Close an open file in the guest > # > # @handle: filehandle returned by guest-file-open > # > +# Please note that closing the write side of a pipe will block until t= he read > +# side is closed. If you passed the read-side of the pipe to a qga-sp= awned > +# process, make sure the process has exited before attempting to close= the > +# write side. How does one pass the read side of a pipe to a spawned child? Can you design the spawning API so that close cannot deadlock? > +# > # Returns: Nothing on success. > # > # Since: 0.15.0 >=20 --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --kT2xiC471pik0mx7Hb1F7AoGs7LGMwimA Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJU0UQxAAoJEKeha0olJ0NqyOAH/i9y707Fb+qOod77VNiC6jiA EFNKL3G1Fw6aPzgGELTseTzMwWzFVLBpRt9tFtguuNls9Iq9e8SMO/RPvjhMKbIL f6php+VoC3AERpKziMKya4XlH9MCfp8DmB1sWHKiApv3Yrr5GfknlDo+w+X2F9jl wnFs0fWo08AsM/QfU3iuVP6CL4WnwWggiS5+duDvOZfkuPyd/ibIDAfRfw/oXKJ8 dANWnyjbrGpZH/GNEgZ946Tsse2ErWKQ9jc/j8OxPr71cF0vlMhf20BZcwK5pvZc sEKh3GbCfYV3CxlolIXzBHbnj6NiHAW7FxnAo2dwgI1ZHwrstBqrFiXKY3EEvS8= =3yKx -----END PGP SIGNATURE----- --kT2xiC471pik0mx7Hb1F7AoGs7LGMwimA--