qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel <qemu-devel@nongnu.org>,
	ShaoHe Feng <shaohef@linux.vnet.ibm.com>
Cc: Luiz Capitulino <lcapitulino@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] qmp: report TRAY_STATE_CHANGED events
Date: Fri, 04 Nov 2011 11:53:53 +0100	[thread overview]
Message-ID: <4EB3C441.2000208@redhat.com> (raw)
In-Reply-To: <4EAF7D8C.8050601@linux.vnet.ibm.com>

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	other threads:[~2011-11-04 10:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-25 16:26 [Qemu-devel] [PATCH] qmp: report TRAY_STATE_CHANGED events Paolo Bonzini
2011-10-25 18:44 ` Luiz Capitulino
2011-11-01  5:03 ` ShaoHe Feng
2011-11-04 10:53   ` Paolo Bonzini [this message]
2011-11-04 17:25     ` Luiz Capitulino

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4EB3C441.2000208@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=lcapitulino@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=shaohef@linux.vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).