I am looking for a way to mount an ISO as a cd rom, according to libvirt docs (referenced below) it should be possible, additionally in the question referenced below.

I am aware of this question, however its 4 years+ old and never actually came to any working conclusion.

I have taken the example from : http://libvirt.org/formatdomain.html#elementsDisks

</disk>
  <disk type='network' device='cdrom'>
    <driver name='qemu' type='raw'/>
    <source protocol="http" name="url_path">
      <host name="hostname" port="80"/>
    </source>
    <target dev='hde' bus='ide' tray='open'/>
    <readonly/>
  </disk>

I am unable to get this to work, I simply get:

Boot failed: Could not read from CDROM (code 0003)

Actual XML in use snippet:

<disk type='network' device='cdrom'>
    <driver name='qemu' type='raw'/>
    <source protocol="http" name="/debian-cd/current/amd64/iso-cd/debian-9.5.0-amd64-netinst.iso">
      <host name="mirror.bytemark.co.uk" port="80"/>
    </source>
    <target dev='hdb' bus='ide' tray='open'/>
    <readonly/>
  </disk>

libvirtd (libvirt) 3.9.0 QEMU emulator version 2.10.0

Is anyone able to offer any assistance or tips?

I have tried putting the complete path including fqdn in the url_path as well, with and without http://

  • Please rewrite the post so it can be understood without first reading another question (and why don't you actually link to this - a numerical question ID is useless). – Sven Aug 7 at 16:52
  • The docs have got an example of this, but it's not actually documented as being a valid protocol. I wouldn't rely on this. – Michael Hampton Aug 7 at 18:32

I found he issue, http is blacklisted in the qemu-kvm-ev packages in centos 7

You can only use https

The valid XML example is:

<disk type='network' device='cdrom'>
    <driver name='qemu' type='raw'/>
    <source protocol="https" name="/debian-cd/current/amd64/iso-cd/debian-9.5.0-amd64-netinst.iso">
      <host name="mirror.bytemark.co.uk" port="443"/>
    </source>
    <target dev='hdb' bus='ide' tray='open'/>
    <readonly/>
  </disk>

note you cannot use hdc as that seems to be reserved for local ISO or physical cdrom passthrough.

  • 1
    Now that's interesting. Where did you find this out? I would like to look into it some more. – Michael Hampton Aug 9 at 13:38
  • A combination of my initial suspicion that it was related to curl due to some very old bug reports i stumbled over, then I rebuilt the rpm from source to ensure curl support was in, during that process I scan read the spec sheet and found a patch note/reference relating to https for curl and a few emails back and forth with the libvirt usergroup and I got it working. It seems http is 'blacklisted' as a protocol for security which is a little bit silly as I have since confirmed it works with https even if no valid cert exists. – Backtogeek Aug 9 at 20:22
  • That's bizarre. I was also using https and could not even get the XML to validate. I'll have to poke at my system a little more. – Michael Hampton Aug 9 at 20:25

I tried to run one of these to an existing VM in my existing libvirt 4.1.0 system:

    <disk type='network' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source protocol='https' path='/centos/7/isos/x86_64/CentOS-7-x86_64-DVD-1804.iso'>
        <host name='mirrors.edge.kernel.org' port='443'/>
      </source>
      <target dev='sdc' bus='sata'/>
      <readonly/>
      <address type='drive' controller='0' bus='0' target='0' unit='2'/>
    </disk>

The XML failed to validate.

error: XML document failed to validate against schema: Unable to validate doc against /usr/share/libvirt/schemas/domain.rng
Extra element devices in interleave
Element domain failed to validate content

My suspicion is that someone wrote these examples long ago, thinking that this functionality might eventually be added, but it never actually was.

The explanatory text below these examples states that:

The protocol attribute specifies the protocol to access to the requested image. Possible values are "nbd", "iscsi", "rbd", "sheepdog", "gluster" or "vxhs".

The qemu man page also gives no hint that such functionality might exist.

I think you're just looking at a documentation error.

  • Hmm, not sure about that as people in the referenced question: serverfault.com/questions/582514 said it worked for them, might be one for me to pose to the libvirt dev mailing list – Backtogeek Aug 8 at 12:03
  • @Backtogeek I wonder how they managed to get it to validate, then. I played with it for some time before giving up. – Michael Hampton Aug 8 at 12:09

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.