Class: Virt::Pool
Overview
implements Libvirt pool, at the moment it is assumed to be a file based pool.
Instance Attribute Summary collapse
-
#name ⇒ Object
(also: #to_s)
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #create_vol(vol) ⇒ Object
-
#initialize(options = {}) ⇒ Pool
constructor
A new instance of Pool.
- #new? ⇒ Boolean
- #path ⇒ Object
- #save ⇒ Object
- #volumes ⇒ Object
Methods included from Util
Constructor Details
#initialize(options = {}) ⇒ Pool
Returns 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
#name ⇒ Object (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
#create_vol(vol) ⇒ Object
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 |
#new? ⇒ Boolean
18 19 20 |
# File 'lib/virt/pool.rb', line 18 def new? @pool.nil? end |
#path ⇒ Object
35 36 37 |
# File 'lib/virt/pool.rb', line 35 def path document "pool/target/path" end |
#save ⇒ Object
14 15 16 |
# File 'lib/virt/pool.rb', line 14 def save raise "not implemented" end |
#volumes ⇒ Object
22 23 24 |
# File 'lib/virt/pool.rb', line 22 def volumes @pool.list_volumes end |