Sha256: b578cea64b5eafabb284a0dfbf0a80aa530cd2e648de449cd7b7e39e4c925e0e

Contents?: true

Size: 1.81 KB

Versions: 67

Compression:

Stored size: 1.81 KB

Contents

require 'disk/MiqDisk'

#
# One object of this class for each logical volume.
#
class LogicalVolume
  attr_accessor :lvId, :lvName, :segmentCount, :segments, :status, :vgObj, :lvPath, :driveHint

  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

  # will raise exception if LogicalVolume is not thin metadata volume
  def superblock
    @superblock ||= Lvm2Thin::SuperBlock.get self
  end

   # MiqDisk object for volume
  def disk
    @disk ||= begin
      dInfo = OpenStruct.new
      dInfo.lvObj = self
      dInfo.hardwareId = ""
      MiqDisk.new(Lvm2DiskIO, dInfo, 0)
    end
  end

  def thin_segments
    @thin_segments ||= segments.select { |segment| segment.thin? }
  end

  def thin_segment
    thin_segments.first
  end

  def thin?
    !thin_segments.empty?
  end

  def thin_pool_volume
    return nil unless thin?
    return thin_segment.thin_pool_volume
  end

  def thin_pool_segments
    @thin_pool_segments ||= segments.select { |segment| segment.thin_pool? }
  end

  def thin_pool_segment
    thin_pool_segments.first
  end

  def thin_pool?
    !thin_pool_segments.empty?
  end

  def metadata_volume
    thin_pool_segment.metadata_volume
  end

  def data_volume
    thin_pool_segment.data_volume
  end
end # class LogicalVolume

Version data entries

67 entries across 67 versions & 1 rubygems

Version Path
manageiq-smartstate-0.11.0 lib/VolumeManager/LVM/logical_volume.rb
manageiq-smartstate-0.10.1 lib/VolumeManager/LVM/logical_volume.rb
manageiq-smartstate-0.10.0 lib/VolumeManager/LVM/logical_volume.rb
manageiq-smartstate-0.9.0 lib/VolumeManager/LVM/logical_volume.rb
manageiq-smartstate-0.8.1 lib/VolumeManager/LVM/logical_volume.rb
manageiq-smartstate-0.8.0 lib/VolumeManager/LVM/logical_volume.rb
manageiq-smartstate-0.7.0 lib/VolumeManager/LVM/logical_volume.rb
manageiq-smartstate-0.6.2 lib/VolumeManager/LVM/logical_volume.rb
manageiq-smartstate-0.5.10 lib/VolumeManager/LVM/logical_volume.rb
manageiq-smartstate-0.3.10 lib/VolumeManager/LVM/logical_volume.rb
manageiq-smartstate-0.6.1 lib/VolumeManager/LVM/logical_volume.rb
manageiq-smartstate-0.3.9 lib/VolumeManager/LVM/logical_volume.rb
manageiq-smartstate-0.6.0 lib/VolumeManager/LVM/logical_volume.rb
manageiq-smartstate-0.5.9 lib/VolumeManager/LVM/logical_volume.rb
manageiq-smartstate-0.5.8 lib/VolumeManager/LVM/logical_volume.rb
manageiq-smartstate-0.3.8 lib/VolumeManager/LVM/logical_volume.rb
manageiq-smartstate-0.5.7 lib/VolumeManager/LVM/logical_volume.rb
manageiq-smartstate-0.3.7 lib/VolumeManager/LVM/logical_volume.rb
manageiq-smartstate-0.5.6 lib/VolumeManager/LVM/logical_volume.rb
manageiq-smartstate-0.3.6 lib/VolumeManager/LVM/logical_volume.rb