qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] Summary of CD, DVD, BD passthrough tests with -drive if=non


From: Thomas Schmitt
Subject: [Qemu-devel] Summary of CD, DVD, BD passthrough tests with -drive if=none -device virtio-blk
Date: Tue, 08 Nov 2011 17:44:31 +0100

Hi,

the test results on CD-RW, DVD-RW, DVD+RW, BD-RE are flawless with
Paolo Bonzini's most recent proposal
 -drive file=/dev/sr2,if=none,id=scsicd
 -device 
virtio-blk,drive=scsicd,logical_block_size=2048,physical_block_size=2048

libburn works fine via SG_IO. dd and other unaware readers work fine.
Chances are good that growisofs, cdrecord, and wodim will work fine, too.

----------------------------------------------------------------------

But i want to strongly suggest to open the host drive with option O_EXCL,
which has a fewly documented meaning as advisory locking mechanism
(at least with /dev/sg and /dev/sr).

It is used to indicate that the device is mounted, burn programs
use it to indicate that the drive is occupied. Both meanings are
not 100 % compatible, but the best we can get to avoid burn
burn coasters or problems with vanishing data on mounted read-only
filesystems.

Symptoms:

xorriso on the host should not list /dev/sr2, but does it.
It would be able to interfere with the guest xorriso.
Not good.  Would spoil CD and DVD- burn runs.

My spy printf say in the qemu start terminal:

  block/raw-posix.c: cdrom_open("/dev/sr2", 0)
  block/raw-posix.c: raw_open_common("/dev/sr2", 1800)
  block/raw-posix.c: cdrom_open("/dev/sr2", 2)
  block/raw-posix.c: raw_open_common("/dev/sr2", 1802)

/usr/include/bits/fcntl.h has
  #define O_EXCL             0200

(What flag is 0x800, btw ?)

----------------------------------------------------------------------

qemu start command (still the git clone of 2 November 2011) :

  .../x86_64-softmmu/qemu-system-x86_64 \
    -L .../qemu-git/pc-bios \
    -enable-kvm \
    -nographic \
    -m 512 \
    -net nic,model=ne2k_pci \
    -net user,hostfwd=tcp::5557-:22 \
    -hda /dvdbuffer/i386-install.qemu \
    -drive file=/dev/sr2,if=none,id=scsicd \
    -device 
virtio-blk,drive=scsicd,logical_block_size=2048,physical_block_size=2048 \
    -cdrom /dvdbuffer/pseudo_drive

Host system is Debian GNU/Linux 6.0.2 amd64.

----------------------------------------------------------------------

Preparations on guest system Debian GNU/Linux 6.0.3 i386

  In /lib/udev/rules.d/50-udev-default.rules:
      KERNEL=="vda", SYMLINK+="sr1"

  In /lib/udev/rules.d/91-permissions.rules:
      KERNEL=="vda", GROUP="cdrom"

  This yields
    lrwxrwxrwx 1 root root       3 Nov  8 11:19 /dev/sr1 -> vda
    brw-rw---- 1 root cdrom 254, 0 Nov  8 11:19 /dev/vda
  which allows me to run the tests as normal user in group cdrom.

----------------------------------------------------------------------

During the tests i wrote a description how to set them up and to perform
them.

It turned out that about 25 lines concern qemu, 20 concern the Debian guest,
and 400 lines concern xorriso and its expected behavior.
So it makes more sense to create a qemu related page in the wiki of
the libburnia project, rather than to submit it to qemu.

I will publish that text as soon as a GNU xorriso development tarball
is available which works on qemu without the need for a micro hack
in libbur/sg-linux.c
    - static int linux_sg_accept_any_type = 0;
    + static int linux_sg_accept_any_type = 1;
This hacklet is not without dangers. I actually need to tell CD drives
from other device types.

I will post its URL on this list when it is available.

----------------------------------------------------------------------

Have a nice day :)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]