Module: Ext4Probe

Defined in:
lib/fs/MiqFS/modules/Ext4Probe.rb

Class Method Summary collapse

Class Method Details

.probe(dobj) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/fs/MiqFS/modules/Ext4Probe.rb', line 4

def self.probe(dobj)
  unless dobj.kind_of?(MiqDisk)
    $log&.debug("Ext4Probe << FALSE because Disk Object class is not MiqDisk, but is '#{dobj.class}'")
    return false
  end

  dobj.seek(0, IO::SEEK_SET)
  Ext4::Superblock.new(dobj)

  # If initializing the superblock does not throw any errors, then this is Ext4
  $log&.debug("Ext4Probe << TRUE")
  return true
rescue => err
  $log&.debug("Ext4Probe << FALSE because #{err.message}")
  return false
ensure
  dobj.seek(0, IO::SEEK_SET)
end