Class: LogicalVolume
- Inherits:
-
Object
- Object
- LogicalVolume
- Defined in:
- lib/VolumeManager/LVM/logical_volume.rb
Overview
One object of this class for each logical volume.
Instance Attribute Summary collapse
-
#driveHint ⇒ Object
Returns the value of attribute driveHint.
-
#lvId ⇒ Object
Returns the value of attribute lvId.
-
#lvName ⇒ Object
Returns the value of attribute lvName.
-
#lvPath ⇒ Object
Returns the value of attribute lvPath.
-
#segmentCount ⇒ Object
Returns the value of attribute segmentCount.
-
#segments ⇒ Object
Returns the value of attribute segments.
-
#status ⇒ Object
Returns the value of attribute status.
-
#vgObj ⇒ Object
Returns the value of attribute vgObj.
Instance Method Summary collapse
- #data_volume ⇒ Object
-
#disk ⇒ Object
MiqDisk object for volume.
-
#initialize(lvId = nil, lvName = nil, segmentCount = 0) ⇒ LogicalVolume
constructor
A new instance of LogicalVolume.
- #metadata_volume ⇒ Object
-
#superblock ⇒ Object
will raise exception if LogicalVolume is not thin metadata volume.
- #thin? ⇒ Boolean
- #thin_pool? ⇒ Boolean
- #thin_pool_segment ⇒ Object
- #thin_pool_segments ⇒ Object
- #thin_pool_volume ⇒ Object
- #thin_segment ⇒ Object
- #thin_segments ⇒ Object
Constructor Details
#initialize(lvId = nil, lvName = nil, segmentCount = 0) ⇒ LogicalVolume
Returns a new instance of LogicalVolume.
9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/VolumeManager/LVM/logical_volume.rb', line 9 def initialize(lvId = nil, lvName = nil, segmentCount = 0) @lvId = lvId # the UUID of this logical volume @lvName = lvName # the logical volume's name @lvPath = nil # native use only @segmentCount = segmentCount.to_i # the number of segments in this LV @driveHint = nil # Drive hint, for windows @segments = [] # array of this LV's LvSegment objects @status = [] @vgObj = nil # a reference to this LV's volume group @superblock = nil # thin metadata superblock (if this is a thin metadata volume) end |
Instance Attribute Details
#driveHint ⇒ Object
Returns the value of attribute driveHint.
7 8 9 |
# File 'lib/VolumeManager/LVM/logical_volume.rb', line 7 def driveHint @driveHint end |
#lvId ⇒ Object
Returns the value of attribute lvId.
7 8 9 |
# File 'lib/VolumeManager/LVM/logical_volume.rb', line 7 def lvId @lvId end |
#lvName ⇒ Object
Returns the value of attribute lvName.
7 8 9 |
# File 'lib/VolumeManager/LVM/logical_volume.rb', line 7 def lvName @lvName end |
#lvPath ⇒ Object
Returns the value of attribute lvPath.
7 8 9 |
# File 'lib/VolumeManager/LVM/logical_volume.rb', line 7 def lvPath @lvPath end |
#segmentCount ⇒ Object
Returns the value of attribute segmentCount.
7 8 9 |
# File 'lib/VolumeManager/LVM/logical_volume.rb', line 7 def segmentCount @segmentCount end |
#segments ⇒ Object
Returns the value of attribute segments.
7 8 9 |
# File 'lib/VolumeManager/LVM/logical_volume.rb', line 7 def segments @segments end |
#status ⇒ Object
Returns the value of attribute status.
7 8 9 |
# File 'lib/VolumeManager/LVM/logical_volume.rb', line 7 def status @status end |
#vgObj ⇒ Object
Returns the value of attribute vgObj.
7 8 9 |
# File 'lib/VolumeManager/LVM/logical_volume.rb', line 7 def vgObj @vgObj end |
Instance Method Details
#data_volume ⇒ Object
71 72 73 |
# File 'lib/VolumeManager/LVM/logical_volume.rb', line 71 def data_volume thin_pool_segment.data_volume end |
#disk ⇒ Object
MiqDisk object for volume
29 30 31 32 33 34 35 36 |
# File 'lib/VolumeManager/LVM/logical_volume.rb', line 29 def disk @disk ||= begin dInfo = OpenStruct.new dInfo.lvObj = self dInfo.hardwareId = "" MiqDisk.new(Lvm2DiskIO, dInfo, 0) end end |
#metadata_volume ⇒ Object
67 68 69 |
# File 'lib/VolumeManager/LVM/logical_volume.rb', line 67 def thin_pool_segment. end |
#superblock ⇒ Object
will raise exception if LogicalVolume is not thin metadata volume
24 25 26 |
# File 'lib/VolumeManager/LVM/logical_volume.rb', line 24 def superblock @superblock ||= Lvm2Thin::SuperBlock.get self end |
#thin? ⇒ Boolean
46 47 48 |
# File 'lib/VolumeManager/LVM/logical_volume.rb', line 46 def thin? !thin_segments.empty? end |
#thin_pool? ⇒ Boolean
63 64 65 |
# File 'lib/VolumeManager/LVM/logical_volume.rb', line 63 def thin_pool? !thin_pool_segments.empty? end |
#thin_pool_segment ⇒ Object
59 60 61 |
# File 'lib/VolumeManager/LVM/logical_volume.rb', line 59 def thin_pool_segment thin_pool_segments.first end |
#thin_pool_segments ⇒ Object
55 56 57 |
# File 'lib/VolumeManager/LVM/logical_volume.rb', line 55 def thin_pool_segments @thin_pool_segments ||= segments.select { |segment| segment.thin_pool? } end |
#thin_pool_volume ⇒ Object
50 51 52 53 |
# File 'lib/VolumeManager/LVM/logical_volume.rb', line 50 def thin_pool_volume return nil unless thin? return thin_segment.thin_pool_volume end |
#thin_segment ⇒ Object
42 43 44 |
# File 'lib/VolumeManager/LVM/logical_volume.rb', line 42 def thin_segment thin_segments.first end |
#thin_segments ⇒ Object
38 39 40 |
# File 'lib/VolumeManager/LVM/logical_volume.rb', line 38 def thin_segments @thin_segments ||= segments.select { |segment| segment.thin? } end |