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 974910 - the default IDE cdrom device will disappear when attach a emulated SCSI cdrom(scsi-cd)
Summary: the default IDE cdrom device will disappear when attach a emulated SCSI cdrom...
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: qemu-kvm
Version: 7.0
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: rc
: ---
Assignee: Paolo Bonzini
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks: 841379 895959
TreeView+ depends on / blocked
 
Reported: 2013-06-17 06:23 UTC by Sibiao Luo
Modified: 2014-06-18 12:23 UTC (History)
13 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-11-21 15:05:09 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Screen-shot for Emulated SCSI cdrom (19.56 KB, image/png)
2013-06-17 06:26 UTC, Sibiao Luo
no flags Details
Screen-shot for Passthrough SCSI cdrom (20.21 KB, image/png)
2013-06-17 06:26 UTC, Sibiao Luo
no flags Details

Description Sibiao Luo 2013-06-17 06:23:27 UTC
Description of problem:
boot guest without '-nodefaults' and attach a emulated SCSI cdrom, the IDE cdrom device will disappear, but if attach a passthrough SCSI cdrom, the IDE cdrom is still there, both passthrough and IDE cdrom device can be listed in boot menu.

Version-Release number of selected component (if applicable):
host info:
3.10.0-0.rc5.61.el7.x86_64
qemu-kvm-1.5.0-2.el7.x86_64
guest info:
3.10.0-0.rc5.61.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1.boot guest without '-nodefaults' and attach a passthrough SCSI cdrom.
e.g:# /usr/libexec/qemu-kvm -cpu host -M pc-i440fx-1.5 -enable-kvm -S -m 4G -smp 4,sockets=2,cores=2,threads=1...-drive file=/dev/sr0,if=none,id=drive-cd-disk,format=raw,media=cdrom,readonly=on,cache=none,aio=native,werror=stop,rerror=stop -device virtio-scsi-pci,vectors=0,bus=pci.0,addr=0x7,id=scsi1 -device scsi-block,drive=drive-cd-disk,id=cd-disk,bus=scsi1.0,bootindex=3
q
2.press F12 during POST and check the boot menu list and block info var HMP monitor.
(qemu) info block
3.boot guest without '-nodefaults' and attach a emulated SCSI cdrom.
e.g:# /usr/libexec/qemu-kvm -cpu host -M pc-i440fx-1.5 -enable-kvm -S -m 4G -smp 4,sockets=2,cores=2,threads=1...-drive file=/home/en_windows_8_enterprise_x86_dvd_917587.iso,if=none,id=drive-cd-disk,format=raw,media=cdrom,readonly=on,cache=none,aio=native,werror=stop,rerror=stop -device virtio-scsi-pci,vectors=0,bus=pci.0,addr=0x7,id=scsi1 -device scsi-cd,drive=drive-cd-disk,id=cd-disk,bus=scsi1.0,bootindex=3
4.press F12 during POST and check the boot menu list and block info var HMP monitor.
(qemu) info block

Actual results:
after step 2, there is a 'ide1-cd0' device for IDE cdrom and both passthrough and IDE cdrom device can be listed in boot menu.
(qemu) info block
drive-system-disk: removable=0 io-status=ok file=/home/RHEL-7.0-20130606.0-Server-x86_64.qcow3 ro=0 drv=qcow2 encrypted=0 bps=0 bps_rd=0 bps_wr=0 iops=0 iops_rd=0 iops_wr=0
drive-cd-disk: removable=1 locked=0 tray-open=0 io-status=ok file=/dev/sr0 ro=1 drv=raw encrypted=0 bps=0 bps_rd=0 bps_wr=0 iops=0 iops_rd=0 iops_wr=0
ide1-cd0: removable=1 locked=0 tray-open=0 io-status=ok [not inserted]
floppy0: removable=1 locked=0 tray-open=0 [not inserted]
sd0: removable=1 locked=0 tray-open=0 [not inserted]
(qemu) info pci
  Bus  0, device   0, function 0:
    Host bridge: PCI device 8086:1237
      id ""
  Bus  0, device   1, function 0:
    ISA bridge: PCI device 8086:7000
      id ""
  Bus  0, device   1, function 1:
    IDE controller: PCI device 8086:7010
      BAR4: I/O at 0xffffffffffffffff [0x000e].
      id ""
  Bus  0, device   1, function 2:
    USB controller: PCI device 8086:7020
      IRQ 0.
      BAR4: I/O at 0xffffffffffffffff [0x001e].
      id ""
  Bus  0, device   1, function 3:
    Bridge: PCI device 8086:7113
      IRQ 0.
      id ""
  Bus  0, device   2, function 0:
    VGA controller: PCI device 1013:00b8
      BAR0: 32 bit prefetchable memory at 0xffffffffffffffff [0x01fffffe].
      BAR1: 32 bit memory at 0xffffffffffffffff [0x00000ffe].
      BAR6: 32 bit memory at 0xffffffffffffffff [0x0000fffe].
      id ""
  Bus  0, device   3, function 0:
    Class 1920: PCI device 1af4:1003
      IRQ 0.
      BAR0: I/O at 0xffffffffffffffff [0x001e].
      id "virtio-serial0"
  Bus  0, device   4, function 0:
    SCSI controller: PCI device 1af4:1004
      IRQ 0.
      BAR0: I/O at 0xffffffffffffffff [0x003e].
      BAR1: 32 bit memory at 0xffffffffffffffff [0x00000ffe].
      id "scsi"
  Bus  0, device   5, function 0:
    Ethernet controller: PCI device 8086:100e
      IRQ 0.
      BAR0: 32 bit memory at 0xffffffffffffffff [0x0001fffe].
      BAR1: I/O at 0xffffffffffffffff [0x003e].
      BAR6: 32 bit memory at 0xffffffffffffffff [0x0003fffe].
      id "e1000-net-pci0"
  Bus  0, device   6, function 0:
    Class 0255: PCI device 1af4:1002
      IRQ 0.
      BAR0: I/O at 0xffffffffffffffff [0x001e].
      id "ballooning"
  Bus  0, device   7, function 0:
    SCSI controller: PCI device 1af4:1004
      IRQ 0.
      BAR0: I/O at 0xffffffffffffffff [0x003e].
      id "scsi1"
after step 4, there is no 'ide1-cd0' device for IDE cdrom and only a passthrough  cdrom device was listed in boot menu. I will attach the screen-shot latar.
(qemu) info block
drive-system-disk: removable=0 io-status=ok file=/home/RHEL-7.0-20130606.0-Server-x86_64.qcow3 ro=0 drv=qcow2 encrypted=0 bps=0 bps_rd=0 bps_wr=0 iops=0 iops_rd=0 iops_wr=0
drive-cd-disk: removable=1 locked=0 tray-open=0 io-status=ok file=/home/en_windows_8_enterprise_x86_dvd_917587.iso ro=1 drv=raw encrypted=0 bps=0 bps_rd=0 bps_wr=0 iops=0 iops_rd=0 iops_wr=0
floppy0: removable=1 locked=0 tray-open=0 [not inserted]
sd0: removable=1 locked=0 tray-open=0 [not inserted]
(qemu) info pci
  Bus  0, device   0, function 0:
    Host bridge: PCI device 8086:1237
      id ""
  Bus  0, device   1, function 0:
    ISA bridge: PCI device 8086:7000
      id ""
  Bus  0, device   1, function 1:
    IDE controller: PCI device 8086:7010
      BAR4: I/O at 0xffffffffffffffff [0x000e].
      id ""
  Bus  0, device   1, function 2:
    USB controller: PCI device 8086:7020
      IRQ 0.
      BAR4: I/O at 0xffffffffffffffff [0x001e].
      id ""
  Bus  0, device   1, function 3:
    Bridge: PCI device 8086:7113
      IRQ 0.
      id ""
  Bus  0, device   2, function 0:
    VGA controller: PCI device 1013:00b8
      BAR0: 32 bit prefetchable memory at 0xffffffffffffffff [0x01fffffe].
      BAR1: 32 bit memory at 0xffffffffffffffff [0x00000ffe].
      BAR6: 32 bit memory at 0xffffffffffffffff [0x0000fffe].
      id ""
  Bus  0, device   3, function 0:
    Class 1920: PCI device 1af4:1003
      IRQ 0.
      BAR0: I/O at 0xffffffffffffffff [0x001e].
      id "virtio-serial0"
  Bus  0, device   4, function 0:
    SCSI controller: PCI device 1af4:1004
      IRQ 0.
      BAR0: I/O at 0xffffffffffffffff [0x003e].
      BAR1: 32 bit memory at 0xffffffffffffffff [0x00000ffe].
      id "scsi"
  Bus  0, device   5, function 0:
    Ethernet controller: PCI device 8086:100e
      IRQ 0.
      BAR0: 32 bit memory at 0xffffffffffffffff [0x0001fffe].
      BAR1: I/O at 0xffffffffffffffff [0x003e].
      BAR6: 32 bit memory at 0xffffffffffffffff [0x0003fffe].
      id "e1000-net-pci0"
  Bus  0, device   6, function 0:
    Class 0255: PCI device 1af4:1002
      IRQ 0.
      BAR0: I/O at 0xffffffffffffffff [0x001e].
      id "ballooning"
  Bus  0, device   7, function 0:
    SCSI controller: PCI device 1af4:1004
      IRQ 0.
      BAR0: I/O at 0xffffffffffffffff [0x003e].
      id "scsi1"
Expected results:
after step 4, there should have 'ide1-cd0' device for IDE cdrom, both passthrough and IDE cdrom device can be listed in boot menu.

Additional info:

Comment 1 Sibiao Luo 2013-06-17 06:26:06 UTC
Created attachment 761926 [details]
Screen-shot for Emulated SCSI cdrom

Comment 2 Sibiao Luo 2013-06-17 06:26:36 UTC
Created attachment 761927 [details]
Screen-shot for Passthrough SCSI cdrom

Comment 3 Sibiao Luo 2013-10-19 11:31:36 UTC
Also tried rhel6.5 host that did have no such issue.
e.g:...-drive file=/home/cdrom1.iso,if=none,id=cd-rom1,media=cdrom,format=raw,readonly=on -device virtio-scsi-pci,id=sluo1 -device scsi-cd,drive=cd-rom1,id=cd1,bus=sluo1.0 -drive file=/home/cdrom2.iso,if=none,id=cd-rom2,media=cdrom,format=raw,readonly=on -device virtio-scsi-pci,id=sluo2 -device scsi-cd,bus=sluo2.0,drive=cd-rom2,id=cd2
(qemu) info block
drive-virtio-disk: removable=0 io-status=ok file=/home/RHEL6.5-RHEL6.5-20131009.0_Server_x86_64.qcow2 ro=0 drv=qcow2 encrypted=0
cd-rom1: removable=1 locked=0 tray-open=0 io-status=ok file=/home/cdrom1.iso ro=1 drv=raw encrypted=0
cd-rom2: removable=1 locked=0 tray-open=0 io-status=ok file=/home/cdrom2.iso ro=1 drv=raw encrypted=0
ide1-cd0: removable=1 locked=0 tray-open=0 io-status=ok [not inserted] <---------
floppy0: removable=1 locked=0 tray-open=0 [not inserted]
sd0: removable=1 locked=0 tray-open=0 [not inserted]

Best Regards,
sluo

Comment 5 Paolo Bonzini 2013-11-21 15:05:09 UTC
Markus, help. :)

The bug is that this command line:

/usr/libexec/qemu-kvm -drive if=none,id=cd,file=/path/to/image.iso \
 -device virtio-scsi-pci -device scsi-cd,drive=cd

does not create an IDE CD, while this:

/usr/libexec/qemu-kvm -drive if=none,id=cd,file=/dev/sr0 \
 -device virtio-scsi-pci -device scsi-block,drive=cd

does.  We do not support passthrough CD anymore, so I'm going to close this as NOTABUG.  Nevertheless, the bug is interesting from an upstream point of view.

I'm not sure why scsi-cd was added to default_list but other SCSI devices were not:

    { .driver = "ide-cd",               .flag = &default_cdrom     },
    { .driver = "ide-hd",               .flag = &default_cdrom     },
    { .driver = "ide-drive",            .flag = &default_cdrom     },
    { .driver = "scsi-cd",              .flag = &default_cdrom     },

I'm inclined to zap scsi-cd altogether from the list.  What do you think?

Comment 6 Markus Armbruster 2013-11-22 09:32:16 UTC
A bit of history.

Before -device, the only way to define block devices was -drive and
its sugared forms.

The default drives were unconditionally defined, after the user's
drives.  If there were multiple definitions for the same drive, the
first definition won, subsequent ones were silently ignored[*].

The default drives were:

* The default CD-ROM: index=2,media=cdrom
* The default floppy: index=0,if=floppy
* The default SD card: index=0,if=sd

Note the default CD-ROM does not specify if=...  Defaults to the
machine's preferred interface, either "ide", or "scsi".

Thus, a user's -drive if=X,index=2,... suppressed the default CD-ROM,
regardless of whether the user's drive was a CD-ROM or not.  Where X
was the machine's preferred interface.

The default drives are created whether the board uses them or not.

-device completely bypasses this default-suppressing logic, so new
logic had to be added (without it, the user's -device clashes with the
defaults instead of overriding them).  Commit d8bcbab did it for
default CD-ROM and floppy: *any* use of -device or -global with
ide-drive or isa-fdc suppresses the default CD-ROM or floppy,
respectively.

Note:

* ide-drive suppresses the default CD-ROM *always*, not just when it's
  connected to bus 1 master (index=2).  Sledgehammer.

* ide-drive suppresses even when the machine prefers SCSI.  Mitigating
  factor: such machines tend not to use IDE.

* scsi-disk was forgotten.  -device scsi-disk,scsi_id=2 clashes with
  the default CD-ROM when the machine prefers SCSI (inference; I
  didn't actually try).

* There's no logic for -device suppressing the default SD card,
  because the SD card device hasn't been qdevified.

Later on, we split qdev ide-drive into ide-hd and ide-cd (commit
1f56e32), and scsi-disk into scsi-hd and scsi-cd (commit b443ae6).
Commit af6bf132 updated the default suppression for the split: it made
the new ide-hd and ide-cd suppress just like ide-drive, for backward
compatibility.  It also added scsi-cd, but I can't remember the exact
rationale.

I suspect dropping scsi-cd can break working command lines for
machines preferring SCSI.  I don't personally care for such machines,
and I always use -nodefaults anyway.

In my opinion, the way we create default drives is bonkers, and should
be rewritten from scratch.


[*] Yes, that's not nice.  It's been fixed.


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