On Thu, 11 Nov 2010 16:39:52 +0000 "Daniel P. Berrange" <berra...@redhat.com> wrote:
> 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 I have the impression that the real problem is that they are being stored in the wrong place (ie. the monitor), *maybe* they should be stored somewhere else, ie. a special chardev or something. Today those fds are linked to a given monitor session..