Skip to content

Commit

Permalink
fix nvme format for oly2 hosts with non-t10dix drives
Browse files Browse the repository at this point in the history
Differential Revision: D65310133

fbshipit-source-id: 9a09f6073a189cbdb407ffec3115fc06bffc710c
  • Loading branch information
Kumar Amit authored and facebook-github-bot committed Nov 5, 2024
1 parent 615eca2 commit 7255b25
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions cookbooks/fb_storage/libraries/storage.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1383,6 +1383,25 @@ def self.get_t10dix_lbaf(device)
end
end

def self.get_non_t10dix_lbaf(device)
nsid_out = Mixlib::ShellOut.new("nvme id-ns #{device} -ojson").run_command
nsid_out.error!
nsid_json = JSON.parse(nsid_out.stdout)

# Details about output of the nvme id-ns command and it's associated structures/sub-structures can be found here:
# https://manpages.ubuntu.com/manpages/oracular/en/man2/nvme_id_ns.2.html
# More details about the bitmask values used can be bound here:
# https://github.com/torvalds/linux/blob/master/include/linux/nvme.h

# Find LBA format with data size 2^12 = 4KB
lbaf = nsid_json['lbafs'].find_index { |item| item['ds'] == 12 }

if !lbaf.nil?
return lbaf
end
return -1
end

def self.t10dix_enabled?(device)
nsid_out = Mixlib::ShellOut.new("nvme id-ns #{device} -ojson").run_command
nsid_out.error!
Expand Down

0 comments on commit 7255b25

Please sign in to comment.