From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:57179) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RMNWL-0007xe-ON for qemu-devel@nongnu.org; Fri, 04 Nov 2011 13:25:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RMNWK-0001ST-Jt for qemu-devel@nongnu.org; Fri, 04 Nov 2011 13:25:37 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45842) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RMNWK-0001SF-9V for qemu-devel@nongnu.org; Fri, 04 Nov 2011 13:25:36 -0400 Date: Fri, 4 Nov 2011 15:25:26 -0200 From: Luiz Capitulino Message-ID: <20111104152526.69b6074c@doriath> In-Reply-To: <4EB3C441.2000208@redhat.com> References: <1319560018-25788-1-git-send-email-pbonzini@redhat.com> <4EAF7D8C.8050601@linux.vnet.ibm.com> <4EB3C441.2000208@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] qmp: report TRAY_STATE_CHANGED events List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: qemu-devel , ShaoHe Feng On Fri, 04 Nov 2011 11:53:53 +0100 Paolo Bonzini wrote: > On 11/01/2011 06:03 AM, ShaoHe Feng wrote: > > after the guest startups, then I right click mouse in the UI of the > > guest, and select the Eject from the menu. > > there comes an event in the qmp-monitor. > > {"timestamp": {"seconds": 1320118137, "microseconds": 420150}, "event": > > "TRAY_STATE_CHANGED", "data": {"device": "ide0-cd1", "state": "open"}} > > > > however, if I change the cdrom by this command: > > { "execute": "change","arguments": { "device": "ide0-cd1", "target": > > "/home/fsh/image/OCDC-natty-Test-Drive-20110823_010339.iso" } } > > there is no any event. > > and { "execute": "eject", "arguments": { "device": "ide0-cd1" } }, > > there is also no any event. > > This was by design. The idea was that management can do the following > to change a CD when the guest keeps the medium locked and reacts to > eject requests (like very recent Linux does): Just a note: this didn't make 1.0... I replied to it but didn't get feedback: http://lists.gnu.org/archive/html/qemu-devel/2011-10/msg03096.html > > Scenario 1: non-forced media change > > 1. start looking at TRAY_STATE_CHANGED events > 2. execute "eject" command > 3. execute "query-block" > 4. if disk is still shown as closed, check for guest reactions: > 4.1. if no TRAY_STATE_CHANGED event has been reported since > step 1, wait until a TRAY_STATE_CHANGED event has arrived > 4.2. if the TRAY_STATE_CHANGED event had state == closed, fail > 5. execute "change" command > > Scenario 2: forced media change > > 1. execute "eject -f" command (with the posted patches that > always unlock the tray upon "eject -f") > 2. execute "change" command > 3. if it fails, restart > > Paolo >