« Previous | Next » 

Revision a1aff5bf

IDa1aff5bf6786e6e8478373e4ada869a4ef2a7fc4

Added by Markus Armbruster over 12 years ago

block: Revert entanglement of bdrv_is_inserted() with tray status

Commit 4be9762a changed bdrv_is_inserted() to fail when the tray is
open. Unfortunately, there are two different kinds of users, with
conflicting needs.

1. Device models using bdrv_eject(), currently ide-cd and scsi-cd.
They expect bdrv_is_inserted() to reflect the tray status. Commit
4be9762a makes them happy.

2. Code that wants to know whether a BlockDriverState has media, such
as find_image_format(), bdrv_flush_all(). Commit 4be9762a makes them
unhappy. In particular, it breaks flush on VM stop for media ejected
by the guest.

Revert the change to bdrv_is_inserted(). Check the tray status in the
device models instead.

Note on IDE: Since only ATAPI devices have a tray, and they don't
accept ATA commands since the recent commit "ide: Reject ATA commands
specific to drive kinds", checking in atapi.c suffices.

Signed-off-by: Markus Armbruster <>
Signed-off-by: Kevin Wolf <>

Files

  • added
  • modified
  • copied
  • renamed
  • deleted

View differences