From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:40993) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RvlQP-0006fU-L4 for qemu-devel@nongnu.org; Fri, 10 Feb 2012 03:01:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RvlQJ-0001b9-Nj for qemu-devel@nongnu.org; Fri, 10 Feb 2012 03:01:45 -0500 Received: from mail-iy0-f173.google.com ([209.85.210.173]:48247) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RvlQJ-0001b2-GT for qemu-devel@nongnu.org; Fri, 10 Feb 2012 03:01:39 -0500 Received: by iahk25 with SMTP id k25so4140086iah.4 for ; Fri, 10 Feb 2012 00:01:38 -0800 (PST) Sender: Paolo Bonzini Message-ID: <4F34CE19.7010806@redhat.com> Date: Fri, 10 Feb 2012 08:58:17 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <1328638189-9534-1-git-send-email-lcapitulino@redhat.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [RFC 0/5]: QMP: Introduce GUEST_MEDIUM_EJECT & BLOCK_MEDIUM_CHANGED List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: kwolf@redhat.com, eblake@redhat.com, qemu-devel@nongnu.org, Luiz Capitulino On 02/09/2012 04:01 PM, Markus Armbruster wrote: > Your GUEST_MEDIUM_EJECTED does*not* track my open<-> closed. I think > it's more complex than a straight open<-> closed event. Evidence: your > event documentation in qmp-events.txt needs an extra note to clarify > when exactly the event is emitted. I think I agree at this point that always generating an event for open <-> closed would make sense. However, we need to write a proper state machine rather than keeping it implicit. Events would be generated in the state machine rather than magically in bdrv_eject/bdrv_close. We could also take the occasion to move all this out of block.c which is becoming huge. So we would have: guest eject, tray locked: nothing guest eject, tray unlocked: BLOCK_MEDIUM_EJECT empty/full not affected guest eject, tray open: BLOCK_MEDIUM_EJECT empty/full not affected eject, tray locked: eject request sent to guest guest responds to eject request as above eject, tray unlocked and full: BLOCK_MEDIUM_EJECT BLOCK_MEDIUM_CHANGED eject, tray unlocked and empty: BLOCK_MEDIUM_EJECT eject, tray open and full: BLOCK_MEDIUM_CHANGED eject, tray open and empty: no event change, tray locked: eject request sent to guest guest responds to eject request as above change, tray unlocked and full: BLOCK_MEDIUM_EJECT (to open) BLOCK_MEDIUM_CHANGED (perhaps twice? full -> empty -> full) BLOCK_MEDIUM_EJECT (to close) change, tray unlocked and empty: BLOCK_MEDIUM_EJECT (to open) BLOCK_MEDIUM_CHANGED BLOCK_MEDIUM_EJECT (to close) change, tray open and full: BLOCK_MEDIUM_CHANGED (perhaps twice?) BLOCK_MEDIUM_EJECT (to close) change, tray open and empty: BLOCK_MEDIUM_CHANGED BLOCK_MEDIUM_EJECT (to close) Luiz, can you try making a proof of concept of this state machine? Events then would hopefully come natural. Paolo