Re: [Qemu-devel] Close the BlockDriverState when guest eject the media

2014-10-27 Thread Markus Armbruster
Eric Blake ebl...@redhat.com writes: On 10/21/2014 12:10 AM, Gonglei wrote: There is a problem. 1. Qemu receive the eject command. 2. Runs eject_request_cb when an eject request is issued from the monitor, the tray is closed, and the medium is locked. But the drive is not closed. 3.

Re: [Qemu-devel] Close the BlockDriverState when guest eject the media

2014-10-21 Thread Gonglei
On 2014/10/21 13:53, Weidong Huang wrote: On 2014/10/20 19:39, Kevin Wolf wrote: Am 20.10.2014 um 13:27 hat Weidong Huang geschrieben: On 2014/10/20 17:41, Kevin Wolf wrote: Am 18.10.2014 um 12:02 hat Weidong Huang geschrieben: Hi ALL: There are two ways to eject the cdrom tray. One is

Re: [Qemu-devel] Close the BlockDriverState when guest eject the media

2014-10-21 Thread Markus Armbruster
Weidong Huang h...@huawei.com writes: On 2014/10/20 20:12, Markus Armbruster wrote: Correct. This is a known wart. To work around it, wait for event DEVICE_TRAY_MOVED and eject again. Yes, this is racy: the guest can reclose the tray and lock it before you get your eject in. Yes. You

Re: [Qemu-devel] Close the BlockDriverState when guest eject the media

2014-10-21 Thread Gonglei
On 2014/10/21 16:33, Markus Armbruster wrote: Weidong Huang h...@huawei.com writes: On 2014/10/20 20:12, Markus Armbruster wrote: Correct. This is a known wart. To work around it, wait for event DEVICE_TRAY_MOVED and eject again. Yes, this is racy: the guest can reclose the tray and

Re: [Qemu-devel] Close the BlockDriverState when guest eject the media

2014-10-20 Thread Kevin Wolf
Am 18.10.2014 um 12:02 hat Weidong Huang geschrieben: Hi ALL: There are two ways to eject the cdrom tray. One is by the eject's qmp commmand(eject_device). The another one is by the guest(bdrv_eject). They have different results. Yes, they are different things. If a guest opens the tray

Re: [Qemu-devel] Close the BlockDriverState when guest eject the media

2014-10-20 Thread Weidong Huang
On 2014/10/20 17:41, Kevin Wolf wrote: Am 18.10.2014 um 12:02 hat Weidong Huang geschrieben: Hi ALL: There are two ways to eject the cdrom tray. One is by the eject's qmp commmand(eject_device). The another one is by the guest(bdrv_eject). They have different results. Yes, they are

Re: [Qemu-devel] Close the BlockDriverState when guest eject the media

2014-10-20 Thread Kevin Wolf
Am 20.10.2014 um 13:27 hat Weidong Huang geschrieben: On 2014/10/20 17:41, Kevin Wolf wrote: Am 18.10.2014 um 12:02 hat Weidong Huang geschrieben: Hi ALL: There are two ways to eject the cdrom tray. One is by the eject's qmp commmand(eject_device). The another one is by the

Re: [Qemu-devel] Close the BlockDriverState when guest eject the media

2014-10-20 Thread Markus Armbruster
Weidong Huang h...@huawei.com writes: On 2014/10/20 17:41, Kevin Wolf wrote: Am 18.10.2014 um 12:02 hat Weidong Huang geschrieben: Hi ALL: There are two ways to eject the cdrom tray. One is by the eject's qmp commmand(eject_device). The another one is by the guest(bdrv_eject). They have

Re: [Qemu-devel] Close the BlockDriverState when guest eject the media

2014-10-20 Thread Weidong Huang
On 2014/10/20 19:39, Kevin Wolf wrote: Am 20.10.2014 um 13:27 hat Weidong Huang geschrieben: On 2014/10/20 17:41, Kevin Wolf wrote: Am 18.10.2014 um 12:02 hat Weidong Huang geschrieben: Hi ALL: There are two ways to eject the cdrom tray. One is by the eject's qmp commmand(eject_device).

[Qemu-devel] Close the BlockDriverState when guest eject the media

2014-10-18 Thread Weidong Huang
Hi ALL: There are two ways to eject the cdrom tray. One is by the eject's qmp commmand(eject_device). The another one is by the guest(bdrv_eject). They have different results. eject_device: close the BlockDriverState(bdrv_close(bs)) bdrv_eject: don't close the BlockDriverState, This is