Skip to content

Commit

Permalink
T22 initial provisioning
Browse files Browse the repository at this point in the history
Differential Revision: D64848754

fbshipit-source-id: 66b93ecbec6bac2eaee82bc901c1fcab08b96176
  • Loading branch information
Sergei Iudin authored and facebook-github-bot committed Oct 30, 2024
1 parent 9e169b0 commit fab7aed
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 2 additions & 0 deletions cookbooks/fb_storage/attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,6 @@
],
'_clowntown_device_order_method' => nil,
'_clowntown_override_file_method' => nil,
'_skip_persistency' => [],
'_skip_extra_devices' => [],
}
10 changes: 9 additions & 1 deletion cookbooks/fb_storage/libraries/storage.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit fab7aed

Please sign in to comment.