From fab7aedb0ceee9b5faab521fd771bed167ff9b94 Mon Sep 17 00:00:00 2001 From: Sergei Iudin Date: Wed, 30 Oct 2024 08:50:51 -0700 Subject: [PATCH] T22 initial provisioning Differential Revision: D64848754 fbshipit-source-id: 66b93ecbec6bac2eaee82bc901c1fcab08b96176 --- cookbooks/fb_storage/attributes/default.rb | 2 ++ cookbooks/fb_storage/libraries/storage.rb | 10 +++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/cookbooks/fb_storage/attributes/default.rb b/cookbooks/fb_storage/attributes/default.rb index 1176a711..ecd2b00a 100644 --- a/cookbooks/fb_storage/attributes/default.rb +++ b/cookbooks/fb_storage/attributes/default.rb @@ -49,4 +49,6 @@ ], '_clowntown_device_order_method' => nil, '_clowntown_override_file_method' => nil, + '_skip_persistency' => [], + '_skip_extra_devices' => [], } diff --git a/cookbooks/fb_storage/libraries/storage.rb b/cookbooks/fb_storage/libraries/storage.rb index ccc83fb8..213e4aba 100644 --- a/cookbooks/fb_storage/libraries/storage.rb +++ b/cookbooks/fb_storage/libraries/storage.rb @@ -182,8 +182,12 @@ def self.eligible_devices(node) # Legacy. We should probably fail hard here return [] if devices_to_skip.length.zero? + non_eligle = ['ram', 'loop', 'dm-', 'sr', 'md'] + if node&.dig('fb_storage', '_skip_extra_devices') + non_eligle += node['fb_storage']['_skip_extra_devices'] + end node['block_device'].to_hash.reject do |x, _y| - ['ram', 'loop', 'dm-', 'sr', 'md'].include?(x.delete('0-9')) || + non_eligle.include?(x.delete('0-9')) || devices_to_skip.include?(x) end.keys end @@ -494,6 +498,10 @@ def self.gen_persistent_disk_data(disks) Dir.open(DEV_ID_DIR).each do |entry| next if %w{. ..}.include?(entry) + if ::Chef.node&.dig('fb_storage', '_skip_persistency') + next if ::Chef.node['fb_storage']['_skip_persistency'].any? { |element| entry.include?(element) } + end + p = "#{DEV_ID_DIR}/#{entry}" id_map[File.basename(File.readlink(p))] = entry end