Class: LVM::Wrapper::PVS

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

Constant Summary collapse

BASE_COMMAND =
"pvs #{Reporting::BASE_ARGUMENTS}"
ATTRIBUTES_FILE =
'pvs.yaml'
ALLOCATABLE =

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

{
  # code says its a boolean
  'a' => true 
}
EXPORTED =
{
  # code says its a boolean
  'x' => 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) ⇒ PVS

Returns a new instance of PVS.



12
13
14
15
# File 'lib/lvm/wrapper/pvs.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/pvs.rb', line 9

def attributes
  @attributes
end

#commandObject (readonly)

Returns the value of attribute command.



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

def command
  @command
end

Instance Method Details

#listObject



32
33
34
35
36
37
38
39
40
# File 'lib/lvm/wrapper/pvs.rb', line 32

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