Comment 2 for bug 1370226

Revision history for this message
Daniel Berrange (berrange) wrote :

So the _get_host_device method in both these iSCSI drivers really needs to die as is.

The filenames in /dev/disk/by-path/* are entirely at the whim of udev rules and so we shouldn't rely on being able to match on specific patterns. The correct way to identify paths is to follow the symlinks from sysfs

eg determine the SCSI address N:N:N:N, and use that to lookup in sysfs

eg /sys/class/scsi_device/1:0:0:0/device/block

In that directory is a file giving the device name "sdb", which lets us know it is /dev/sdb.

Now you can look in /dev/disk/by-path/* and identify which symlink targets /dev/sdb, and thus have the stable path for the device.