File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
cookbooks/fb_storage/libraries Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -1383,6 +1383,25 @@ def self.get_t10dix_lbaf(device)
13831383 end
13841384 end
13851385
1386+ def self . get_non_t10dix_lbaf ( device )
1387+ nsid_out = Mixlib ::ShellOut . new ( "nvme id-ns #{ device } -ojson" ) . run_command
1388+ nsid_out . error!
1389+ nsid_json = JSON . parse ( nsid_out . stdout )
1390+
1391+ # Details about output of the nvme id-ns command and it's associated structures/sub-structures can be found here:
1392+ # https://manpages.ubuntu.com/manpages/oracular/en/man2/nvme_id_ns.2.html
1393+ # More details about the bitmask values used can be bound here:
1394+ # https://github.com/torvalds/linux/blob/master/include/linux/nvme.h
1395+
1396+ # Find LBA format with data size 2^12 = 4KB
1397+ lbaf = nsid_json [ 'lbafs' ] . find_index { |item | item [ 'ds' ] == 12 }
1398+
1399+ if !lbaf . nil?
1400+ return lbaf
1401+ end
1402+ return -1
1403+ end
1404+
13861405 def self . t10dix_enabled? ( device )
13871406 nsid_out = Mixlib ::ShellOut . new ( "nvme id-ns #{ device } -ojson" ) . run_command
13881407 nsid_out . error!
You can’t perform that action at this time.
0 commit comments