Class: PackerFiles::Core::LogicalVolume

Inherits:
Base
  • Object
show all
Includes:
Utils::Size
Defined in:
lib/PackerFiles/Core/LogicalVolume.rb

Overview

Abstraction for Logical Volume

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Utils::Size

#Bytes, #MiB

Methods inherited from Base

doc_file

Constructor Details

#initialize {|_self| ... } ⇒ LogicalVolume

Constructor to just specify accessor varibales

Yields:

  • (_self)

Yield Parameters:



24
25
26
27
# File 'lib/PackerFiles/Core/LogicalVolume.rb', line 24

def initialize
  @size         = 0
  yield self if block_given?
end

Instance Attribute Details

#file_systemObject

Returns the value of attribute file_system.



19
20
21
# File 'lib/PackerFiles/Core/LogicalVolume.rb', line 19

def file_system
  @file_system
end

#mount_pointObject

Returns the value of attribute mount_point.



18
19
20
# File 'lib/PackerFiles/Core/LogicalVolume.rb', line 18

def mount_point
  @mount_point
end

#nameObject

Returns the value of attribute name.



20
21
22
# File 'lib/PackerFiles/Core/LogicalVolume.rb', line 20

def name
  @name
end

#sizeObject

Specify attributes



17
18
19
# File 'lib/PackerFiles/Core/LogicalVolume.rb', line 17

def size
  @size
end

#vg_nameObject

Returns the value of attribute vg_name.



21
22
23
# File 'lib/PackerFiles/Core/LogicalVolume.rb', line 21

def vg_name
  @vg_name
end

Instance Method Details

#normalizeObject

Normalize the values

Raises:



30
31
32
33
34
35
# File 'lib/PackerFiles/Core/LogicalVolume.rb', line 30

def normalize
  raise NilException.new(self, 'name')    if @name.nil?
  raise NilException.new(self, 'vg_name') if @vg_name.nil?
  raise 'size cannot be zero'             if @size == 0
  @size = MiB(@size) 
end