Module: Dopv::Infrastructure

Defined in:
lib/dopv/infrastructure.rb,
lib/dopv/infrastructure/providers/base.rb,
lib/dopv/infrastructure/providers/ovirt.rb,
lib/dopv/infrastructure/providers/vsphere.rb,
lib/dopv/infrastructure/providers/baremetal.rb,
lib/dopv/infrastructure/providers/openstack.rb

Defined Under Namespace

Classes: BareMetal, Base, OpenStack, Ovirt, ProviderError, Vsphere

Constant Summary collapse

TMP =
'/tmp'
PROVIDER_BASE =
'dopv/infrastructure/providers'
PROVIDER_CLASSES =
{
  :ovirt      => 'Ovirt',
  :rhev       => 'Ovirt',
  :openstack  => 'OpenStack',
  :vsphere    => 'Vsphere',
  :vmware     => 'Vsphere',
  :baremetal  => 'BareMetal'
}

Class Method Summary collapse

Class Method Details

.bootstrap_node(plan, state_store) ⇒ Object



24
25
26
27
# File 'lib/dopv/infrastructure.rb', line 24

def self.bootstrap_node(plan, state_store)
  provider = load_provider(plan.infrastructure.provider)
  provider.bootstrap_node(plan, state_store)
end

.destroy_node(plan, state_store, destroy_data_volumes = false) ⇒ Object



29
30
31
32
# File 'lib/dopv/infrastructure.rb', line 29

def self.destroy_node(plan, state_store, destroy_data_volumes=false)
  provider = load_provider(plan.infrastructure.provider)
  provider.destroy_node(plan, state_store, destroy_data_volumes)
end

.load_provider(provider) ⇒ Object



18
19
20
21
22
# File 'lib/dopv/infrastructure.rb', line 18

def self.load_provider(provider)
  require "#{PROVIDER_BASE}/#{PROVIDER_CLASSES[provider].downcase}"
  klass_name = "Dopv::Infrastructure::#{PROVIDER_CLASSES[provider]}"
  klass_name.split('::').inject(Object) { |res, i| res.const_get(i) }
end

.refresh_node(plan, state_store) ⇒ Object



34
35
36
37
# File 'lib/dopv/infrastructure.rb', line 34

def self.refresh_node(plan, state_store)
  provider = load_provider(plan.infrastructure.provider)
  provider.refresh_node(plan, state_store)
end