Class: Virt::Pool
Overview
implements Libvirt pool, at the moment it is assumed to be a file based pool.
Instance Attribute Summary (collapse)
-
- (Object) name
(also: #to_s)
readonly
Returns the value of attribute name.
Instance Method Summary (collapse)
- - (Object) create_vol(vol)
-
- (Pool) initialize(options = {})
constructor
A new instance of Pool.
- - (Boolean) new?
- - (Object) path
- - (Object) save
- - (Object) volumes
Methods included from Util
Constructor Details
- (Pool) initialize(options = {})
A new instance of Pool
6 7 8 9 10 |
# File 'lib/virt/pool.rb', line 6 def initialize = {} @name = [:name] || raise("Must Provide a pool name") @connection = Virt.connection fetch_pool end |
Instance Attribute Details
- (Object) name (readonly) Also known as: to_s
Returns the value of attribute name
5 6 7 |
# File 'lib/virt/pool.rb', line 5 def name @name end |
Instance Method Details
- (Object) create_vol(vol)
39 40 41 42 43 |
# File 'lib/virt/pool.rb', line 39 def create_vol vol raise "Must provide a Virt::Volume object" unless vol.is_a?(Virt::Volume) raise "Pool not saved, cant create volume" if new? @pool.create_vol_xml vol.xml end |
- (Boolean) new?
18 19 20 |
# File 'lib/virt/pool.rb', line 18 def new? @pool.nil? end |
- (Object) path
35 36 37 |
# File 'lib/virt/pool.rb', line 35 def path document "pool/target/path" end |
- (Object) save
14 15 16 |
# File 'lib/virt/pool.rb', line 14 def save raise "not implemented" end |
- (Object) volumes
22 23 24 |
# File 'lib/virt/pool.rb', line 22 def volumes @pool.list_volumes end |