From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40740) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZhYoR-0006fI-Dq for qemu-devel@nongnu.org; Thu, 01 Oct 2015 04:02:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZhYoL-0006Wx-LG for qemu-devel@nongnu.org; Thu, 01 Oct 2015 04:01:59 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46192) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZhYoL-0006Wo-EO for qemu-devel@nongnu.org; Thu, 01 Oct 2015 04:01:53 -0400 Date: Thu, 1 Oct 2015 09:01:47 +0100 From: "Dr. David Alan Gilbert" Message-ID: <20151001080147.GA2652@work-vm> References: <371B9FFB-14FD-4707-9094-29EC9F6B508F@gmail.com> <87vbavm27u.fsf@blackfin.pond.sub.org> <20150929131109.GI3810@work-vm> <20150929133124.GK3810@work-vm> <8737xw9wl2.fsf@blackfin.pond.sub.org> <20150930081441.GB2627@work-vm> <87bncjkrgm.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87bncjkrgm.fsf@blackfin.pond.sub.org> Subject: Re: [Qemu-devel] feature idea: allow user to run custom scripts List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: Programmingkid , Peter Maydell , Peter Crosthwaite , qemu-devel qemu-devel , Michael Roth * Markus Armbruster (armbru@redhat.com) wrote: > "Dr. David Alan Gilbert" writes: > > > * Markus Armbruster (armbru@redhat.com) wrote: > >> "Dr. David Alan Gilbert" writes: > >> > >> > * Peter Maydell (peter.maydell@linaro.org) wrote: > >> >> On 29 September 2015 at 14:11, Dr. David Alan Gilbert > >> >> wrote: > >> >> > * Peter Maydell (peter.maydell@linaro.org) wrote: > >> >> >> On 28 September 2015 at 20:43, Programmingkid > >> >> >> wrote: > >> >> >> > > >> >> >> > On Sep 28, 2015, at 3:29 AM, Markus Armbruster wrote: > >> >> >> >> You didn't mention you're talking about a *GUI* feature. > >> >> >> > > >> >> >> > I'm thinking it would be easier to send in the patch rather > >> >> >> > than talk about > >> >> >> > what this feature could be. > >> >> >> > >> >> >> I think Markus and I are trying to save you that effort by > >> >> >> pointing out that this is a VM management layer feature, > >> >> >> not a core QEMU feature. > >> >> > > >> >> > OK, so I'm going to agree with Programmingkid here. > >> >> > I think this would be a useful feature to have in QEMU; I've > >> >> > got gratuitous hacks in some of my test scripts that work > >> >> > around it not being there. > >> >> > > >> >> > I think there are two possible things, both of which seem fairly > >> >> > easy: > >> >> > 1) Add a -chardev from file that works in this case > >> >> > (I don't think the current chardev file works does it?) > >> > >> In general, character devices provide a bidirectional pipe, but -chardev > >> file is write-only. I think you want -chardev pipe. I don't use it > >> myself, because as socat user, I don't have to learn lesser tools :) > >> > >> Here's how I use it. Set up a local socket (any convenient > >> bidirectional pipe would do, actually). > >> > >> Example: QMP > >> > >> # Configuration file for -readconfig > >> [chardev "qmp"] > >> backend = "socket" > >> path = "sock-qmp" > >> server = "on" > >> wait = "off" > >> > >> [mon "qmp"] > >> mode = "control" > >> chardev = "qmp" > >> > >> Example: HMP > >> > >> [chardev "hmp"] > >> backend = "socket" > >> path = "sock-hmp" > >> server = "on" > >> wait = "off" > >> > >> [mon "hmp"] > >> mode = "readline" > >> chardev = "hmp" > >> > >> Then do stuff with it. > >> > >> Example: interactive QMP > >> > >> $ socat UNIX:sock-qmp READLINE,history=$HOME/.qmp_history,prompt='QMP> ' > >> > >> Example: interactive HMP > >> > >> $ socat UNIX:sock-hmp READLINE,history=$HOME/.hmp_history > >> > >> Arguably superior to our built-in not-quite readline monitor. > >> > >> Example: send QMP input from a file, capture its output in a file > >> > >> $ socat UNIX:sock-qmp STDIO output > > > > Yes, this example is exactly why I want something less painful. > > A -chardev file that allowed read/write would be ideal, to be able to read > > a series of commands at startup. > > Have you tried -chardev pipe? As I said, I don't use it myself, because > my "painful" setup is more flexible, and not painful at all once set up. Yes, I do use -chardev pipe in some of my scripts, and yes it's simpler than the socket setup, but it's still a lot more complex than just stuffing a list of commands in. Dave -- Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK