From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LrZeV-0003g0-UB for qemu-devel@nongnu.org; Wed, 08 Apr 2009 11:25:23 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LrZeQ-0003eU-Hi for qemu-devel@nongnu.org; Wed, 08 Apr 2009 11:25:22 -0400 Received: from [199.232.76.173] (port=50212 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LrZeQ-0003eF-3V for qemu-devel@nongnu.org; Wed, 08 Apr 2009 11:25:18 -0400 Received: from gecko.sbs.de ([194.138.37.40]:16960) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LrZeP-0006dH-EG for qemu-devel@nongnu.org; Wed, 08 Apr 2009 11:25:17 -0400 Message-ID: <49DCC1DA.4060200@siemens.com> Date: Wed, 08 Apr 2009 17:25:14 +0200 From: Jan Kiszka 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> <49DCBCBE.6010102@redhat.com> In-Reply-To: <49DCBCBE.6010102@redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [libvirt] 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: Gerd Hoffmann Cc: Anthony Liguori , Hollis Blanchard , libvir-list@redhat.com, qemu-devel@nongnu.org, Jan Kiszka Gerd Hoffmann wrote: > On 04/08/09 16:33, 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. > > That would nicely solve the "queue events indefinitely" issue. By > default no events are generated. Apps which want receive them (and thus > receive them) can enable them as needed. Sounds reasonable to me as well. > >> 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 > > IMHO this is more useful than having "wait" just get one event. You'll > need a dedicated monitor channel for events anyway, so with > one-event-per-wait the management app would have to issue wait in a loop. But doesn't it have to _loop_ anyway? If wait returned multiple events, the management app would have to loop over the results and then anyway over the actual wait to get the next chunk - thus twice. To me, one event per wait invocation looks simpler to handle. > > BTW: "wait" is quite generic. Maybe we should name the commands > notify-*, i.e. have > > notify-enable $class > notify-disable $class > notify-getevents My 2 cents: event_enable $class1[,...] event_disable $class1[,...] with a special class 'all' and event_wait to finally collect the queued and enabled events. There is just the question what to do with queued events of a certain class that gets disabled before the events were dequeued. Purge them selectively or let the user do this via event_event? I'm not a fan of cleanup via magic timeouts / event aging. Jan -- Siemens AG, Corporate Technology, CT SE 2 Corporate Competence Center Embedded Linux