Class: LVM::VGConfig
- Inherits:
-
Object
- Object
- LVM::VGConfig
- Defined in:
- lib/lvm/vg_config.rb
Instance Method Summary collapse
- #description ⇒ Object
-
#initialize(vg_name, opts = {}) ⇒ VGConfig
constructor
A new instance of VGConfig.
- #logical_volumes ⇒ Object
- #physical_volumes ⇒ Object
- #uuid ⇒ Object
- #version ⇒ Object
- #volume_group ⇒ Object
Constructor Details
#initialize(vg_name, opts = {}) ⇒ VGConfig
Returns a new instance of VGConfig.
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/lvm/vg_config.rb', line 16 def initialize(vg_name, opts = {}) @vgcfgbackup_cmd = opts[:vgcfgbackup_command] || 'vgcfgbackup' @vg_name = vg_name @parser = VgCfgBackupParser.new @root = @parser.parse(vgcfgbackup_output) if @root.nil? raise RuntimeError, "Cannot parse vgcfgbackup output: #{@parser.failure_reason}" end end |
Instance Method Details
#description ⇒ Object
31 32 33 |
# File 'lib/lvm/vg_config.rb', line 31 def description @description ||= @root.variable_value('description') end |
#logical_volumes ⇒ Object
47 48 49 |
# File 'lib/lvm/vg_config.rb', line 47 def logical_volumes @logical_volumes ||= volume_group.groups['logical_volumes'].groups.to_a.inject({}) { |h,v| h[v[0]] = LVM::LVConfig.new(v[1], v[0], self); h } end |
#physical_volumes ⇒ Object
43 44 45 |
# File 'lib/lvm/vg_config.rb', line 43 def physical_volumes @physical_volumes ||= volume_group.groups['physical_volumes'].groups.to_a.inject({}) { |h,v| h[v[0]] = LVM::PVConfig.new(v[1]); h } end |
#uuid ⇒ Object
35 36 37 |
# File 'lib/lvm/vg_config.rb', line 35 def uuid @uuid ||= volume_group.variable_value('id') end |
#version ⇒ Object
27 28 29 |
# File 'lib/lvm/vg_config.rb', line 27 def version @version ||= @root.variable_value('version') end |
#volume_group ⇒ Object
39 40 41 |
# File 'lib/lvm/vg_config.rb', line 39 def volume_group @volume_group ||= @root.groups[@vg_name] end |