Class: LinuxAdmin::PhysicalVolume
- Defined in:
- lib/linux_admin/physical_volume.rb
Instance Attribute Summary collapse
-
#device_name ⇒ Object
physical volume device name.
-
#size ⇒ Object
physical volume size in kilobytes.
-
#volume_group ⇒ Object
volume group name.
Class Method Summary collapse
-
.create(device) ⇒ Object
specify disk or partition instance to create physical volume on.
- .scan ⇒ Object
Instance Method Summary collapse
- #attach_to(vg) ⇒ Object
-
#initialize(args = {}) ⇒ PhysicalVolume
constructor
other fields available internal physical volume number (obsolete) physical volume status physical volume (not) allocatable current number of logical volumes on this physical volume physical extent size in kilobytes total number of physical extents free number of physical extents allocated number of physical extents.
Constructor Details
#initialize(args = {}) ⇒ PhysicalVolume
other fields available internal physical volume number (obsolete) physical volume status physical volume (not) allocatable current number of logical volumes on this physical volume physical extent size in kilobytes total number of physical extents free number of physical extents allocated number of physical extents
22 23 24 25 26 |
# File 'lib/linux_admin/physical_volume.rb', line 22 def initialize(args = {}) @device_name = args[:device_name] @volume_group = args[:volume_group] @size = args[:size] end |
Instance Attribute Details
#device_name ⇒ Object
physical volume device name
4 5 6 |
# File 'lib/linux_admin/physical_volume.rb', line 4 def device_name @device_name end |
#size ⇒ Object
physical volume size in kilobytes
10 11 12 |
# File 'lib/linux_admin/physical_volume.rb', line 10 def size @size end |
#volume_group ⇒ Object
volume group name
7 8 9 |
# File 'lib/linux_admin/physical_volume.rb', line 7 def volume_group @volume_group end |
Class Method Details
.create(device) ⇒ Object
specify disk or partition instance to create physical volume on
36 37 38 39 40 41 42 43 44 45 |
# File 'lib/linux_admin/physical_volume.rb', line 36 def self.create(device) self.scan # initialize local physical volumes Common.run!(Common.cmd(:pvcreate), :params => { nil => device.path}) pv = PhysicalVolume.new(:device_name => device.path, :volume_group => nil, :size => device.size) @pvs << pv pv end |
.scan ⇒ Object
47 48 49 50 51 52 53 54 55 |
# File 'lib/linux_admin/physical_volume.rb', line 47 def self.scan @pvs ||= begin scan_volumes(Common.cmd(:pvdisplay)) do |fields, vg| PhysicalVolume.new(:device_name => fields[0], :volume_group => vg, :size => fields[2].to_i) end end end |