class PackerFiles::Core::VolumeGroup

Volume Group abstracts out LVM.

Attributes

disk_names[RW]
lvs[RW]
name[RW]

Specify attributes

Public Class Methods

new() { |self| ... } click to toggle source

Constructor to just specify accessor varibales

# File lib/PackerFiles/Core/VolumeGroup.rb, line 19
def initialize
  @disk_names = []
  @lvs        = []
  yield self if block_given?
end

Public Instance Methods

LogicalVolume(&block) click to toggle source

Adds a Logical volume on this disk by doing an instance-eval

# File lib/PackerFiles/Core/VolumeGroup.rb, line 26
def LogicalVolume(&block)
   if block_given?
     lv = LogicalVolume.new
     lv.instance_eval &block
     lv.name = 'lv' + @lvs.size.to_s if (lv.name.nil?)
     @lvs.push(lv)
   end
end
normalize() click to toggle source

Normalize the various values into something useful

# File lib/PackerFiles/Core/VolumeGroup.rb, line 36
def normalize
   raise 'name is nil'         if @name.nil?
   raise 'Disk names is empty' if @disk_names.empty?
   raise 'LVs is empty'        if @lvs.empty?
   @lvs.each {|lv| 
      lv.vg_name= @name
      lv.normalize
   }
end