Class: Fog::Compute::Libvirt::Pool
- Defined in:
- lib/fog/libvirt/models/compute/pool.rb
Instance Attribute Summary collapse
-
#xml ⇒ Object
readonly
Returns the value of attribute xml.
Attributes inherited from Model
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.
Methods inherited from Model
#inspect, #reload, #symbolize_keys, #to_json, #wait_for
Methods included from Attributes::ClassMethods
#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes
Methods included from Fog::Core::DeprecatedConnectionAccessors
#connection, #connection=, #prepare_service_value
Methods included from Attributes::InstanceMethods
#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #persisted?, #requires, #requires_one
Constructor Details
#initialize(attributes = {}) ⇒ Pool
Returns a new instance of Pool.
21 22 23 24 25 |
# File 'lib/fog/libvirt/models/compute/pool.rb', line 21 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.
8 9 10 |
# File 'lib/fog/libvirt/models/compute/pool.rb', line 8 def xml @xml end |
Instance Method Details
#active? ⇒ Boolean
Is the pool active or not?
64 65 66 |
# File 'lib/fog/libvirt/models/compute/pool.rb', line 64 def active? active end |
#auto_start? ⇒ Boolean
Will the pool autostart or not?
69 70 71 |
# File 'lib/fog/libvirt/models/compute/pool.rb', line 69 def auto_start? autostart end |
#build ⇒ Object
Build this storage pool
51 52 53 |
# File 'lib/fog/libvirt/models/compute/pool.rb', line 51 def build service.pool_action uuid, :build end |
#destroy ⇒ Object
Destroys the storage pool
56 57 58 59 60 61 |
# File 'lib/fog/libvirt/models/compute/pool.rb', line 56 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?
74 75 76 |
# File 'lib/fog/libvirt/models/compute/pool.rb', line 74 def persistent? persistent end |
#save ⇒ Object
27 28 29 30 31 |
# File 'lib/fog/libvirt/models/compute/pool.rb', line 27 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
46 47 48 |
# File 'lib/fog/libvirt/models/compute/pool.rb', line 46 def shutdown stop end |
#start ⇒ Object
Start the pool = make it active Performs a libvirt create (= start)
35 36 37 |
# File 'lib/fog/libvirt/models/compute/pool.rb', line 35 def start service.pool_action uuid, :create end |
#stop ⇒ Object
Stop the pool = make it non-active Performs a libvirt destroy (= stop)
41 42 43 |
# File 'lib/fog/libvirt/models/compute/pool.rb', line 41 def stop service.pool_action uuid, :destroy end |
#volumes ⇒ Object
Retrieves the volumes of this pool
79 80 81 |
# File 'lib/fog/libvirt/models/compute/pool.rb', line 79 def volumes service.list_pool_volumes uuid end |