Fix for HP smart array
Entries in /sys/block for cciss look like cciss!c0d1 while the entry in /dev look like /dev/cciss/c0d1. udevadm uses the entry in /dev so we need to replace the ! to get a valid device name. More details here: https://review.openstack.org/#/c/61289/4/bin/agent Change-Id: I0eff17f45aa3fae0eada5b6e77bf63f6e93b61d3
This commit is contained in:
parent
9f0a2a3135
commit
026c379339
@ -84,7 +84,8 @@ module MCollective
|
|||||||
raise "Path /sys/block does not exist" unless File.exists?("/sys/block")
|
raise "Path /sys/block does not exist" unless File.exists?("/sys/block")
|
||||||
Dir["/sys/block/*"].inject([]) do |blocks, block_device_dir|
|
Dir["/sys/block/*"].inject([]) do |blocks, block_device_dir|
|
||||||
basename_dir = File.basename(block_device_dir)
|
basename_dir = File.basename(block_device_dir)
|
||||||
major = `udevadm info --query=property --name=#{basename_dir} | grep MAJOR`.strip.split(/\=/)[-1]
|
dev_name = basename_dir.gsub(/!/, '/')
|
||||||
|
major = `udevadm info --query=property --name=#{dev_name} | grep MAJOR`.strip.split(/\=/)[-1]
|
||||||
if File.exists?("/sys/block/#{basename_dir}/removable")
|
if File.exists?("/sys/block/#{basename_dir}/removable")
|
||||||
removable = File.open("/sys/block/#{basename_dir}/removable") { |f| f.read_nonblock(1024).strip }
|
removable = File.open("/sys/block/#{basename_dir}/removable") { |f| f.read_nonblock(1024).strip }
|
||||||
end
|
end
|
||||||
@ -96,7 +97,7 @@ module MCollective
|
|||||||
end
|
end
|
||||||
|
|
||||||
if STORAGE_CODES.include?(major.to_i) && removable =~ /^0$/
|
if STORAGE_CODES.include?(major.to_i) && removable =~ /^0$/
|
||||||
blocks << {:name => basename_dir, :size => size}
|
blocks << {:name => dev_name, :size => size}
|
||||||
end
|
end
|
||||||
blocks
|
blocks
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user