Bug 868673 - booting guest with empty host cdrom: cannot open file '/dev/sr0': No medium found
Summary: booting guest with empty host cdrom: cannot open file '/dev/sr0': No medium f...
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Virtualization Tools
Classification: Community
Component: libvirt
Version: unspecified
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Martin Kletzander
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks: 1019926
TreeView+ depends on / blocked
 
Reported: 2012-10-21 15:35 UTC by Cole Robinson
Modified: 2014-04-24 15:11 UTC (History)
11 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-04-24 15:11:21 UTC
Embargoed:


Attachments (Terms of Use)

Description Cole Robinson 2012-10-21 15:35:52 UTC
Using disk XML

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

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

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

This is coming from:

qemu_command.c:qemuDomainDetermineDiskChain->virStorageFileGetMetadata

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: 

http://git.qemu.org/?p=qemu.git;a=blob;f=block/raw-posix.c

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 19:53:22 UTC
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 15:11:21 UTC
Fixed upstream with v1.2.3-173-g9556681:

commit 955668138873f2dd9b2e9989fecaddb33dc149c7
Author: Martin Kletzander <mkletzan>
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.