RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1077302 - Disable host_cdrom detection logic, fall back to plain file: protocol
Summary: Disable host_cdrom detection logic, fall back to plain file: protocol
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: qemu-kvm
Version: 7.0
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Markus Armbruster
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-03-17 16:38 UTC by Cole Robinson
Modified: 2015-06-09 16:30 UTC (History)
14 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-07-16 13:22:13 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Cole Robinson 2014-03-17 16:38:52 UTC
host_cdrom support is compiled out of qemu, for good reasons, as mentioned here:

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

Though the implementation means that any attempt to use /dev/sr0 through libvirt will fail. /dev/sr0 is detected as host_cdrom, qemu reports host_cdrom isn't available, and fails.

This breaks some prominent bits of virt-manager and boxes UI that expect to be able to attach a host cdrom device to a guest. There are bugs for that:

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

However it seems like less work and friendly for our users to just have qemu fall back to treating /dev/sr0 like it would any other block device, and not use the special host_cdrom integration.

This patch works for me, but may not be suitable as is:

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;
 }


This may not solve the libvirt + /dev/sr0 + udev + selinux relabelling issues as linked in the host_cdrom bug report, I'm not sure (but they may have been due to a side effect of host_cdrom behavior, so perhaps they will be avoided). There may well be other reasons, but I think something along the above idea should be considered.

Comment 1 Markus Armbruster 2014-06-24 13:31:29 UTC
The patch makes qemu-kvm use backend "host_device" instead of
"host_cdrom".

I have two problems with this idea:

1. It turns "Attempt to use host CD-ROM is rejected out of hand with a
reasonably clear error message" into "Host CD-ROM is accepted, but
doesn't fully work".  In particular, guest commands to eject and load
media succeed without doing anything.  I doubt that's an improvement.

2. The boat has sailed: we shipped 7.0.  I'm rather reluctant to
change how we treat host CD-ROM now.  Feedback from customers could
overcome my reluctance.

Any objections to WONTFIX?

Comment 2 Markus Armbruster 2014-07-16 13:22:13 UTC
Closing WONTFIX.  If you disagree, please reopen stating your arguments.


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