From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=48393 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PGaBq-0003YE-IQ for qemu-devel@nongnu.org; Thu, 11 Nov 2010 11:39:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PGaBp-0001P2-I7 for qemu-devel@nongnu.org; Thu, 11 Nov 2010 11:39:58 -0500 Received: from mx1.redhat.com ([209.132.183.28]:29902) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PGaBp-0001On-8j for qemu-devel@nongnu.org; Thu, 11 Nov 2010 11:39:57 -0500 Date: Thu, 11 Nov 2010 16:39:52 +0000 From: "Daniel P. Berrange" Subject: Re: [Qemu-devel] [PATCH 2/3] QMP: Introduce Human Monitor passthrough command Message-ID: <20101111163952.GN22152@redhat.com> References: <1288362514-31407-1-git-send-email-lcapitulino@redhat.com> <1288362514-31407-3-git-send-email-lcapitulino@redhat.com> <20101110113637.05d5a202@doriath> <20101111155555.GM22152@redhat.com> <4CDC1A37.9020306@codemonkey.ws> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4CDC1A37.9020306@codemonkey.ws> Reply-To: "Daniel P. Berrange" List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: aliguori@us.ibm.com, Luiz Capitulino , Markus Armbruster , qemu-devel@nongnu.org On Thu, Nov 11, 2010 at 10:30:47AM -0600, Anthony Liguori wrote: > On 11/11/2010 09:55 AM, Daniel P. Berrange wrote: > >On Thu, Nov 11, 2010 at 04:47:41PM +0100, Markus Armbruster wrote: > >>>>> 3. Query Commands > >>>>> ================= > >>>>> > >>>>In the real human monitor, cpu-index is state (Monitor member mon_cpu). > >>>>For pass through, you shift that state into the client (argument > >>>>cpu-index). Is there any other state that could need shifting? You > >>>>mention getfd. > >>>> > >>>Surprisingly or not, this is a very important question for QMP itself. > >>> > >>>Anthony has said that we should make it stateless, and I do think this > >>>is good because it seems to simplify things considerably. > >>> > >>>However, I haven't thought about how to make things like getfd stateless. > >>> > >>Hmm, that sounds like we should investigate the getfd problem sooner > >>rather than later. > >> > >The SCM_RIGHTS code allows you to send/receive multiple file handles in a > >single sendmsg/recvmsg call. So why don't we just allow sending of the > >file handles with the monitor command that actually needs them, instead of > >ahead of time using send_fd. This simplifies life for the client because > >they also don't have to worry about cleanup using close_fd if the command > >using the FD fails. > > How do we identify file descriptors and then map them to a command? IIUC, the FDs sent/received via struct cmsghdr are in a strictly ordered array, so why not just define a placeholder syntax for the commands that maps to the array indexes. eg netdev_add tap,fd=$0,vhost_fd=$1,id=hostnet0 The '$' sign is not valid for a normal FD number, so use of a $0, $1, $2, etc can reliably be substituted with the real FD number from the cmsghdr array elements 0, 1, 2, etc Regards, Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|