Exclude USB block devices by the default

All USB storage devices must be filtered by the default as often this
type of devices can be just an emulated temprorary storage for FW
upgrade and so on.

If one wants to get usb block devices reported to nailgun, then
it could be either a cmdline option report_usb_block_devices or
the same option added to the agent' config file.

DocImpact
Change-Id: Id609715732fd0ab393d1557b4810464fbfaf096e
Closes-Bug: #1543221
This commit is contained in:
Alexander Gordeev 2016-02-12 18:09:19 +03:00
parent bc56d1c476
commit 73877c75b0
1 changed files with 4 additions and 2 deletions

6
agent
View File

@ -714,14 +714,16 @@ class NodeAgent
if STORAGE_CODES.include?(properties['MAJOR'].to_i) if STORAGE_CODES.include?(properties['MAJOR'].to_i)
@logger.debug("Device #{devname} seems to be appropriate") @logger.debug("Device #{devname} seems to be appropriate")
# Exclude LVM volumes (in CentOS - 253, in Ubuntu - 252) using additional check # Exclude LVM volumes (in CentOS - 253, in Ubuntu - 252) using additional check
unless properties['DEVPATH'].include?('virtual/block/dm') # Exclude any storage device connected through USB by the default
next if properties['DEVPATH'].include?('virtual/block/dm') ||
(properties['ID_BUS'] == 'usb' &&
!@settings.has_key?("report_usb_block_devices"))
@blocks << { @blocks << {
:name => basename_dir, :name => basename_dir,
:disk => _disk_path_by_name(devname) || devname, :disk => _disk_path_by_name(devname) || devname,
:extra => _disk_id_by_name(devname) || [], :extra => _disk_id_by_name(devname) || [],
:removable => removable, :removable => removable,
} }
end
end end
end end
@logger.debug("Final list of physical devices is: #{@blocks.inspect}") @logger.debug("Final list of physical devices is: #{@blocks.inspect}")