qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] qmp: report TRAY_STATE_CHANGED events


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH] qmp: report TRAY_STATE_CHANGED events
Date: Fri, 04 Nov 2011 11:53:53 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:7.0.1) Gecko/20110930 Thunderbird/7.0.1

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]