From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LrYwu-00039h-AV for qemu-devel@nongnu.org; Wed, 08 Apr 2009 10:40:20 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LrYwo-0002yf-1J for qemu-devel@nongnu.org; Wed, 08 Apr 2009 10:40:19 -0400 Received: from [199.232.76.173] (port=53613 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LrYwn-0002y8-LP for qemu-devel@nongnu.org; Wed, 08 Apr 2009 10:40:13 -0400 Received: from e9.ny.us.ibm.com ([32.97.182.139]:55321) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LrYwn-0007vO-8g for qemu-devel@nongnu.org; Wed, 08 Apr 2009 10:40:13 -0400 Received: from d01relay02.pok.ibm.com (d01relay02.pok.ibm.com [9.56.227.234]) by e9.ny.us.ibm.com (8.13.1/8.13.1) with ESMTP id n38EUKKg028253 for ; Wed, 8 Apr 2009 10:30:20 -0400 Received: from d01av01.pok.ibm.com (d01av01.pok.ibm.com [9.56.224.215]) by d01relay02.pok.ibm.com (8.13.8/8.13.8/NCO v9.2) with ESMTP id n38EeBBV162124 for ; Wed, 8 Apr 2009 10:40:11 -0400 Received: from d01av01.pok.ibm.com (loopback [127.0.0.1]) by d01av01.pok.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id n38Ee9vw019464 for ; Wed, 8 Apr 2009 10:40:09 -0400 Message-ID: <49DCB730.4030907@us.ibm.com> Date: Wed, 08 Apr 2009 09:39:44 -0500 From: Anthony Liguori MIME-Version: 1.0 References: <1239200204-4934-1-git-send-email-aliguori@us.ibm.com> <1239200204-4934-2-git-send-email-aliguori@us.ibm.com> <20090408143335.GS18076@redhat.com> In-Reply-To: <20090408143335.GS18076@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [PATCH 2/3] Introduce monitor 'wait' command Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Daniel P. Berrange" Cc: libvir-list@redhat.com, Jan Kiszka , qemu-devel@nongnu.org, Hollis Blanchard Daniel P. Berrange wrote: > On Wed, Apr 08, 2009 at 09:16:43AM -0500, Anthony Liguori wrote: > >> The wait command will pause the monitor the command was issued in until a new >> event becomes available. Events are queued if there isn't a waiter present. >> The wait command completes after a single event is available. >> >> Today, we queue events indefinitely but in the future, I suspect we'll drop >> events that are older than a certain amount of time to avoid infinitely >> allocating memory for long running VMs. >> >> To make use of the new notification mechanism, this patch introduces a >> qemu_notify_event() API. This API takes three parameters: a class which is >> meant to classify the type of event being generated, a name which is meant to >> distinguish which event in the class that has been generated, and a details >> parameters which is meant to allow events to send arbitrary data with a given >> event. >> > > Perhaps we should have the ability to turn on/off events, via a 'notify EVENT' > command, and a way turn off the prompt on the channel used for receiving > events. > > So if I was interested in RTC change, and VNC client connection events, on > the main monitor command channel we'd do: > > (qemu) notify rtc-change > rtc-change notification enabled > (qemu) notify vnc-client > vnc-client notification enabled > (qemu) > So you want to mask out event types? I think you could do this with the actual wait command either inclusively: (qemu) wait "rtc-change vnc-client" ... Or exclusively: (qemu) wait -x "rtc-change vnc-client" ... > And then in the 2nd monitor channel, a single 'wait' command would turn > off the monitor prompt and make the channel dedicated for just events, > one per line > > (qemu) wait > rtc-change UTC+0100 > vnc-client connect 192.46.12.4:9353 > vnc-client disconnect 192.46.12.4:9353 > vnc-client connect 192.46.12.2:9353 > vnc-client disconnect 192.46.12.2:9353 > N.B. Right now, wait returns only a single event. This is because the output format is: (qemu) wait 1239200822.748241: vm-state: stop (qemu) But vm-state doesn't have any details, if it had details it would be: (qemu) wait 1239200822.748241: vm-state: stop The virtual machine has stopped. (qemu) Since everyone already parses commands like this, I think the format makes sense. It implies that the event dispatch code has to sit constantly issuing wait commands. In my next version of the patch, I expire old events (older than 10 minutes), and also add a -d flag to poll for events vs. wait. Regards, Anthony Liguori > Daniel > -- Regards, Anthony Liguori