Bug 868673 - booting guest with empty host cdrom: cannot open file '/dev/sr0': No medium found
booting guest with empty host cdrom: cannot open file '/dev/sr0': No medium f...
Product: Virtualization Tools
Classification: Community
Component: libvirt (Show other bugs)
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Martin Kletzander
Depends On:
Blocks: 1019926
  Show dependency treegraph
Reported: 2012-10-21 11:35 EDT by Cole Robinson
Modified: 2014-04-24 11:11 EDT (History)
11 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2014-04-24 11:11:21 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Cole Robinson 2012-10-21 11:35:52 EDT
Using disk XML

    <disk type='block' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source dev='/dev/sr0'/>
      <target dev='hdc' bus='ide'/>
      <address type='drive' controller='0' bus='1' target='0' unit='0'/>

And no media in the host CDROM, booting fails like:

  error: cannot open file '/dev/sr0': No medium found

This is coming from:


Easy-ish fix is to use O_NONBLOCK when opening the path, but then trying to read the non-existing file header later on just fails with an i/o error.

qemu has handled this for a while by trying to detect host devices and altering open flags appropriately, see the *probe* functions here: 


This is something we explicitly made work in qemu in the past due to user request, so it'd be nice to get it working again.
Comment 1 Cole Robinson 2013-12-16 14:53:22 EST
Still relevant with libvirt 1.1.3 in fedora 20, but given that no one else has complained in 2 releases, moving it to the upstream tracker
Comment 2 Martin Kletzander 2014-04-24 11:11:21 EDT
Fixed upstream with v1.2.3-173-g9556681:

commit 955668138873f2dd9b2e9989fecaddb33dc149c7
Author: Martin Kletzander <mkletzan@redhat.com>
Date:   Wed Apr 16 17:31:50 2014 +0200

    qemu: don't check for backing chains for formats w/o snapshot support

Note You need to log in before you can comment on or make changes to this bug.