1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-22 18:50:08 +03:00

feature #795: Use yaml conf file in EC2

This commit is contained in:
Daniel Molina 2011-09-21 19:01:31 +02:00
parent 9419406f6e
commit 2be5ec5694
3 changed files with 38 additions and 32 deletions

View File

@ -137,10 +137,10 @@ class EC2QueryServer < CloudServer
# Get the instance type and path
if params['InstanceType'] != nil
instance_type_name = params['InstanceType']
instance_type = @config[:instance_types][instance_type_name]
instance_type = @config[:instance_types][instance_type_name.to_sym]
if instance_type != nil
path = @config[:template_location] + "/#{instance_type['TEMPLATE']}"
path = @config[:template_location] + "/#{instance_type[:template]}"
end
end

View File

@ -46,34 +46,34 @@ require 'Configuration'
include OpenNebula
##############################################################################
# Parse Configuration file
##############################################################################
begin
config = Configuration.new(CONFIGURATION_FILE)
config.add_configuration_value("TEMPLATE_LOCATION", TEMPLATE_LOCATION)
config.add_configuration_value("VIEWS", VIEWS_LOCATION)
instance_types = CloudServer.get_instance_types(config)
config.add_configuration_value("INSTANCE_TYPES", instance_types)
CloudServer.print_configuration(config)
set :config, config
conf = YAML.load_file(CONFIGURATION_FILE)
rescue Exception => e
puts "Error starting server: #{e}"
exit(-1)
puts "Error parsing config file #{CONFIGURATION_FILE}: #{e.message}"
exit 1
end
if CloudServer.is_port_open?(settings.config[:server],
settings.config[:port])
puts "Port busy, please shutdown the service or move econe server port."
exit
end
conf[:template_location] = TEMPLATE_LOCATION
conf[:views] = VIEWS_LOCATION
CloudServer.print_configuration(conf)
##############################################################################
# Sinatra Configuration
##############################################################################
set :config, conf
set :host, settings.config[:server]
set :port, settings.config[:port]
if CloudServer.is_port_open?(settings.config[:server],
settings.config[:port])
puts "Port busy, please shutdown the service or move econe server port."
exit 1
end
##############################################################################
# Actions
##############################################################################

View File

@ -14,23 +14,29 @@
# limitations under the License. #
#--------------------------------------------------------------------------- #
# OpenNebula server contact information
ONE_XMLRPC=http://localhost:2633/RPC2
# OpenNebula sever contact information
:one_xmlrpc: http://localhost:2633/RPC2
# Host and port where the occi server will run
SERVER=<FQDN OF OCCI SERVER>
PORT=4567
# Host and port where econe server will run
:server: localhost
:port: 4567
# SSL proxy that serves the API (set if is being used)
#SSL_SERVER=https://localhost:443
AUTH=basic
#:ssl_server: fqdm.of.the.server
# Configuration for OpenNebula's Virtual Networks
BRIDGE=<NAME OF DEFAULT BRIDGE>
#:bridge: <NAME_OF_DEFAULT_BRIDGE>
:bridge: vbr1
:auth: basic
# VM types allowed and its template file (inside templates directory)
VM_TYPE=[NAME=custom, TEMPLATE=custom.erb]
VM_TYPE=[NAME=small, TEMPLATE=small.erb]
VM_TYPE=[NAME=medium, TEMPLATE=medium.erb]
VM_TYPE=[NAME=large, TEMPLATE=large.erb]
:instance_types:
:custom:
:template: custom.erb
:small:
:template: small.erb
:medium:
:template: medium.erb
:large:
:template: large.erb