Bug 959428
| Summary: | create a nodedev for scsi-generic | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 7 | Reporter: | Paolo Bonzini <pbonzini> |
| Component: | libvirt | Assignee: | John Ferlan <jferlan> |
| Status: | CLOSED CURRENTRELEASE | QA Contact: | Virtualization Bugs <virt-bugs> |
| Severity: | unspecified | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | 7.0 | CC: | acathrow, berrange, cwei, dallan, dyuan, honzhang, jiahu, mzhan, pbonzini, weizhan, ydu |
| Target Milestone: | rc | ||
| Target Release: | --- | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | libvirt-1.1.0-1.el7 | Doc Type: | Bug Fix |
| Doc Text: | Story Points: | --- | |
| Clone Of: | 957292 | Environment: | |
| Last Closed: | 2014-06-13 09:39:45 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
| Bug Depends On: | |||
| Bug Blocks: | 957292 | ||
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. Patch posted upstream: https://www.redhat.com/archives/libvir-list/2013-June/msg00014.html (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. 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.
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. |
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>