Re: How to burn a CD using libvirt?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Mar 25, 2015 at 05:02:33PM -0500, Steve Ross wrote:
Hi,

My first e-mail... my apologies if this is not the appropriate e-mail list.


You did, sorry for the super-late response :)

My goal is to *write* from the guest OS to a CD or DVD reader/writer on
my host system.  Currently, the write operation is failing.  I believe
it is because the virtual CD-ROM device is set to be "readonly".  Is it
possible to write to a QEMU CDROM device and, if so, how?  (The host
machine's CD-ROM drive does support writing/burning.)

I'm using the "virt-manager" GUI to start the virtual machine.  Once
started, the "qemu" command line from my virtual machine process
includes the following, where the host's built-in CD reader/writer is
"/dev/sr0".

   /usr/bin/qemu-system-x86_64 ... -drive
         file=/dev/sr0,if=none,id=drive-ide0-0-1,readonly=on,format=raw

This obviously says that the device is "readonly".

A snippet of XML from my virtual machine from the CDROM is:

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


Libvirt adds that automatically to cdrom devices.


I've tried removing the <readonly/> tag from the above VM definition,
and then running the VM, but the tag magically reappears in the VM
definition when it runs.

Also, the "virt-manager" GUI shows the CDROM device as having the option
of "Readonly" being checked (and the GUI does not allow me to uncheck it.)


And this is for the same reason -- libvirt adds it by default.

On the root cause as to why even libvirt does that -- I was thinking
about few scenarios and I came to only one unclear conclusion.  There
might have been historical causes etc., but I think there's a safety
feature smell behind this.  If you pass it like this, it won't be
opened exclusively and you might get to a problem where your burned CD
is not working, although this should be handled by the device itself.
Anyway, after thinking about how to fix it I realized there is a
workaround for this.  You just need to pass-through the CD writer as a
device.  QEMU will have exclusive access and all the ioctl()s and
fcntl()s will for sure work in the guest.

Hope that helps at least a bit.

Have a nice day,
Martin

Other details:

 * qemu version 2.1.3 on Fedora 21.
 * libvirt version 1.2.0.2


Thanks for any help or pointers you can provide,
-- Steve


_______________________________________________
libvirt-users mailing list
libvirt-users@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvirt-users

Attachment: signature.asc
Description: PGP signature

_______________________________________________
libvirt-users mailing list
libvirt-users@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvirt-users

[Index of Archives]     [Virt Tools]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]

  Powered by Linux