Module: Dcmgr

Included in:
Tags
Defined in:
lib/dcmgr/endpoints/metadata.rb,
lib/dcmgr.rb,
lib/dcmgr/vnet.rb,
lib/dcmgr/logger.rb,
lib/dcmgr/version.rb,
lib/dcmgr/scheduler.rb,
lib/dcmgr/drivers/kvm.rb,
lib/dcmgr/drivers/lxc.rb,
lib/dcmgr/drivers/raw.rb,
lib/dcmgr/drivers/zfs.rb,
lib/dcmgr/models/base.rb,
lib/dcmgr/vnet/factories.rb,
lib/dcmgr/drivers/comstar.rb,
lib/dcmgr/rpc/hva_handler.rb,
lib/dcmgr/rpc/sta_handler.rb,
lib/dcmgr/storage_service.rb,
lib/dcmgr/endpoints/errors.rb,
lib/dcmgr/messaging_client.rb,
lib/dcmgr/drivers/sun_iscsi.rb,
lib/dcmgr/drivers/hypervisor.rb,
lib/dcmgr/endpoints/core_api.rb,
lib/dcmgr/helpers/cli_helper.rb,
lib/dcmgr/helpers/nic_helper.rb,
lib/dcmgr/drivers/linux_iscsi.rb,
lib/dcmgr/drivers/iscsi_target.rb,
lib/dcmgr/rack/run_initializer.rb,
lib/dcmgr/vnet/isolators/dummy.rb,
lib/dcmgr/vnet/netfilter/cache.rb,
lib/dcmgr/vnet/netfilter/chain.rb,
lib/dcmgr/drivers/backing_store.rb,
lib/dcmgr/vnet/tasks/static_nat.rb,
lib/dcmgr/node_modules/scheduler.rb,
lib/dcmgr/node_modules/instance_ha.rb,
lib/dcmgr/drivers/storage_initiator.rb,
lib/dcmgr/vnet/netfilter/controller.rb,
lib/dcmgr/vnet/tasks/accept_all_dns.rb,
lib/dcmgr/vnet/tasks/debug_iptables.rb,
lib/dcmgr/vnet/tasks/security_group.rb,
lib/dcmgr/node_modules/hva_collector.rb,
lib/dcmgr/node_modules/sta_collector.rb,
lib/dcmgr/helpers/ec2_metadata_helper.rb,
lib/dcmgr/vnet/netfilter/task_manager.rb,
lib/dcmgr/vnet/tasks/drop_arp_to_host.rb,
lib/dcmgr/vnet/tasks/drop_ip_spoofing.rb,
lib/dcmgr/vnet/tasks/exclude_from_nat.rb,
lib/dcmgr/vnet/netfilter/ebtables_rule.rb,
lib/dcmgr/vnet/netfilter/iptables_rule.rb,
lib/dcmgr/vnet/tasks/drop_mac_spoofing.rb,
lib/dcmgr/node_modules/instance_monitor.rb,
lib/dcmgr/node_modules/service_openflow.rb,
lib/dcmgr/scheduler/network/flat_single.rb,
lib/dcmgr/vnet/tasks/accept_arp_to_host.rb,
lib/dcmgr/node_modules/service_netfilter.rb,
lib/dcmgr/scheduler/host_node/find_first.rb,
lib/dcmgr/scheduler/network/per_instance.rb,
lib/dcmgr/scheduler/network/vif_template.rb,
lib/dcmgr/vnet/tasks/drop_arp_forwarding.rb,
lib/dcmgr/helpers/snapshot_storage_helper.rb,
lib/dcmgr/scheduler/host_node/least_usage.rb,
lib/dcmgr/vnet/isolators/by_securitygroup.rb,
lib/dcmgr/vnet/tasks/accept_arp_broadcast.rb,
lib/dcmgr/node_modules/openflow_controller.rb,
lib/dcmgr/node_modules/sta_tgt_initializer.rb,
lib/dcmgr/scheduler/host_node/exclude_same.rb,
lib/dcmgr/scheduler/host_node/per_instance.rb,
lib/dcmgr/scheduler/host_node/specify_node.rb,
lib/dcmgr/scheduler/network/nat_one_to_one.rb,
lib/dcmgr/vnet/tasks/accept_ip_to_anywhere.rb,
lib/dcmgr/vnet/tasks/drop_ip_from_anywhere.rb,
lib/dcmgr/scheduler/storage_node/find_first.rb,
lib/dcmgr/vnet/tasks/accept_ip_from_friends.rb,
lib/dcmgr/vnet/tasks/accept_ip_from_gateway.rb,
lib/dcmgr/vnet/tasks/accept_wakame_dns_only.rb,
lib/dcmgr/scheduler/storage_node/least_usage.rb,
lib/dcmgr/vnet/tasks/accept_arp_from_friends.rb,
lib/dcmgr/vnet/tasks/accept_arp_from_gateway.rb,
lib/dcmgr/vnet/tasks/accept_wakame_dhcp_only.rb,
lib/dcmgr/vnet/tasks/accept_related_established.rb,
lib/dcmgr/vnet/tasks/translate_metadata_address.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.

see also docs.amazonwebservices.com/AWSEC2/latest/UserGuide/index.html?instancedata-data-categories.html

Defined Under Namespace

Modules: Cli, Drivers, Endpoints, Helpers, Logger, Models, NodeModules, Rack, Rpc, Scheduler, Tags, VNet Classes: MessagingClient, StorageService

Constant Summary collapse

VERSION_MAJOR =
"11.12"
VERSION_MINOR =
0
VERSION =
"#{VERSION_MAJOR}.#{VERSION_MINOR}"

Class Method Summary collapse

Class Method Details

.confObject



9
10
11
# File 'lib/dcmgr.rb', line 9

def conf
  @conf
end

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



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

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



48
49
50
51
52
53
54
# File 'lib/dcmgr.rb', line 48

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

.run_initializers(*files) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/dcmgr.rb', line 33

def run_initializers(*files)
  raise "Complete the configuration prior to run_initializers()." if @conf.nil?

  @files ||= []
  if files.length == 0
    @files << "*"
  else
  	@files = files
  end
  
  initializer_hooks.each { |n|
    n.call
  }
end