Bug 760885 - Disable host cdrom passthrough
Summary: Disable host cdrom passthrough
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: qemu-kvm
Version: 7.0
Hardware: Unspecified
OS: Unspecified
high
urgent
Target Milestone: rc
: ---
Assignee: Fam Zheng
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks: 720747 801536 1072610 1072611 1247068
TreeView+ depends on / blocked
 
Reported: 2011-12-07 09:34 UTC by Amit Shah
Modified: 2015-07-28 09:16 UTC (History)
24 users (show)

Fixed In Version: qemu-kvm-1.5.3-15.el7
Doc Type: Known Issue
Doc Text:
CD-ROM passthrough from to the host to a guest has been disabled in Red Hat Enterprise Linux 7.0 Beta for all front ends. QEMU reports "Driver 'host_cdrom' is not whitelisted" in this scenario.
Clone Of:
Environment:
Last Closed: 2014-06-13 11:54:00 UTC
Target Upstream Version:


Attachments (Terms of Use)

Description Amit Shah 2011-12-07 09:34:36 UTC
Host CDROM passthrough to guest is very tricky to get right, and often fails in weird ways.

See RHEL6 bugs:

bug 696613 - libvirt's labelling of /dev/sr0 can get messed up
bug 694111 - CD-ROM block device inode size not refreshed after media change
bug 729219 - Input/output error occurs when eject /dev/sr0 in the guest
bug 729225 - eject command in the guest does not works properly when guest using host cdrom
bug 687900 - qemu host cdrom support not properly updating guests on media changes at physical CD/DVD drives

There is some discussion about the problems in host CDROM passthrough in those bug reports as well as a mail list posting here

http://www.mail-archive.com/virt@lists.fedoraproject.org/msg01057.html

Unless there is business justification for CDROM passthrough, we prefer this be disabled for RHEL7.  We can enable the support if the issues do get fixed.

Comment 1 Markus Armbruster 2012-02-02 10:18:28 UTC
Scratch bug 729219, add:
bug 614340 - Use of /dev/sr0 in host while passed-through causes trouble in guest

Note that libvirt bug 696613 is currently WONTFIX.  If I understand the issues correctly, a fix depends on non-trivial changes to other packages.  Perhaps just udev, perhaps more.

Comment 2 Sibiao Luo 2013-01-11 11:44:13 UTC
hi Amit,

   Does this just disable the IDE passthrough ? the SCSI passthrough is ok in rhel 7 ? or all of them will disable ?

Best Regards.
sluo

Comment 3 Sibiao Luo 2013-03-13 03:39:50 UTC
Amit, append anther question, if disable the IDE passthrough, how about the AHCI passthrough, should we will disable it too ?

Comment 4 Markus Armbruster 2013-08-21 16:53:45 UTC
Host CD-ROM passthrough is block backend driver "host_cdrom",
regardless of the frontend using it, be it ide-cd connected to
piix3-ide, ide-cd connected to ich9-ahci, scsi-cd connected to
virtio-scsi-pci, ...

Comment 6 Miroslav Rezanina 2013-11-07 08:24:44 UTC
Fix included in qemu-kvm-1.5.3-15.el7

Comment 8 Sibiao Luo 2013-11-18 05:25:48 UTC
Veirfy this issue on qemu-kvm-1.5.3-19.el7.x86_64 with the instruction of comment#4. QEMU will quit with warning message prompt: Driver 'host_cdrom' is not whitelisted. So this issue has been fixed correctly.

host info:
3.10.0-41.el7.x86_64
qemu-kvm-1.5.3-19.el7.x86_64
seabios-1.7.2.2-4.el7.x86_64

steps and results:
- for scsi:
# /usr/libexec/qemu-kvm -S -M pc -cpu host -enable-kvm -m 2048 -smp 4,sockets=2,cores=2,threads=1 -no-kvm-pit-reinjection -drive file=/dev/sr0,if=none,id=drive-disk,format=raw,cache=none,media=cdrom,readonly=on -device virtio-scsi-pci,id=scsi1,addr=0x4 -device scsi-block,bus=scsi1.0,drive=drive-disk,id=cdrom,bootindex=0 -k en-us -boot menu=on -vnc :1 -monitor stdio
Warning: option deprecated, use lost_tick_policy property of kvm-pit instead.
qemu-kvm: -drive file=/dev/sr0,if=none,id=drive-disk,format=raw,cache=none,media=cdrom,readonly=on: could not open disk image /dev/sr0: Driver 'host_cdrom' is not whitelisted
# /usr/libexec/qemu-kvm -S -M pc -cpu host -enable-kvm -m 2048 -smp 4,sockets=2,cores=2,threads=1 -no-kvm-pit-reinjection -drive file=/dev/sr0,if=none,id=drive-disk,format=raw,cache=none,media=cdrom,readonly=on -device virtio-scsi-pci,id=scsi1,addr=0x4 -device scsi-cd,bus=scsi1.0,drive=drive-disk,id=cdrom,bootindex=0 -k en-us -boot menu=on -vnc :1 -monitor stdio
Warning: option deprecated, use lost_tick_policy property of kvm-pit instead.
qemu-kvm: -drive file=/dev/sr0,if=none,id=drive-disk,format=raw,cache=none,media=cdrom,readonly=on: could not open disk image /dev/sr0: Driver 'host_cdrom' is not whitelisted

- for ide:
# /usr/libexec/qemu-kvm -S -M pc -cpu host -enable-kvm -m 2048 -smp 4,sockets=2,cores=2,threads=1 -no-kvm-pit-reinjection -drive file=/dev/sr0,if=none,id=drive-disk,format=raw,cache=none,media=cdrom,readonly=on -device ide-drive,bus=ide.0,unit=0,drive=drive-disk,id=cdrom,bootindex=0 -k en-us -boot menu=on -vnc :1 -monitor stdioWarning: option deprecated, use lost_tick_policy property of kvm-pit instead.
qemu-kvm: -drive file=/dev/sr0,if=none,id=drive-disk,format=raw,cache=none,media=cdrom,readonly=on: could not open disk image /dev/sr0: Driver 'host_cdrom' is not whitelisted

-for ahci:
# /usr/libexec/qemu-kvm -S -M q35 -cpu host -enable-kvm -m 2048 -smp 4,sockets=2,cores=2,threads=1 -no-kvm-pit-reinjection -drive file=/dev/sr0,if=none,id=drive-disk,format=raw,cache=none,media=cdrom,readonly=on -device ide-drive,bus=ide.0,unit=0,drive=drive-disk,id=cdrom,bootindex=0 -k en-us -boot menu=on -vnc :1 -monitor stdio
Warning: option deprecated, use lost_tick_policy property of kvm-pit instead.
qemu-kvm: -drive file=/dev/sr0,if=none,id=drive-disk,format=raw,cache=none,media=cdrom,readonly=on: could not open disk image /dev/sr0: Driver 'host_cdrom' is not whitelisted
# /usr/libexec/qemu-kvm -S -M pc -cpu host -enable-kvm -m 2048 -smp 4,sockets=2,cores=2,threads=1 -no-kvm-pit-reinjection -device ahci,id=ahci0 -drive file=/dev/sr0,if=none,id=drive-disk,format=raw,cache=none,media=cdrom,readonly=on -device ide-drive,bus=ahci0.0,unit=0,drive=drive-disk,id=cdrom,bootindex=0 -k en-us -boot menu=on -vnc :1 -monitor stdio
Warning: option deprecated, use lost_tick_policy property of kvm-pit instead.
qemu-kvm: -drive file=/dev/sr0,if=none,id=drive-disk,format=raw,cache=none,media=cdrom,readonly=on: could not open disk image /dev/sr0: Driver 'host_cdrom' is not whitelisted

Best Regards,
sluo

Comment 9 Markus Armbruster 2013-12-09 08:10:55 UTC
Clarified doc text's last sentence:

1. Don't claim "QEMU terminates", because it doesn't when it rejects a monitor command. 

2. It's not a warning message, it's an error message.

Comment 10 Marc-Andre Lureau 2014-03-04 21:47:08 UTC
this is sooo annoying...

Comment 11 Cole Robinson 2014-03-14 15:58:55 UTC
Yeah, virt-manager's UI advertises physical CDROM quite prominently, and it's something that's not generated many complains for the install scenario over the years.

I know boxes has quite a bit of workflow around it as well, like offering to install a vm if the user inserts physical install media into the driver. I assume that's what Marc-Andre's comment above is about, and the blocks bugs.

Can qemu just treat /dev/sr0 the same as it would treat an iso file? So we don't have the mishmash host passthrough support but people can still use the media in the host cdrom.

Comment 12 Cole Robinson 2014-03-14 16:17:56 UTC
Obviously this likely isn't acceptable as is, but this will change qemu to just treat /dev/sr0 like a regular block device:

diff --git a/block/raw-posix.c b/block/raw-posix.c
index 1688e16..7802724 100644
--- a/block/raw-posix.c
+++ b/block/raw-posix.c
@@ -2028,28 +2028,7 @@ static int cdrom_open(BlockDriverState *bs, QDict *option
 
 static int cdrom_probe_device(const char *filename)
 {
-    int fd, ret;
-    int prio = 0;
-    struct stat st;
-
-    fd = qemu_open(filename, O_RDONLY | O_NONBLOCK);
-    if (fd < 0) {
-        goto out;
-    }
-    ret = fstat(fd, &st);
-    if (ret == -1 || !S_ISBLK(st.st_mode)) {
-        goto outc;
-    }
-
-    /* Attempt to detect via a CDROM specific ioctl */
-    ret = ioctl(fd, CDROM_DRIVE_STATUS, CDSL_CURRENT);
-    if (ret >= 0)
-        prio = 100;
-
-outc:
-    qemu_close(fd);
-out:
-    return prio;
+    return 0;
 }

Comment 13 Markus Armbruster 2014-03-17 15:03:54 UTC
If you want to treat /dev/sr0 like an iso file, use "file:/dev/sr0".

If you want to let the guest use the host CD-ROM device, try passing through the SCSI device.

Comment 14 Cole Robinson 2014-03-17 15:15:20 UTC
(In reply to Markus Armbruster from comment #13)
> If you want to treat /dev/sr0 like an iso file, use "file:/dev/sr0".

Libvirt change. Potentially doable, but libvirt would need to differentiate this behavior based on whether it was building a command line for RHEL qemu-kvm compared to EPEL qemu or qemu.git. So, fragile and more work, with pretty much the exact same result as my patch posted above.

> If you want to let the guest use the host CD-ROM device, try passing through
> the SCSI device.

Requires changes to virt-manager, virt-install, boxes at least. And potentially having to differentiate on whether its RHEL or not, etc.

And doesn't this require attaching a scsi controller to the guest? What scsi controller do we support besides virtio-scsi ? if the answer is 'none', then how does this work for windows installs?

Comment 15 Markus Armbruster 2014-03-17 16:00:52 UTC
The only SCSI controllers in RHEL-7 are virtio-scsi-pci, usb-storage and usb-bot.  No idea whether SCSI device pass through could work with the latter two.

Comment 24 Paolo Bonzini 2014-03-25 15:04:56 UTC
I prefer Cole's approach indeed to backporting those patches so late...

Comment 25 Tom Mingarelli 2014-05-09 12:58:59 UTC
So is this the issue where the CDROM radio button stays disabled even when you're trying to install a guest using the Host's physical DVDROM device? Is there a workaround? I know the URL method works as does the method of downloading an ISO file to the Host and using it.

Tom

Comment 30 Ludek Smid 2014-06-13 11:54:00 UTC
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.

Comment 36 Cole Robinson 2014-07-15 15:40:37 UTC
FWIW, there is a bug report that is tracking re-enabling cdrom passthrough (sort of, see bug for details). However there's no guarantee that it will actually be re-enabled, we are still discussing:

https://bugzilla.redhat.com/show_bug.cgi?id=1077302


Note You need to log in before you can comment on or make changes to this bug.