Class: LinuxAdmin::VolumeGroup
- Inherits:
-
LinuxAdmin
- Object
- LinuxAdmin
- LinuxAdmin::VolumeGroup
- Defined in:
- lib/linux_admin/volume_group.rb
Constant Summary
Constants inherited from LinuxAdmin
Instance Attribute Summary collapse
-
#name ⇒ Object
volume group name.
Class Method Summary collapse
Instance Method Summary collapse
- #attach_to(lv) ⇒ Object
- #extend_with(pv) ⇒ Object
-
#initialize(args = {}) ⇒ VolumeGroup
constructor
other fields available volume group access volume group status internal volume group number maximum number of logical volumes current number of logical volumes open count of all logical volumes in this volume group maximum logical volume size maximum number of physical volumes current number of physical volumes actual number of physical volumes size of volume group in kilobytes physical extent size total number of physical extents for this volume group allocated number of physical extents for this volume group free number of physical extents for this volume group uuid of volume group.
Methods included from Common
Constructor Details
#initialize(args = {}) ⇒ VolumeGroup
other fields available volume group access volume group status internal volume group number maximum number of logical volumes current number of logical volumes open count of all logical volumes in this volume group maximum logical volume size maximum number of physical volumes current number of physical volumes actual number of physical volumes size of volume group in kilobytes physical extent size total number of physical extents for this volume group allocated number of physical extents for this volume group free number of physical extents for this volume group uuid of volume group
29 30 31 |
# File 'lib/linux_admin/volume_group.rb', line 29 def initialize(args = {}) @name = args[:name] end |
Instance Attribute Details
#name ⇒ Object
volume group name
9 10 11 |
# File 'lib/linux_admin/volume_group.rb', line 9 def name @name end |
Class Method Details
.create(name, pv) ⇒ Object
46 47 48 49 50 51 52 53 54 |
# File 'lib/linux_admin/volume_group.rb', line 46 def self.create(name, pv) self.scan # initialize local volume groups run!(cmd(:vgcreate), :params => [name, pv.device_name]) vg = VolumeGroup.new :name => name pv.volume_group = vg @vgs << vg vg end |
.scan ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/linux_admin/volume_group.rb', line 56 def self.scan @vgs ||= begin vgs = [] out = run!(cmd(:vgdisplay), :params => { '-c' => nil}).output out.each_line do |line| fields = line.lstrip.split(':') vgs << VolumeGroup.new(:name => fields[0]) end vgs end end |
Instance Method Details
#attach_to(lv) ⇒ Object
33 34 35 36 37 |
# File 'lib/linux_admin/volume_group.rb', line 33 def attach_to(lv) run!(cmd(:lvextend), :params => [lv.name, self.name]) self end |
#extend_with(pv) ⇒ Object
39 40 41 42 43 44 |
# File 'lib/linux_admin/volume_group.rb', line 39 def extend_with(pv) run!(cmd(:vgextend), :params => [@name, pv.device_name]) pv.volume_group = self self end |