Module: Ext3Probe

Defined in:
lib/fs/MiqFS/modules/Ext3Probe.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/Ext3Probe.rb', line 4

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

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

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