From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:37652) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RMHPL-0007wU-LB for qemu-devel@nongnu.org; Fri, 04 Nov 2011 06:54:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RMHPK-0002Ag-GV for qemu-devel@nongnu.org; Fri, 04 Nov 2011 06:53:59 -0400 Received: from mail-gy0-f173.google.com ([209.85.160.173]:49388) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RMHPK-0002Ac-Cf for qemu-devel@nongnu.org; Fri, 04 Nov 2011 06:53:58 -0400 Received: by gyb11 with SMTP id 11so967130gyb.4 for ; Fri, 04 Nov 2011 03:53:57 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <4EB3C441.2000208@redhat.com> Date: Fri, 04 Nov 2011 11:53:53 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <1319560018-25788-1-git-send-email-pbonzini@redhat.com> <4EAF7D8C.8050601@linux.vnet.ibm.com> In-Reply-To: <4EAF7D8C.8050601@linux.vnet.ibm.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed 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: qemu-devel , ShaoHe Feng Cc: Luiz Capitulino 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): 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