summaryrefslogtreecommitdiff
path: root/rules/rules.d
diff options
context:
space:
mode:
authorDavid Zeuthen <davidz@redhat.com>2010-11-04 08:55:58 -0400
committerDavid Zeuthen <davidz@redhat.com>2010-11-04 13:29:38 -0400
commit560de575148b7efda3b34a7f7073abd483c5f08e (patch)
tree8a4460dd21725709cae5638d762d9d0564a385a5 /rules/rules.d
parent2938220037862b7698df091a1e5cd45f44132d73 (diff)
Use ata_id, not scsi_id, on ATAPI devices
The major benefit here, is that we get the ATAPI device serial number. With SCSI ID we didn't get this since it's not part of the SCSI INQUIRY command. Specifically this means that we get symlinks to empty optical drives, e.g. /dev/disk/by-id/ata-VBOX_CD-ROM_VB2-01700376 which we didn't get earlier. So this is a major win. Also make ata_id work on CD-ROM devices when using /dev/bsg nodes so this works on both the scsi_device as well as the block device. We do this, basically, by issuing the ATA IDENTIFY PACKET DEVICE command instead of the ATA IDENTIFY command. We also use 16-byte pass-through ATA passthrough instead of 12-byte passthrough to avoid clashing with the MMC BLANK command. This means that we get this output # udevadm info -q all -p /sys/devices/pci0000:00/0000:00:01.1/host3/target3:0:0/3:0:0:0 P: /devices/pci0000:00/0000:00:01.1/host3/target3:0:0/3:0:0:0 E: UDEV_LOG=3 E: DEVPATH=/devices/pci0000:00/0000:00:01.1/host3/target3:0:0/3:0:0:0 E: DEVTYPE=scsi_device E: DRIVER=sr E: MODALIAS=scsi:t-0x05 E: SUBSYSTEM=scsi E: ID_ATA=1 E: ID_TYPE=cd E: ID_BUS=ata E: ID_MODEL=VBOX_CD-ROM E: ID_MODEL_ENC=VBOX\x20CD-ROM\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x 20\x20\x20\x20\x20\x20\x20 E: ID_REVISION=1.0 E: ID_SERIAL=VBOX_CD-ROM_VB2-01700376 E: ID_SERIAL_SHORT=VB2-01700376 instead of just # udevadm info -q all -p /sys/devices/pci0000:00/0000:00:01.1/host3/target3:0:0/3:0:0:0 P: /devices/pci0000:00/0000:00:01.1/host3/target3:0:0/3:0:0:0 E: UDEV_LOG=3 E: DEVPATH=/devices/pci0000:00/0000:00:01.1/host3/target3:0:0/3:0:0:0 E: DEVTYPE=scsi_device E: DRIVER=sr E: MODALIAS=scsi:t-0x05 E: SUBSYSTEM=scsi E: ID_SCSI=1 E: ID_VENDOR=VBOX E: ID_VENDOR_ENC=VBOX\x20\x20\x20\x20 E: ID_MODEL=CD-ROM E: ID_MODEL_ENC=CD-ROM\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20 E: ID_REVISION=1.0 E: ID_TYPE=cd Signed-off-by: David Zeuthen <davidz@redhat.com>
Diffstat (limited to 'rules/rules.d')
-rw-r--r--rules/rules.d/60-persistent-storage.rules4
1 files changed, 4 insertions, 0 deletions
diff --git a/rules/rules.d/60-persistent-storage.rules b/rules/rules.d/60-persistent-storage.rules
index d3f2f73495..8baabc2cf9 100644
--- a/rules/rules.d/60-persistent-storage.rules
+++ b/rules/rules.d/60-persistent-storage.rules
@@ -12,6 +12,8 @@ ACTION=="remove", GOTO="persistent_storage_end"
# run scsi_id and ata_id on the actual SCSI device
SUBSYSTEM=="scsi", ENV{DEVTYPE}=="scsi_device", ENV{ID_SERIAL}!="?*", ATTR{vendor}=="ATA", IMPORT{program}="ata_id --export $root/bsg/$kernel"
+# ATA/ATAPI devices is of type 0x05 and vendor is usually not ATA
+SUBSYSTEM=="scsi", ENV{DEVTYPE}=="scsi_device", ENV{ID_SERIAL}!="?*", ATTR{type}=="5", IMPORT{program}="ata_id --export $root/bsg/$kernel"
SUBSYSTEM=="scsi", ENV{DEVTYPE}=="scsi_device", ENV{ID_SERIAL}!="?*", IMPORT{program}="scsi_id --whitelisted --export --device $root/bsg/$kernel"
# from this point on, only care about block devices
@@ -40,6 +42,8 @@ KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="usb", IMPORT{program
KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="ata", IMPORT{program}="ata_id --export $tempnode"
# ATA devices using the "scsi" subsystem
KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="scsi", ATTRS{vendor}=="ATA", IMPORT{program}="ata_id --export $tempnode"
+# ATA/ATAPI devices using the "scsi" subsystem
+KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="scsi", ATTRS{type}=="5", IMPORT{program}="ata_id --export $tempnode"
# scsi devices
KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", IMPORT{program}="scsi_id --export --whitelisted -d $tempnode", ENV{ID_BUS}="scsi"
KERNEL=="cciss*", ENV{DEVTYPE}=="disk", ENV{ID_SERIAL}!="?*", IMPORT{program}="scsi_id --export --whitelisted -d $tempnode", ENV{ID_BUS}="cciss"