2

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://

2
  • 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, 2018 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. Aug 7, 2018 at 18:32

2 Answers 2

2

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.

3
  • 1
    Now that's interesting. Where did you find this out? I would like to look into it some more. Aug 9, 2018 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, 2018 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. Aug 9, 2018 at 20:25
1

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.

2
  • 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, 2018 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. Aug 8, 2018 at 12:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .