Class: LvSegment

Inherits:
Object
  • Object
show all
Defined in:
lib/VolumeManager/LVM/lv_segment.rb

Overview

One object of this class for each segment in a logical volume.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(startExtent = 0, extentCount = 0, type = nil, stripeCount = 0, deviceId = nil) ⇒ LvSegment

Returns a new instance of LvSegment.



13
14
15
16
17
18
19
20
21
# File 'lib/VolumeManager/LVM/lv_segment.rb', line 13

def initialize(startExtent = 0, extentCount = 0, type = nil, stripeCount = 0, deviceId=nil)
  @startExtent = startExtent.to_i     # the first logical extent of this segment
  @extentCount = extentCount.to_i     # the number of logical extents in this segment
  @type = type                        # the type of segment
  @stripeCount = stripeCount.to_i     # the number of stripes in this segment(1 = linear)

  @stripes = []                # <pvName, startPhysicalExtent> pairs for each stripe.
  @device_id = deviceId
end

Instance Attribute Details

#data_volumeObject

Returns the value of attribute data_volume.



11
12
13
# File 'lib/VolumeManager/LVM/lv_segment.rb', line 11

def data_volume
  @data_volume
end

#device_idObject

set for thin segments



7
8
9
# File 'lib/VolumeManager/LVM/lv_segment.rb', line 7

def device_id
  @device_id
end

#extentCountObject

Returns the value of attribute extentCount.



5
6
7
# File 'lib/VolumeManager/LVM/lv_segment.rb', line 5

def extentCount
  @extentCount
end

#metadataObject

set for thin pool segments



9
10
11
# File 'lib/VolumeManager/LVM/lv_segment.rb', line 9

def 
  @metadata
end

#metadata_volumeObject

Returns the value of attribute metadata_volume.



11
12
13
# File 'lib/VolumeManager/LVM/lv_segment.rb', line 11

def 
  @metadata_volume
end

#poolObject

set for thin pool segments



9
10
11
# File 'lib/VolumeManager/LVM/lv_segment.rb', line 9

def pool
  @pool
end

#startExtentObject

Returns the value of attribute startExtent.



5
6
7
# File 'lib/VolumeManager/LVM/lv_segment.rb', line 5

def startExtent
  @startExtent
end

#stripeCountObject

Returns the value of attribute stripeCount.



5
6
7
# File 'lib/VolumeManager/LVM/lv_segment.rb', line 5

def stripeCount
  @stripeCount
end

#stripesObject

Returns the value of attribute stripes.



5
6
7
# File 'lib/VolumeManager/LVM/lv_segment.rb', line 5

def stripes
  @stripes
end

#thin_poolObject

set for thin segments



7
8
9
# File 'lib/VolumeManager/LVM/lv_segment.rb', line 7

def thin_pool
  @thin_pool
end

#thin_pool_volumeObject

Returns the value of attribute thin_pool_volume.



11
12
13
# File 'lib/VolumeManager/LVM/lv_segment.rb', line 11

def thin_pool_volume
  @thin_pool_volume
end

#typeObject

Returns the value of attribute type.



5
6
7
# File 'lib/VolumeManager/LVM/lv_segment.rb', line 5

def type
  @type
end

Instance Method Details

#set_data_volume(lvs) ⇒ Object



35
36
37
# File 'lib/VolumeManager/LVM/lv_segment.rb', line 35

def set_data_volume(lvs)
  @data_volume = lvs.find { |lv| lv.lvName == pool }
end

#set_metadata_volume(lvs) ⇒ Object



31
32
33
# File 'lib/VolumeManager/LVM/lv_segment.rb', line 31

def (lvs)
  @metadata_volume = lvs.find { |lv| lv.lvName ==  }
end

#set_thin_pool_volume(lvs) ⇒ Object



39
40
41
# File 'lib/VolumeManager/LVM/lv_segment.rb', line 39

def set_thin_pool_volume(lvs)
  @thin_pool_volume = lvs.find { |lv| lv.lvName == thin_pool }
end

#thin?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/VolumeManager/LVM/lv_segment.rb', line 23

def thin?
  type == 'thin'
end

#thin_pool?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/VolumeManager/LVM/lv_segment.rb', line 27

def thin_pool?
  type == 'thin-pool'
end