Class: Xen::VolumeGroup
- Inherits:
-
Object
- Object
- Xen::VolumeGroup
- Defined in:
- lib/xen/lvm.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#size ⇒ Object
readonly
Returns the value of attribute size.
Class Method Summary collapse
Instance Method Summary collapse
- #free ⇒ Object
-
#initialize(name, size) ⇒ VolumeGroup
constructor
A new instance of VolumeGroup.
Constructor Details
#initialize(name, size) ⇒ VolumeGroup
Returns a new instance of VolumeGroup.
9 10 11 12 |
# File 'lib/xen/lvm.rb', line 9 def initialize(name, size) @name = name @size = size end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'lib/xen/lvm.rb', line 7 def name @name end |
#size ⇒ Object (readonly)
Returns the value of attribute size.
7 8 9 |
# File 'lib/xen/lvm.rb', line 7 def size @size end |
Class Method Details
.find(name = nil) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/xen/lvm.rb', line 14 def self.find(name=nil) name ||= nil # XXX deal with not found error cmd = "vgs --options=vg_name,vg_size --separator=' ' --noheadings --units=g --nosuffix #{name}" begin output = Xen::Command.run cmd result = output.collect { |line| name, size = line.strip.split(' ') new name, size } rescue # don't die if `vgs` command missing end name ? result[0] : result end |