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 959428 - create a nodedev for scsi-generic
Summary: create a nodedev for scsi-generic
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.0
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: John Ferlan
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks: 957292
TreeView+ depends on / blocked
 
Reported: 2013-05-03 13:00 UTC by Paolo Bonzini
Modified: 2014-06-18 00:50 UTC (History)
11 users (show)

Fixed In Version: libvirt-1.1.0-1.el7
Doc Type: Bug Fix
Doc Text:
Clone Of: 957292
Environment:
Last Closed: 2014-06-13 09:39:45 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Paolo Bonzini 2013-05-03 13:00:21 UTC
Right now, disks have a nodedev entry:

<device>
  <name>block_sda_ST9160411AS_5TG11QWL</name>
  <parent>scsi_0_0_0_0</parent>
  <capability type='storage'>
    <block>/dev/sda</block>
    <bus>ata</bus>
    <drive_type>disk</drive_type>
    <model>ST9160411AS</model>
    <vendor>ATA</vendor>
    <serial>ST9160411AS_5TG11QWL</serial>
    <size>160041885696</size>
    <logical_block_size>512</logical_block_size>
    <num_blocks>312581808</num_blocks>
  </capability>
</device>


However, the corresponding /dev/sg0 file is not enumerated in nodedev.  In the above example, scsi_0_0_0_0 should have another entry for scsi-generic.  Here is the udev entr:

$ udevadm info --query=all --name=/dev/sg0
P: /devices/pci0000:00/0000:00:1f.2/ata1/host0/target0:0:0/0:0:0:0/scsi_generic/sg0
N: sg0
E: DEVNAME=/dev/sg0
E: DEVPATH=/devices/pci0000:00/0000:00:1f.2/ata1/host0/target0:0:0/0:0:0:0/scsi_generic/sg0
E: MAJOR=21
E: MINOR=0
E: SUBSYSTEM=scsi_generic

So the XML should simply look like this:

<device>
  <name>scsi_generic_sg0</name>
  <parent>scsi_0_0_0_0</parent>
  <capability type='scsi-generic'>
    <char>/dev/sg0</char>
  </capability>
</device>

Comment 1 Daniel Berrangé 2013-05-03 13:03:31 UTC
We support multiple capabilities per device, so it might make more sense to just list the 'scsi-generic' capability under the existing device, rather than create a new device.

Comment 6 Osier Yang 2013-06-03 10:06:39 UTC
Patch posted upstream:

https://www.redhat.com/archives/libvir-list/2013-June/msg00014.html

Comment 7 Osier Yang 2013-06-18 09:37:38 UTC
(In reply to Osier Yang from comment #6)
> Patch posted upstream:
> 
> https://www.redhat.com/archives/libvir-list/2013-June/msg00014.html

patches committed into upstream, move to POST.

Comment 8 Hu Jianwei 2013-07-03 02:05:27 UTC
Reproduced with libvirt-1.0.6-1.el7.x86_64.

Verified with the packages:
libvirt-1.1.0-1.el7.x86_64
qemu-kvm-1.5.1-1.el7.x86_64

Test steps:

1. list all scsi nodes
[root@hujianweitest ~]# virsh nodedev-list --tree
computer
  |
...
 +- pci_0000_00_1f_2
  |   |
  |   +- scsi_host0
  |   |   |
  |   |   +- scsi_target0_0_0
  |   |       |
  |   |       +- scsi_0_0_0_0
  |   |           |
  |   |           +- block_sda_ST500DM002_1BD142_W2AEK0DF
  |   |           +- scsi_generic_sg0                   <===scsi-generic
  |   |             
  |   +- scsi_host1
  |   +- scsi_host2
  |   |   |
  |   |   +- scsi_target2_0_0
  |   |       |
  |   |       +- scsi_2_0_0_0
  |   |           |
  |   |           +- block_sr0_hp_DVD_RAM_GH82N_228CD038950
  |   |           +- scsi_generic_sg1                  <===scsi-generic
  |   |             
...

2. Dump the scsi generic device

2.1 Check the first scsi device:
[root@hujianweitest ~]# virsh nodedev-dumpxml scsi_generic_sg0
<device>
  <name>scsi_generic_sg0</name>
  <path>/sys/devices/pci0000:00/0000:00:1f.2/ata1/host0/target0:0:0/0:0:0:0/scsi_generic/sg0</path>
  <parent>scsi_0_0_0_0</parent>
  <capability type='scsi_generic'>
    <char>/dev/sg0</char>
  </capability>
</device>

The dump info is correct under comparing with below command
[root@hujianweitest ~]# udevadm info --query=all --name=/dev/sg0
P: /devices/pci0000:00/0000:00:1f.2/ata1/host0/target0:0:0/0:0:0:0/scsi_generic/sg0
N: sg0
E: DEVNAME=/dev/sg0
E: DEVPATH=/devices/pci0000:00/0000:00:1f.2/ata1/host0/target0:0:0/0:0:0:0/scsi_generic/sg0
E: MAJOR=21
E: MINOR=0
E: SUBSYSTEM=scsi_generic

2.2 Check the second scsi device:
[root@hujianweitest ~]# virsh nodedev-dumpxml scsi_generic_sg1
<device>
  <name>scsi_generic_sg1</name>
  <path>/sys/devices/pci0000:00/0000:00:1f.2/ata3/host2/target2:0:0/2:0:0:0/scsi_generic/sg1</path>
  <parent>scsi_2_0_0_0</parent>
  <capability type='scsi_generic'>
    <char>/dev/sg1</char>
  </capability>
</device>

[root@hujianweitest ~]# udevadm info --query=all --name=/dev/sg1
P: /devices/pci0000:00/0000:00:1f.2/ata3/host2/target2:0:0/2:0:0:0/scsi_generic/sg1
N: sg1
E: DEVNAME=/dev/sg1
E: DEVPATH=/devices/pci0000:00/0000:00:1f.2/ata3/host2/target2:0:0/2:0:0:0/scsi_generic/sg1
E: MAJOR=21
E: MINOR=1
E: SUBSYSTEM=scsi_generic
E: TAGS=:seat:uaccess:
E: USEC_INITIALIZED=988405

3. Checked the scsi disk and DVD can dump correct info after supporting the scsi generic.
[root@hujianweitest ~]# virsh nodedev-dumpxml block_sda_ST500DM002_1BD142_W2AEK0DF
<device>
  <name>block_sda_ST500DM002_1BD142_W2AEK0DF</name>
  <path>/sys/devices/pci0000:00/0000:00:1f.2/ata1/host0/target0:0:0/0:0:0:0/block/sda</path>
  <parent>scsi_0_0_0_0</parent>
  <capability type='storage'>
    <block>/dev/sda</block>
    <bus>ata</bus>
    <drive_type>disk</drive_type>
    <model>ST500DM002-1BD14</model>
    <vendor>ATA</vendor>
    <serial>ST500DM002-1BD142_W2AEK0DF</serial>
    <size>500107862016</size>
    <logical_block_size>512</logical_block_size>
    <num_blocks>976773168</num_blocks>
  </capability>
</device>


[root@hujianweitest ~]# virsh nodedev-dumpxml block_sr0_hp_DVD_RAM_GH82N_228CD038950
<device>
  <name>block_sr0_hp_DVD_RAM_GH82N_228CD038950</name>
  <path>/sys/devices/pci0000:00/0000:00:1f.2/ata3/host2/target2:0:0/2:0:0:0/block/sr0</path>
  <parent>scsi_2_0_0_0</parent>
  <capability type='storage'>
    <block>/dev/sr0</block>
    <bus>ata</bus>
    <drive_type>cdrom</drive_type>
    <model>DVD-RAM GH82N</model>
    <vendor>hp</vendor>
    <serial>hp_DVD-RAM_GH82N_228CD038950</serial>
    <capability type='removable'>
      <media_available>0</media_available>
      <media_size>0</media_size>
    </capability>
  </capability>
</device>

We can get expected results, setting to verified.

Comment 10 Ludek Smid 2014-06-13 09:39:45 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.


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