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