Class: LVM::VolumeGroups

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

Instance Method Summary collapse

Methods included from Volumes

#[], #to_s

Constructor Details

#initialize(options) ⇒ VolumeGroups

Returns a new instance of VolumeGroups.



13
14
15
16
17
# File 'lib/lvm/volume_groups.rb', line 13

def initialize(options)
  @vgs = VGS.new(options)
  @pvs = PhysicalVolumes.new(options)
  @lvs = LogicalVolumes.new(options)
end

Instance Method Details

#eachObject

Gather all information about volume groups and their underlying logical and physical volumes.

This is the best representation of LVM data.



23
24
25
26
27
28
29
30
31
32
33
# File 'lib/lvm/volume_groups.rb', line 23

def each
  vgs = @vgs.list
  lvs = @lvs.list
  pvs = @pvs.list

  vgs.each do |vg|
    vg.logical_volumes  = lvs.select { |lv| lv.vg_uuid == vg.uuid }
    vg.physical_volumes = pvs.select { |pv| pv.vg_uuid == vg.uuid }
    yield vg
  end
end

#listObject



35
36
37
# File 'lib/lvm/volume_groups.rb', line 35

def list
  each {}
end