Module: Dcmgr

Included in:
Tags
Defined in:
lib/dcmgr/endpoints/metadata.rb,
lib/dcmgr.rb,
lib/dcmgr/logger.rb,
lib/dcmgr/scheduler.rb,
lib/dcmgr/models/base.rb,
lib/dcmgr/endpoints/errors.rb,
lib/dcmgr/endpoints/core_api.rb,
lib/dcmgr/helpers/cli_helper.rb,
lib/dcmgr/scheduler/find_last.rb,
lib/dcmgr/models/physical_host.rb,
lib/dcmgr/scheduler/find_random.rb,
lib/dcmgr/endpoints/core_api_mock.rb,
lib/dcmgr/node_modules/instance_ha.rb,
lib/dcmgr/node_modules/hva_collector.rb,
lib/dcmgr/node_modules/sta_collector.rb

Overview

Metadata service endpoint for running VMs. The running VM can not identify itself that who or where i am. The service supplies these information from somewhere out of the VM. It publishes some very crucial information to each VM so that the access control to this service is mandated at both levels, the network and the application itself.

The concept of the service is similar with Amazon EC2’s Metadata service given via 169.254.169.254/. The difference is the URI structure. This gives the single point URI as per below:

http://metadata.server/[version]/meatadata.[format]

It will return a document which results in a syntax specified in the last extension field. The document contains over all information that the VM needs for self recoginition.

Defined Under Namespace

Modules: Endpoints, Helpers, Logger, Models, NodeModules, PhysicalHostScheduler, Stm, Tags, Web

Constant Summary collapse

VERSION =
'10.12.0'

Class Method Summary collapse

Class Method Details

.confObject



7
8
9
# File 'lib/dcmgr.rb', line 7

def conf
  @conf
end

.configure(config_path = nil, &blk) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/dcmgr.rb', line 11

def configure(config_path=nil, &blk)
  return self if @conf
  
  if config_path.is_a?(String)
    raise "Could not find configration file: #{config_path}" unless File.exists?(config_path)

    require 'configuration'
    code= <<-__END
    Configuration('global') do
      #{File.read(config_path)}
    end
    __END
    @conf = eval(code)
  else
    @conf = Configuration.for('global', &blk)
  end

  self
end

.initializer_hooks(&blk) ⇒ Object



38
39
40
41
42
43
44
# File 'lib/dcmgr.rb', line 38

def initializer_hooks(&blk)
  @initializer_hooks ||= []
  if blk
    @initializer_hooks << blk
  end
  @initializer_hooks
end

.run_initializersObject



31
32
33
34
35
36
# File 'lib/dcmgr.rb', line 31

def run_initializers()
  raise "Complete the configuration prior to run_initializers()." if @conf.nil?
  initializer_hooks.each { |n|
    n.call
  }
end