self.block_device_sort

in cookbooks/fb_storage/libraries/storage.rb [241:276]


    def self.block_device_sort(a, b, disk_to_scsi_mapping)
      (atype, ainstance) = block_device_split(File.basename(a))
      (btype, binstance) = block_device_split(File.basename(b))
      if atype == btype
        if atype == 'nvme' && btype == 'nvme'
          Chef::Log.debug(
            'fb_storage: Special nvme sorting',
          )
          
          
          ainstance = ainstance.split('n').map(&:to_i)
          binstance = binstance.split('n').map(&:to_i)
          return ainstance <=> binstance
        end
        Chef::Log.debug(
          'fb_storage: Types are the same, sorting by SCSI',
        )
        r = scsi_device_sort(a, b, disk_to_scsi_mapping)
        
        
        if r.zero?
          Chef::Log.debug(
            'fb_storage: SCSI sort failed, sorting by name',
          )
          return length_alpha(ainstance, binstance)
        else
          return r
        end
      else
        Chef::Log.debug(
          'fb_storage: Types not same sorting by type',
        )
        length_alpha(atype, btype)
      end
    end