Class: Nifty::Backends::Utils::Opennebula::DatastoreHandler
- Defined in:
- lib/nifty/backends/utils/opennebula/datastore_handler.rb
Overview
Handler for OpenNebula DatastorePool
Constant Summary
Constants inherited from Handler
Handler::API_POLLING_WAIT, Handler::ATTRIBUTE_APPLIANCE_ID, Handler::LEAVE_AS_IS, Handler::ONEADMIN_ID, Handler::OWNER_OCTET
Instance Attribute Summary
Attributes inherited from Handler
Instance Method Summary collapse
-
#datastores(names) ⇒ Array
Returns list of datastores matching the names If there is no datastore with given name, it’s skipped.
-
#initialize(client) ⇒ DatastoreHandler
constructor
Constructor.
Methods inherited from Handler
Constructor Details
#initialize(client) ⇒ DatastoreHandler
Constructor
9 10 11 12 |
# File 'lib/nifty/backends/utils/opennebula/datastore_handler.rb', line 9 def initialize(client) super(client) @pool = OpenNebula::DatastorePool.new(client) end |
Instance Method Details
#datastores(names) ⇒ Array
Returns list of datastores matching the names If there is no datastore with given name, it’s skipped.
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/nifty/backends/utils/opennebula/datastore_handler.rb', line 19 def datastores(names) reload! datastores = [] names.each do |name| datastore = pool.find { |ds| ds.name == name } unless datastore logger.warn("Datastore #{name.inspect} was not found, skipping.") next end datastores << datastore end datastores end |