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

2014-10-27 Thread Markus Armbruster
Eric Blake 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 no

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

2014-10-24 Thread Eric Blake
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. Guest agree

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 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-21 Thread Markus Armbruster
Weidong Huang 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 go

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

2014-10-20 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 e

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 c

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

2014-10-20 Thread Weidong Huang
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 got it. But how to resolve the racy?

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 c

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

2014-10-20 Thread Markus Armbruster
Weidong Huang 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 hav

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

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, t

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 tr

[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 ambiguou