<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">On 2009-11-10, at 12:48 AM, Gerry Reno wrote:</div></span></div></span></div></span></div></span></span></div><div><br class="Apple-interchange-newline"><blockquote type="cite"><div>Adam Mooz wrote:<br><blockquote type="cite">On 2009-11-09, at 11:46 PM, Gerry Reno wrote:<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><blockquote type="cite">Adam Mooz wrote:<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">Hello List,<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">I'm attempting to pass a DVD drive of a headless server into a virtual machine.  So far I've managed to mount *something* into the VM, but it's being registered as a blank DVD within the VM. When I mount /dev/dvd into the bare-metal machine it registers normally as the DVD.  How do I pass physical drives into a VM and back out using libvirt?  Command used:<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">#virsh attach-disk Montreal /dev/dvd hdc --mode readonly --driver phy --type cdrom<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">Connecting to uri: <a href="qemu:///system">qemu:///system</a><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">Disk attached successfully<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">VM XML file:<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><domain type='kvm'><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"> <name>Montreal</name><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"> <uuid>0f79ba7f-27bf-16a0-5887-6cfa2b5569f1</uuid><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"> <memory>2097152</memory><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"> <currentMemory>2097152</currentMemory><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"> <vcpu>1</vcpu><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"> <os><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">   <type arch='x86_64' machine='pc-0.11'>hvm</type><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">   <boot dev='hd'/><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"> </os><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"> <features><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">   <acpi/><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">   <apic/><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">   <pae/><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"> </features><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"> <clock offset='utc'/><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"> <on_poweroff>destroy</on_poweroff><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"> <on_reboot>restart</on_reboot><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"> <on_crash>restart</on_crash><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"> <devices><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">   <emulator>/usr/bin/kvm</emulator><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">   <disk type='file' device='cdrom'><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">     <target dev='hdc' bus='ide'/><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">     <readonly/><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">   </disk><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">   <disk type='file' device='disk'><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">     <source file='(Mangled Purposely)'/><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">     <target dev='vda' bus='virtio'/><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">   </disk><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">   <interface type='bridge'><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">     <mac address='(mangled purposly)/>       <source bridge='br0'/><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">     <model type='virtio'/><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">   </interface><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">   <serial type='pty'><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">     <target port='0'/><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">   </serial><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">   <console type='pty'><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">     <target port='0'/><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">   </console><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">   <input type='mouse' bus='ps2'/><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">   <graphics type='vnc' port='-1' autoport='yes' keymap='en-us'/><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">   <video><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">     <model type='cirrus' vram='9216' heads='1'/><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">   </video><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"> </devices><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"></domain><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">I haven't done this for a while but I believe you have to issue a 'detach' command afterwards.<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">-Gerry<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">--<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Libvir-list mailing list<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><a href="mailto:Libvir-list@redhat.com">Libvir-list@redhat.com</a> <<a href="mailto:Libvir-list@redhat.com">mailto:Libvir-list@redhat.com</a>><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><a href="https://www.redhat.com/mailman/listinfo/libvir-list">https://www.redhat.com/mailman/listinfo/libvir-list</a><br></blockquote></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"># virsh detach-disk Montreal hdc<br></blockquote><blockquote type="cite">Connecting to uri: <a href="qemu:///system">qemu:///system</a><br></blockquote><blockquote type="cite">error: this function is not supported by the hypervisor: only SCSI or virtio disk device can be detached dynamically<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">? Also, I'm not sure if you understood my question.  When I pass in the DVD device into the VM it registers as a blank DVD.  if I pass in a non-existant folder it blows up, so I know it's reading something from the real DVD drive.  Mounting the real DVD drive in the bare-metal machine shows the files on the drive, but I cannot get them to appear in the VM.  How do I get the same files to show up in the VM (i.e. mount the DVD drive into the VM)?<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote>I didn't see /dev/dvd in your xml.  If you attach it and then dump the xml what does it look like?  And then have you tried booting the VM with an xml file with this device and can you read the files on the device this way?<br><br>The other thing is that maybe your version of libvirt is too old.  I think 0.7.1 is current.<br><br>-Gerry<br><br><br>--<br>Libvir-list mailing list<br><a href="mailto:Libvir-list@redhat.com">Libvir-list@redhat.com</a><br>https://www.redhat.com/mailman/listinfo/libvir-list<br></div></blockquote><br></div><div>Booting with the drive specified within the XML also gives a blank DVD in the VM, no luck there. It turns out I'm running libvirt 7.0, was there a large change between 7.0 and 7.1 in the way they handle mounting block devices?  </div><div><br></div><div>Here is some more output:</div><div>After mounting at runtime, not at boot to the VM.</div><div><div>virsh # dumpxml Montreal</div><div><domain type='kvm' id='3'></div><div>  <name>Montreal</name></div><div>  <uuid>0f79ba7f-27bf-16a0-5887-6cfa2b5569f1</uuid></div><div>  <memory>2097152</memory></div><div>  <currentMemory>2097152</currentMemory></div><div>  <vcpu>4</vcpu></div><div>  <os></div><div>    <type arch='x86_64' machine='pc-0.11'>hvm</type></div><div>    <boot dev='hd'/></div><div>  </os></div><div>  <features></div><div>    <acpi/></div><div>    <apic/></div><div>    <pae/></div><div>  </features></div><div>  <clock offset='utc'/></div><div>  <on_poweroff>destroy</on_poweroff></div><div>  <on_reboot>restart</on_reboot></div><div>  <on_crash>restart</on_crash></div><div>  <devices></div><div>    <emulator>/usr/bin/kvm</emulator></div><div>    <disk type='block' device='cdrom'></div><div>      <source dev='/dev/dvd'/></div><div>      <target dev='hdc' bus='ide'/></div><div>      <readonly/></div><div>    </disk></div><div>    <disk type='file' device='disk'></div><div>      <source file='/mnt/vmdrive/Montreal-ubuntu-media/montreal.vmdk'/></div><div>      <target dev='vda' bus='virtio'/></div><div>    </disk></div><div>    <interface type='bridge'></div><div>      <mac address='54:52:00:63:bf:8d'/></div><div>      <source bridge='br0'/></div><div>      <target dev='vnet0'/></div><div>      <model type='virtio'/></div><div>    </interface></div><div>    <serial type='pty'></div><div>      <source path='/dev/pts/1'/></div><div>      <target port='0'/></div><div>    </serial></div><div>    <console type='pty' tty='/dev/pts/1'></div><div>      <source path='/dev/pts/1'/></div><div>      <target port='0'/></div><div>    </console></div><div>    <input type='mouse' bus='ps2'/></div><div>    <graphics type='vnc' port='5900' autoport='yes' keymap='en-us'/></div><div>    <video></div><div>      <model type='cirrus' vram='9216' heads='1'/></div><div>    </video></div><div>  </devices></div><div>  <seclabel type='dynamic' model='apparmor'></div><div>    <label>libvirt-0f79ba7f-27bf-16a0-5887-6cfa2b5569f1</label></div><div>    <imagelabel>libvirt-0f79ba7f-27bf-16a0-5887-6cfa2b5569f1</imagelabel></div><div>  </seclabel></div><div></domain></div><div><br></div><div>virsh # version</div><div>Compiled against library: libvir 0.7.0</div><div>Using library: libvir 0.7.0</div><div>Using API: QEMU 0.7.0</div><div>Running hypervisor: QEMU 0.11.0</div><div><br></div><div><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">-----------------------------------------------------------------</div><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><b><font class="Apple-style-span" color="#8C000E">Adam Mooz</font></b><br><font class="Apple-style-span" color="#929292"><i><a href="mailto:Adam.Mooz@gmail.com">Adam.Mooz@gmail.com</a><br></i><i><a href="mailto:AdamMooz@me.com">AdamMooz@me.com</a></i></font><font class="Apple-style-span" color="#929292"><i><br></i></font><font class="Apple-style-span" color="#929292"><a href="http://www.AdamMooz.com">http://www.AdamMooz.com</a></font></div></span></div></span></div></span></div></div></div><br></body></html>