Class: LVM::LVConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/lvm/lv_config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(tree, name, vgcfg) ⇒ LVConfig

Returns a new instance of LVConfig.



6
7
8
9
10
# File 'lib/lvm/lv_config.rb', line 6

def initialize(tree, name, vgcfg)
  @root = tree
  @name = name
  @vgcfg = vgcfg
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



4
5
6
# File 'lib/lvm/lv_config.rb', line 4

def name
  @name
end

Instance Method Details

#chunk_sizeObject



36
37
38
# File 'lib/lvm/lv_config.rb', line 36

def chunk_size
  @root.groups['segment1'].variable_value('chunk_size') * 512
end

#cow_storeObject



32
33
34
# File 'lib/lvm/lv_config.rb', line 32

def cow_store
  @root.groups['segment1'].variable_value('cow_store')
end

#device_idObject



24
25
26
# File 'lib/lvm/lv_config.rb', line 24

def device_id
  @root.groups['segment1'].variable_value('device_id')
end

#originObject



28
29
30
# File 'lib/lvm/lv_config.rb', line 28

def origin
  @root.groups['segment1'].variable_value('origin')
end

#snapshot?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/lvm/lv_config.rb', line 16

def snapshot?
  thin? ? !origin.nil? : !@vgcfg.logical_volumes.values.find { |lv| lv.cow_store == name }.nil?
end

#thin?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/lvm/lv_config.rb', line 12

def thin?
  @root.groups['segment1'].variable_value('type') == 'thin'
end

#thin_poolObject



20
21
22
# File 'lib/lvm/lv_config.rb', line 20

def thin_pool
  @root.groups['segment1'].variable_value('thin_pool')
end