Class: Backends::Opennebula::Base

Inherits:
Object
  • Object
show all
Includes:
Helpers::ExtensionsHelper, Helpers::JsonCollectionHelper
Defined in:
lib/backends/opennebula/base.rb

Direct Known Subclasses

Compute, Network, Storage

Constant Summary collapse

API_VERSION =
'1.0.0'

Instance Method Summary collapse

Methods included from Helpers::ExtensionsHelper

#read_extensions

Methods included from Helpers::JsonCollectionHelper

#read_from_json

Constructor Details

#initialize(delegated_user, options, server_properties, logger, dalli_cache) ⇒ Base


9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/backends/opennebula/base.rb', line 9

def initialize(delegated_user, options, server_properties, logger, dalli_cache)
  @delegated_user = Hashie::Mash.new(delegated_user)
  @options = Hashie::Mash.new(options)
  @server_properties = Hashie::Mash.new(server_properties)
  @logger = logger || Rails.logger
  @dalli_cache = dalli_cache
  @other_backends = {}
  @client = nil

  # establish connection with OpenNebula
  @cloud_auth_client = init_connection(@delegated_user, @options)
  run_authn

  @options.backend_scheme ||= "http://occi.#{@server_properties.hostname || 'localhost'}"

  path = @options.fixtures_dir || ''
  read_resource_tpl_fixtures(path)
end

Instance Method Details

#add_other_backend(backend_type, backend_instance) ⇒ Object


28
29
30
31
# File 'lib/backends/opennebula/base.rb', line 28

def add_other_backend(backend_type, backend_instance)
  fail 'Type and instance must be provided!' unless backend_type && backend_instance
  @other_backends[backend_type] = backend_instance
end