Class: LVM::Wrapper::VGS

Inherits:
Object
  • Object
show all
Includes:
Reporting
Defined in:
lib/lvm/wrapper/vgs.rb

Constant Summary collapse

BASE_COMMAND =
"vgs #{Reporting::BASE_ARGUMENTS}"
ATTRIBUTES_FILE =
'vgs.yaml'
PERMISSIONS =

vg_attr attribute handling constants roughly by order referenced in lib/report/report.c:360 (_vgstatus_disp)

{
  'w' => :writeable,
  'r' => :readonly,
}
RESIZEABLE =
{
  # code says its a boolean
  'z' => true 
}
EXPORTED =
{
  # code says its a boolean
  'x' => true
}
PARTIAL =
{
  # code says its a boolean
  'p' => true
}
ALLOCATION_POLICY =
{
  'c' => :contiguous,
  'l' => :cling,
  'n' => :normal,
  'a' => :anywhere,
  'i' => :inherited,
  'C' => :contiguous_locked,
  'L' => :cling_locked,
  'N' => :normal_locked,
  'A' => :anywhere_locked,
  'I' => :inherited_locked
}
CLUSTERED =
{
  # code says its a boolean
  'c' => true
}

Constants included from Reporting::Constants

Reporting::Constants::BASE_ARGUMENTS, Reporting::Constants::EMPTY, Reporting::Constants::SEPERATOR

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Reporting

build_command, process_line

Constructor Details

#initialize(options) ⇒ VGS

Returns a new instance of VGS.



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

def initialize(options)
  @attributes = Attributes.load(options[:version], ATTRIBUTES_FILE)
  @command = "#{options[:command]} #{Reporting.build_command(attributes, BASE_COMMAND)}"
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



9
10
11
# File 'lib/lvm/wrapper/vgs.rb', line 9

def attributes
  @attributes
end

#commandObject (readonly)

Returns the value of attribute command.



10
11
12
# File 'lib/lvm/wrapper/vgs.rb', line 10

def command
  @command
end

Instance Method Details

#listObject



56
57
58
59
60
61
62
63
64
# File 'lib/lvm/wrapper/vgs.rb', line 56

def list
  output = External.cmd(@command)
  data = parse(output)
  if block_given?
    return data.each { |obj| yield obj }
  else
    return data
  end
end