Class: Fog::Libvirt::Compute::Pool
- Inherits:
-
Model
- Object
- Model
- Fog::Libvirt::Compute::Pool
- Defined in:
- lib/fog/libvirt/models/compute/pool.rb
Instance Attribute Summary collapse
-
#xml ⇒ Object
readonly
Returns the value of attribute xml.
Instance Method Summary collapse
-
#active? ⇒ Boolean
Is the pool active or not?.
-
#auto_start? ⇒ Boolean
Will the pool autostart or not?.
-
#build ⇒ Object
Build this storage pool.
-
#destroy ⇒ Object
Destroys the storage pool.
-
#initialize(attributes = {}) ⇒ Pool
constructor
A new instance of Pool.
-
#persistent? ⇒ Boolean
Is the pool persistent or not?.
- #save ⇒ Object
-
#shutdown ⇒ Object
Shuts down the pool.
-
#start ⇒ Object
Start the pool = make it active Performs a libvirt create (= start).
-
#stop ⇒ Object
Stop the pool = make it non-active Performs a libvirt destroy (= stop).
-
#volumes ⇒ Object
Retrieves the volumes of this pool.
Constructor Details
#initialize(attributes = {}) ⇒ Pool
Returns a new instance of Pool.
20 21 22 23 24 |
# File 'lib/fog/libvirt/models/compute/pool.rb', line 20 def initialize(attributes={} ) # Can be created by passing in XML @xml = attributes.delete(:xml) super(attributes) end |
Instance Attribute Details
#xml ⇒ Object (readonly)
Returns the value of attribute xml.
7 8 9 |
# File 'lib/fog/libvirt/models/compute/pool.rb', line 7 def xml @xml end |
Instance Method Details
#active? ⇒ Boolean
Is the pool active or not?
63 64 65 |
# File 'lib/fog/libvirt/models/compute/pool.rb', line 63 def active? active end |
#auto_start? ⇒ Boolean
Will the pool autostart or not?
68 69 70 |
# File 'lib/fog/libvirt/models/compute/pool.rb', line 68 def auto_start? autostart end |
#build ⇒ Object
Build this storage pool
50 51 52 |
# File 'lib/fog/libvirt/models/compute/pool.rb', line 50 def build service.pool_action uuid, :build end |
#destroy ⇒ Object
Destroys the storage pool
55 56 57 58 59 60 |
# File 'lib/fog/libvirt/models/compute/pool.rb', line 55 def destroy # Shutdown pool if active service.pool_action uuid, :destroy if active? # If this is a persistent domain we need to undefine it service.pool_action uuid, :undefine if persistent? end |
#persistent? ⇒ Boolean
Is the pool persistent or not?
73 74 75 |
# File 'lib/fog/libvirt/models/compute/pool.rb', line 73 def persistent? persistent end |
#save ⇒ Object
26 27 28 29 30 |
# File 'lib/fog/libvirt/models/compute/pool.rb', line 26 def save raise Fog::Errors::Error.new('Creating a new pool requires proper xml') unless xml self.uuid = (persistent ? service.define_pool(xml) : service.create_pool(xml)).uuid reload end |
#shutdown ⇒ Object
Shuts down the pool
45 46 47 |
# File 'lib/fog/libvirt/models/compute/pool.rb', line 45 def shutdown stop end |
#start ⇒ Object
Start the pool = make it active Performs a libvirt create (= start)
34 35 36 |
# File 'lib/fog/libvirt/models/compute/pool.rb', line 34 def start service.pool_action uuid, :create end |
#stop ⇒ Object
Stop the pool = make it non-active Performs a libvirt destroy (= stop)
40 41 42 |
# File 'lib/fog/libvirt/models/compute/pool.rb', line 40 def stop service.pool_action uuid, :destroy end |
#volumes ⇒ Object
Retrieves the volumes of this pool
78 79 80 |
# File 'lib/fog/libvirt/models/compute/pool.rb', line 78 def volumes service.list_pool_volumes uuid end |