Bug 604181 - [PATCH] Xen guest install from CD fails due to CD not found
Summary: [PATCH] Xen guest install from CD fails due to CD not found
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: kernel-xen   
(Show other bugs)
Version: 5.4
Hardware: All Linux
Target Milestone: rc
: ---
Assignee: Laszlo Ersek
QA Contact: Virtualization Bugs
Depends On: 717434
Blocks: 514491
TreeView+ depends on / blocked
Reported: 2010-06-15 14:57 UTC by Gianni Tedesco
Modified: 2013-01-08 04:10 UTC (History)
10 users (show)

Fixed In Version: kernel-2.6.18-325.el5
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2013-01-08 04:10:41 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
Patch to xen.c which marks read-only virtual block devices as CD-ROM's. (3.64 KB, patch)
2010-06-15 14:57 UTC, Gianni Tedesco
no flags Details | Diff
[1/1] add the CDROM_GET_CAPABILITY ioctl to blkfront (629 bytes, patch)
2012-07-02 16:14 UTC, Laszlo Ersek
no flags Details | Diff
test program, to be run in PV guest (1.78 KB, text/x-c)
2012-07-02 16:44 UTC, Laszlo Ersek
no flags Details
test program, to be run in PV guest (v2) (1.78 KB, text/x-c)
2012-07-02 20:38 UTC, Laszlo Ersek
no flags Details

External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2013:0006 normal SHIPPED_LIVE Red Hat Enterprise Linux 5.9 kernel update 2013-01-08 08:48:56 UTC

Description Gianni Tedesco 2010-06-15 14:57:24 UTC
Created attachment 424179 [details]
Patch to xen.c which marks read-only virtual block devices as CD-ROM's.

Install RHEL5 from DVD image on a xen virtual machine. The problem is caused by kudzu not differentiating between xenblk devices representing CD-ROM's or hard-disks. Attached patch fixes the issue.

Comment 1 Bill Nottingham 2010-06-15 19:40:23 UTC
Seems like a bit of a stretch that any and all r/o block devices are CD-ROMs. Aren't they distinguished any other way?

Comment 2 Gianni Tedesco 2010-06-16 10:40:35 UTC
I couldn't agree more. However since the RHEL5.x kernels are rather old they are in need of the patch: http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=440a01a7f46742400c74d9d346118523e81d188b so that xen devices implement the relevant CD-ROM ioctls. Without this patch there is no other way to distinguish them AFAIK. I assume that a corresponding kernel ABI change to make kudzu work properly wouldn't be acceptable? The attached patch ought to be sufficient to allow a xen CD-ROM install to work with minimal side-effects for other use-cases...

If the corresponding kernel change is OK, then I can re-work the patch to do things "the right way" (tm).

Comment 3 Bill Nottingham 2011-08-16 16:28:07 UTC
Apologies for the delay - moving to kernel.

Comment 6 Laszlo Ersek 2012-07-02 15:51:12 UTC
-  208:d2bd9af846b5
- 1036:f5635e334aa5
- 1098:73e47d0fdb10

Comment 7 Laszlo Ersek 2012-07-02 16:14:16 UTC
Created attachment 595765 [details]
[1/1] add the CDROM_GET_CAPABILITY ioctl to blkfront

Backport of the following two linux-2.6.18-xen.hg commits:

  changeset:   208:d2bd9af846b5
  user:        Christian Limpach <Christian.Limpach@xensource.com>
  date:        Tue Sep 11 16:38:13 2007 +0100
  files:       drivers/xen/blkfront/blkfront.c
  Add the CDROM_GET_CAPABILITY ioctl to blkfront.
  Return 0 instead of -EINVAL if the blkfront device is a cdrom,
  i.e. had the VDISK_CDROM attribute.  This allows udev's cdrom_id
  to correctly detect the device as a cdrom device.
  Signed-off-by: Christian Limpach <Christian.Limpach@xensource.com>

  (Changeset 1036:f5635e334aa5 moved around the declaration of "info".)

  changeset:   1098:73e47d0fdb10
  user:        Jan Beulich <jbeulich@novell.com>
  date:        Fri Jul 08 13:23:47 2011 +0100
  files:       drivers/xen/blkfront/blkfront.c
  blkfront: avoid NULL de-reference in CDROM ioctl handling

  Just like already done in the default case, for CDROM_GET_CAPABILITY
  info->gd should not be blindly de-referenced, as the ioctl can be
  called prior to full device setup having completed.

  Signed-off-by: Jan Beulich <jbeulich@novell.com>
 drivers/xen/blkfront/blkfront.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

Comment 8 Laszlo Ersek 2012-07-02 16:44:46 UTC
Created attachment 595770 [details]
test program, to be run in PV guest

Comment 9 RHEL Product and Program Management 2012-07-02 17:08:53 UTC
This request was evaluated by Red Hat Product Management for
inclusion in a Red Hat Enterprise Linux release.  Product
Management has requested further review of this request by
Red Hat Engineering, for potential inclusion in a Red Hat
Enterprise Linux release for currently deployed products.
This request is not yet committed for inclusion in a release.

Comment 12 Laszlo Ersek 2012-07-02 20:38:31 UTC
Created attachment 595806 [details]
test program, to be run in PV guest (v2)

fixed compile instruction in leading comment (bogus "-std=c99 -ansi")

Comment 13 Laszlo Ersek 2012-07-02 22:58:50 UTC
Test results on dell-pe1950-07.lab.bos.redhat.com:
- host hv/kernel: 2.6.18-308.el5xen (RHEL-5.8)
- Sean Waite from eng-ops inserted a readable CD-ROM
- RHEL-5 x86_64 PV guest config:

  disk = [ "tap:aio:/var/lib/xen/images/rhel5pv.img,xvda,w",
           "phy:/dev/cdrom,xvdb,r" ]

- guest kernel: 2.6.18-322.el5xen x86_64

  [root@dhcp47-141 ~]# ./checkcd /dev/xvdb
  checkcd: ioctl("/dev/xvdb"): Invalid argument

  /dev/xvdb can otherwise be mounted and read.

- guest kernel: 2.6.18-322.el5.bz604181_cdromxen x86_64

  [root@dhcp47-141 ~]# ./checkcd /dev/xvdb
  checkcd: capabilities for "/dev/xvdb": 0x00000000

  /dev/xvdb can be mounted and read.

Comment 19 Phillip Lougher 2012-07-19 13:18:17 UTC
Patch(es) available in kernel-2.6.18-330.el5
You can download this test kernel (or newer) from http://people.redhat.com/plougher/el5/
Detailed testing feedback is always welcomed.
If you require guidance regarding testing, please ask the bug assignee.

Comment 21 Deng Dewei 2012-10-09 10:17:00 UTC
Verified with kernel-xen 2.6.18-342.el5.(reproduced it in guest with kernel-xen-2.6.18-322.el5 previously to confirm the steps)
 - host kernel: 2.6.18-342.el5xen (RHEL-5.9)
 - guest kernel: 2.6.18-342.el5xen x86_64

1. inserted a readable CD-ROM in host
2. create a pv guest.
   RHEL-5 x86_64 PV guest config:
3. in guest, run the test program in comment 12

   [root@localhost ~]# ./checkcd /dev/xvdb
    checkcd: capabilities for "/dev/xvdb": 0x00000000
/dev/xvdb can be mounted and read.

Comment 23 errata-xmlrpc 2013-01-08 04:10:41 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.


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