* [Qemu-devel] block bug: tray status is not updated (and/or guest ignores it) @ 2011-05-26 18:29 Luiz Capitulino 2011-05-27 11:31 ` Amit Shah 0 siblings, 1 reply; 9+ messages in thread From: Luiz Capitulino @ 2011-05-26 18:29 UTC (permalink / raw) To: amit.shah; +Cc: kwolf, Markus Armbruster, qemu-devel I'm testing with qemu.git (HEAD aa29141d84d), procedure: 1. Start a VM with: # qemu -hda disks/test.img -enable-kvm -m 1G -cdrom Fedora-14-x86_64-DVD.iso 2. Then inside the guest run: # eject /dev/sr0 && mount /dev/sr0 /mnt Results: Actual: The cdrom is successfully mounted Expected: The cdrom is not mounted (mount fails, medium not found) Git bisect tells the culprit is: 996faf1ad4a93342e381766d95686b16624f0dbd is the first bad commit commit 996faf1ad4a93342e381766d95686b16624f0dbd Author: Amit Shah <amit.shah@redhat.com> Date: Tue Apr 12 21:36:07 2011 +0530 atapi: GESN: implement 'media' subcommand ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Qemu-devel] block bug: tray status is not updated (and/or guest ignores it) 2011-05-26 18:29 [Qemu-devel] block bug: tray status is not updated (and/or guest ignores it) Luiz Capitulino @ 2011-05-27 11:31 ` Amit Shah 2011-05-27 11:34 ` Amit Shah 0 siblings, 1 reply; 9+ messages in thread From: Amit Shah @ 2011-05-27 11:31 UTC (permalink / raw) To: Luiz Capitulino; +Cc: kwolf, Markus Armbruster, qemu-devel On (Thu) 26 May 2011 [15:29:29], Luiz Capitulino wrote: > > I'm testing with qemu.git (HEAD aa29141d84d), procedure: > > 1. Start a VM with: > > # qemu -hda disks/test.img -enable-kvm -m 1G -cdrom Fedora-14-x86_64-DVD.iso > > 2. Then inside the guest run: > > # eject /dev/sr0 && mount /dev/sr0 /mnt > > Results: > > Actual: The cdrom is successfully mounted > Expected: The cdrom is not mounted (mount fails, medium not found) Really? That's what you expect? :-) Where will the medium go? What happens is mount auto-closes the tray and mounts whatever is there, which is the image you provided. Works as expected, IMO. Can you try this with a physical cdrom drive where the tray can be opened/closed by software commands? It should give you a similar behaviour. Amit ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Qemu-devel] block bug: tray status is not updated (and/or guest ignores it) 2011-05-27 11:31 ` Amit Shah @ 2011-05-27 11:34 ` Amit Shah 2011-05-27 12:40 ` Amit Shah 0 siblings, 1 reply; 9+ messages in thread From: Amit Shah @ 2011-05-27 11:34 UTC (permalink / raw) To: Luiz Capitulino; +Cc: kwolf, Markus Armbruster, qemu-devel On (Fri) 27 May 2011 [17:01:35], Amit Shah wrote: > On (Thu) 26 May 2011 [15:29:29], Luiz Capitulino wrote: > > > > I'm testing with qemu.git (HEAD aa29141d84d), procedure: > > > > 1. Start a VM with: > > > > # qemu -hda disks/test.img -enable-kvm -m 1G -cdrom Fedora-14-x86_64-DVD.iso > > > > 2. Then inside the guest run: > > > > # eject /dev/sr0 && mount /dev/sr0 /mnt > > > > Results: > > > > Actual: The cdrom is successfully mounted > > Expected: The cdrom is not mounted (mount fails, medium not found) > > Really? That's what you expect? :-) > > Where will the medium go? > > What happens is mount auto-closes the tray and mounts whatever is > there, which is the image you provided. Works as expected, IMO. > > Can you try this with a physical cdrom drive where the tray can be > opened/closed by software commands? It should give you a similar > behaviour. BTW in case mount doesn't auto-close the tray, it should fail with a 'tray open' message, not with a medium not found message. I'm checking the code to see what's happening in the meanwhile. Amit ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Qemu-devel] block bug: tray status is not updated (and/or guest ignores it) 2011-05-27 11:34 ` Amit Shah @ 2011-05-27 12:40 ` Amit Shah 2011-05-27 13:39 ` Luiz Capitulino 2011-05-27 14:30 ` Markus Armbruster 0 siblings, 2 replies; 9+ messages in thread From: Amit Shah @ 2011-05-27 12:40 UTC (permalink / raw) To: Luiz Capitulino; +Cc: kwolf, Markus Armbruster, qemu-devel On (Fri) 27 May 2011 [17:04:30], Amit Shah wrote: > On (Fri) 27 May 2011 [17:01:35], Amit Shah wrote: > > On (Thu) 26 May 2011 [15:29:29], Luiz Capitulino wrote: > > > > > > I'm testing with qemu.git (HEAD aa29141d84d), procedure: > > > > > > 1. Start a VM with: > > > > > > # qemu -hda disks/test.img -enable-kvm -m 1G -cdrom Fedora-14-x86_64-DVD.iso > > > > > > 2. Then inside the guest run: > > > > > > # eject /dev/sr0 && mount /dev/sr0 /mnt > > > > > > Results: > > > > > > Actual: The cdrom is successfully mounted > > > Expected: The cdrom is not mounted (mount fails, medium not found) > > > > Really? That's what you expect? :-) > > > > Where will the medium go? > > > > What happens is mount auto-closes the tray and mounts whatever is > > there, which is the image you provided. Works as expected, IMO. Confirmed, that's what happens. What's weird though is 'eject' in the monitor makes the cdrom go away -- a subsequent mount in the guest results in a no medium error. I thought we had solved that, Markus? By not doing a bdrv_close() in the do_eject()->eject_device() call path this starts working as expected. Amit ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Qemu-devel] block bug: tray status is not updated (and/or guest ignores it) 2011-05-27 12:40 ` Amit Shah @ 2011-05-27 13:39 ` Luiz Capitulino 2011-05-27 13:41 ` Daniel P. Berrange 2011-05-27 14:30 ` Markus Armbruster 1 sibling, 1 reply; 9+ messages in thread From: Luiz Capitulino @ 2011-05-27 13:39 UTC (permalink / raw) To: Amit Shah; +Cc: kwolf, Markus Armbruster, qemu-devel On Fri, 27 May 2011 18:10:08 +0530 Amit Shah <amit.shah@redhat.com> wrote: > On (Fri) 27 May 2011 [17:04:30], Amit Shah wrote: > > On (Fri) 27 May 2011 [17:01:35], Amit Shah wrote: > > > On (Thu) 26 May 2011 [15:29:29], Luiz Capitulino wrote: > > > > > > > > I'm testing with qemu.git (HEAD aa29141d84d), procedure: > > > > > > > > 1. Start a VM with: > > > > > > > > # qemu -hda disks/test.img -enable-kvm -m 1G -cdrom Fedora-14-x86_64-DVD.iso > > > > > > > > 2. Then inside the guest run: > > > > > > > > # eject /dev/sr0 && mount /dev/sr0 /mnt > > > > > > > > Results: > > > > > > > > Actual: The cdrom is successfully mounted > > > > Expected: The cdrom is not mounted (mount fails, medium not found) > > > > > > Really? That's what you expect? :-) That was the VM behavior before 996faf1ad, therefore it's what I was expecting. > > > Where will the medium go? We were leaking it then? > > > What happens is mount auto-closes the tray and mounts whatever is > > > there, which is the image you provided. Works as expected, IMO. > > Confirmed, that's what happens. Ok. I got this by testing my series that adds the BLOCK_MEDIA_EJECT event. At first I thought your commit wasn't handling the tray status correctly (which would cause problems to the new event), but it seems to work fine, specially now that I know what's doing. Sorry for the noise. > What's weird though is 'eject' in the monitor makes the cdrom go away > -- a subsequent mount in the guest results in a no medium error. I > thought we had solved that, Markus? > > By not doing a bdrv_close() in the do_eject()->eject_device() call > path this starts working as expected. Yes, also note that with the -f option eject is capable of purging any block device. I wonder if libvirt (or any client) relies on this. IMHO, we should do the following: 1. Drop bdrv_close() from eject and change it to just eject a device (which also means working only on removable media) 2. If we really want to be able to remove block devices from the VM, we should add a new command for that 3. The change command does an eject followed by a bdrv_close(), this is fine, considering we can't break compatibility here ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Qemu-devel] block bug: tray status is not updated (and/or guest ignores it) 2011-05-27 13:39 ` Luiz Capitulino @ 2011-05-27 13:41 ` Daniel P. Berrange 2011-05-27 14:35 ` Markus Armbruster 0 siblings, 1 reply; 9+ messages in thread From: Daniel P. Berrange @ 2011-05-27 13:41 UTC (permalink / raw) To: Luiz Capitulino; +Cc: Amit Shah, kwolf, Markus Armbruster, qemu-devel On Fri, May 27, 2011 at 10:39:35AM -0300, Luiz Capitulino wrote: > On Fri, 27 May 2011 18:10:08 +0530 > Amit Shah <amit.shah@redhat.com> wrote: > > > On (Fri) 27 May 2011 [17:04:30], Amit Shah wrote: > > > On (Fri) 27 May 2011 [17:01:35], Amit Shah wrote: > > > > On (Thu) 26 May 2011 [15:29:29], Luiz Capitulino wrote: > > > > > > > > > > I'm testing with qemu.git (HEAD aa29141d84d), procedure: > > > > > > > > > > 1. Start a VM with: > > > > > > > > > > # qemu -hda disks/test.img -enable-kvm -m 1G -cdrom Fedora-14-x86_64-DVD.iso > > > > > > > > > > 2. Then inside the guest run: > > > > > > > > > > # eject /dev/sr0 && mount /dev/sr0 /mnt > > > > > > > > > > Results: > > > > > > > > > > Actual: The cdrom is successfully mounted > > > > > Expected: The cdrom is not mounted (mount fails, medium not found) > > > > > > > > Really? That's what you expect? :-) > > That was the VM behavior before 996faf1ad, therefore it's what I was > expecting. > > > > > Where will the medium go? > > We were leaking it then? > > > > > What happens is mount auto-closes the tray and mounts whatever is > > > > there, which is the image you provided. Works as expected, IMO. > > > > Confirmed, that's what happens. > > Ok. I got this by testing my series that adds the BLOCK_MEDIA_EJECT event. > At first I thought your commit wasn't handling the tray status correctly > (which would cause problems to the new event), but it seems to work fine, > specially now that I know what's doing. Sorry for the noise. > > > What's weird though is 'eject' in the monitor makes the cdrom go away > > -- a subsequent mount in the guest results in a no medium error. I > > thought we had solved that, Markus? > > > > By not doing a bdrv_close() in the do_eject()->eject_device() call > > path this starts working as expected. > > Yes, also note that with the -f option eject is capable of purging > any block device. I wonder if libvirt (or any client) relies on this. libvirt will only issue 'eject' on devices which are CDROMs, or Floppy, never hard disks, etc. Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :| ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Qemu-devel] block bug: tray status is not updated (and/or guest ignores it) 2011-05-27 13:41 ` Daniel P. Berrange @ 2011-05-27 14:35 ` Markus Armbruster 2011-05-27 18:07 ` Daniel P. Berrange 0 siblings, 1 reply; 9+ messages in thread From: Markus Armbruster @ 2011-05-27 14:35 UTC (permalink / raw) To: Daniel P. Berrange; +Cc: Amit Shah, kwolf, qemu-devel, Luiz Capitulino "Daniel P. Berrange" <berrange@redhat.com> writes: > On Fri, May 27, 2011 at 10:39:35AM -0300, Luiz Capitulino wrote: >> On Fri, 27 May 2011 18:10:08 +0530 >> Amit Shah <amit.shah@redhat.com> wrote: [...] >> > What's weird though is 'eject' in the monitor makes the cdrom go away >> > -- a subsequent mount in the guest results in a no medium error. I >> > thought we had solved that, Markus? >> > >> > By not doing a bdrv_close() in the do_eject()->eject_device() call >> > path this starts working as expected. >> >> Yes, also note that with the -f option eject is capable of purging >> any block device. I wonder if libvirt (or any client) relies on this. > > libvirt will only issue 'eject' on devices which are CDROMs, or Floppy, > never hard disks, etc. Any use of -f? Recommend to stay away from it. https://bugzilla.redhat.com/show_bug.cgi?id=676528 ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Qemu-devel] block bug: tray status is not updated (and/or guest ignores it) 2011-05-27 14:35 ` Markus Armbruster @ 2011-05-27 18:07 ` Daniel P. Berrange 0 siblings, 0 replies; 9+ messages in thread From: Daniel P. Berrange @ 2011-05-27 18:07 UTC (permalink / raw) To: Markus Armbruster; +Cc: Amit Shah, kwolf, qemu-devel, Luiz Capitulino On Fri, May 27, 2011 at 04:35:24PM +0200, Markus Armbruster wrote: > "Daniel P. Berrange" <berrange@redhat.com> writes: > > > On Fri, May 27, 2011 at 10:39:35AM -0300, Luiz Capitulino wrote: > >> On Fri, 27 May 2011 18:10:08 +0530 > >> Amit Shah <amit.shah@redhat.com> wrote: > [...] > >> > What's weird though is 'eject' in the monitor makes the cdrom go away > >> > -- a subsequent mount in the guest results in a no medium error. I > >> > thought we had solved that, Markus? > >> > > >> > By not doing a bdrv_close() in the do_eject()->eject_device() call > >> > path this starts working as expected. > >> > >> Yes, also note that with the -f option eject is capable of purging > >> any block device. I wonder if libvirt (or any client) relies on this. > > > > libvirt will only issue 'eject' on devices which are CDROMs, or Floppy, > > never hard disks, etc. > > Any use of -f? Recommend to stay away from it. > > https://bugzilla.redhat.com/show_bug.cgi?id=676528 When ejecting CDROM media, there's an option to supply a 'FORCE' flag to the libvirt API, so media is ejected even if the guest OS has locked the tray, or is crashed Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :| ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Qemu-devel] block bug: tray status is not updated (and/or guest ignores it) 2011-05-27 12:40 ` Amit Shah 2011-05-27 13:39 ` Luiz Capitulino @ 2011-05-27 14:30 ` Markus Armbruster 1 sibling, 0 replies; 9+ messages in thread From: Markus Armbruster @ 2011-05-27 14:30 UTC (permalink / raw) To: Amit Shah; +Cc: kwolf, qemu-devel, Luiz Capitulino Amit Shah <amit.shah@redhat.com> writes: [...] > What's weird though is 'eject' in the monitor makes the cdrom go away > -- a subsequent mount in the guest results in a no medium error. I > thought we had solved that, Markus? You fell into QEMU's "let's overload names until everybody's hopelessly confused" trap. You're in good company. Monitor command "eject" does *not* manipulate the tray. It cuts the connection between the block device guest part and host part. Block devices without a host part look like "no medium" to the guest. Running /usr/bin/eject does manipulate the tray. When you open, then close the tray, you get the same medium back. IIRC, running mount in the guest closes the tray automatically. [...] ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2011-05-27 18:07 UTC | newest] Thread overview: 9+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2011-05-26 18:29 [Qemu-devel] block bug: tray status is not updated (and/or guest ignores it) Luiz Capitulino 2011-05-27 11:31 ` Amit Shah 2011-05-27 11:34 ` Amit Shah 2011-05-27 12:40 ` Amit Shah 2011-05-27 13:39 ` Luiz Capitulino 2011-05-27 13:41 ` Daniel P. Berrange 2011-05-27 14:35 ` Markus Armbruster 2011-05-27 18:07 ` Daniel P. Berrange 2011-05-27 14:30 ` Markus Armbruster
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).