Class: LVM::PhysicalVolumes

Inherits:
Object
  • Object
show all
Includes:
Enumerable, Volumes, Wrapper
Defined in:
lib/lvm/physical_volumes.rb

Instance Method Summary collapse

Methods included from Volumes

#[], #to_s

Constructor Details

#initialize(options) ⇒ PhysicalVolumes

Returns a new instance of PhysicalVolumes.



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

def initialize(options)
  @pvs = PVS.new(options)
  @pvsseg = PVSSEG.new(options)
end

Instance Method Details

#eachObject

Gather all information about physical volumes.

See VolumeGroups.each for a better representation of LVM data.



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/lvm/physical_volumes.rb', line 20

def each 
  pvs = @pvs.list
  pvsseg = @pvsseg.list 

  pvs.each do |pv|
    pv.segments ||= []
    pvsseg.each do |pvseg|
      if pvseg.pv_uuid == pv.uuid 
        pv.segments << pvseg
      end
    end
  end

  return pvs.each {|p| yield p}
end