Removed -cciss-* tail from /dev/disk/by-path links

It is to address the issue which appears when centos
udev names smart array devices like this
/dev/disk/by-path/pci-0000:06:00.0-cciss-disk0
and debian-installer udev names them like this
/dev/disk/by-path/pci-0000:06:00.0 and can not
find device.

Change-Id: I052ae1839b49f4abbd12f44582d53923e0836411
This commit is contained in:
Vladimir Kozhukalov 2014-01-31 14:32:00 +04:00
parent 3cb58b52d7
commit 04f17482e9
1 changed files with 7 additions and 0 deletions

View File

@ -255,6 +255,13 @@ class NodeAgent
def _disk_path_by_name(name)
dn = "/dev/disk/by-path"
basepath = Dir["#{dn}/**?"].find{|f| /\/#{name}$/.match(File.readlink(f))}
# It is to address the issue which appears when centos
# udev names smart array devices like this
# /dev/disk/by-path/pci-0000:06:00.0-cciss-disk0
# and debian-installer udev names them like this
# /dev/disk/by-path/pci-0000:06:00.0 and can not
# find device.
basepath.sub!(/-cciss-.+/, '')
basepath.split("/")[2..-1].join("/") if basepath
end