Improve support the SCSI disk identification: detect 128 disks instead of 16

Change-Id: Ibc8132efd12ba8e73c6f16fda38b18506c7f21eb
Closes-Bug: #1273086
This commit is contained in:
Vladimir Sharshov 2014-01-29 07:57:26 +04:00
parent 92775fc4e1
commit cf18aa880f
1 changed files with 8 additions and 5 deletions

View File

@ -36,6 +36,12 @@ ENV['PATH'] = "/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin"
AGENT_CONFIG = "/etc/nailgun-agent/config.yaml"
# look at https://github.com/torvalds/linux/blob/master/Documentation/devices.txt
# KVM virtio volumes has code 252 in CentOS, but 253 in Ubuntu
# Please also update the device codes here
# https://github.com/stackforge/fuel-astute/blob/master/mcagents/erase_node.rb#L81
STORAGE_CODES = [3, 8, 65, 66, 67, 68, 69, 70, 71, 104, 105, 106, 107, 108, 109, 110, 111, 202, 252, 253]
class McollectiveConfig
def initialize(logger)
@logger = logger
@ -274,11 +280,8 @@ class NodeAgent
if File.exists?("/sys/block/#{basename_dir}/removable")
removable = File.open("/sys/block/#{basename_dir}/removable"){ |f| f.read_nonblock(1024).strip }
end
# look at https://github.com/torvalds/linux/blob/master/Documentation/devices.txt
# KVM virtio volumes has code 252 in CentOS, but 253 in Ubuntu
# Please also update the device codes here
# https://github.com/stackforge/fuel-astute/blob/master/mcagents/erase_node.rb#L81
if [3, 8, 104, 105, 106, 107, 108, 109, 110, 111, 202, 252, 253].include?(properties['MAJOR'].to_i) && removable =~ /^0$/
if STORAGE_CODES.include?(properties['MAJOR'].to_i) && removable =~ /^0$/
# Exclude LVM volumes (in CentOS - 253, in Ubuntu - 252) using additional check
@blocks << basename_dir unless properties['DEVPATH'].include?('virtual')
end