Browse Source

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
Alexander Gordeev 3 years ago
parent
commit
73877c75b0
1 changed files with 4 additions and 2 deletions
  1. 4
    2
      agent

+ 4
- 2
agent View File

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

Loading…
Cancel
Save