Merge branch 'master' of git.opennebula.org:one

This commit is contained in:
Tino Vázquez committed 2011-03-24 14:57:03 +01:00
commit c0affc32fc
4 files changed
+43 -144

No files matched your search

-1
View File
@@ -581,7 +581,6 @@ AUTH_ETC_FILES="src/authm_mad/auth_mad \
#-------------------------------------------------------------------------------
EXAMPLE_SHARE_FILES="share/examples/vm.template \
share/examples/vm.schema \
share/examples/private.net \
share/examples/public.net"
-113
View File
@@ -1,113 +0,0 @@
# ----------------------------------------------------------------------
# VM ATTRIBUTES
# Each attribute is labeled as Optional or Mandatory, also if it
# can be defined in the driver conf file is tagged with default. Finally
# the hypervisors that support the attribute are listed.
# ----------------------------------------------------------------------
#---------------------------------------
# Name of the VM
#---------------------------------------
NAME = "vm-example" # Optional, Default: one-$VMID, XEN, KVM
#---------------------------------------
# Capacity
#---------------------------------------
CPU = "amount_of_requested_CPU" # Mandatory, XEN, KVM
MEMORY = "amount_of_requested_MEM" # Mandatory, XEN, KVM
VCPU = "number of virtual cpus" # Optional, default, KVM, XEN
#---------------------------------------
# OS and boot options
#---------------------------------------
OS = [
kernel = "path_to_os_kernel", # XEN: Mandatory,default. KVM: Optional
initrd = "path_to_initrd_image", # XEN: Mandatory,default. KVM: Optional
kernel_cmd = "kernel_command_line", # Optional, default, KVM, XEN
root = "device to be mounted as root" # XEN: Mandatory,default. KVM: Optional
boot = "device to boot from" ] # KVM: Mandatory,default XEN: Optional
#---------------------------------------
# Features of the hypervisor
#---------------------------------------
FEATURES = [
pae = "yes|no", # Optional, KVM
acpi = "yes|no" ] # Optional, KVM
#---------------------------------------
# VM Disks
#---------------------------------------
DISK = [
type = "floppy|disk|cdrom|swap", #Optional, KVM ,XEN(only swap)
source = "path_to_disk_image_file|physical_dev", #Mandatory, XEN, KVM
size = "size_in_GB", #Optional, KVM, XEN (only for swap, defaults 1G)
target = "device_to_map_disk", #Mandatory, XEN, KVM
bus = "ide|scsi|virtio|xen", #Optional, KVM
readonly = "yes|no", #Optional, XEN, KVM
clone = "yes|no", #Optional, XEN, KVM
save = "path_to_disk_image_file" ] #Optional, XEN, KVM
#---------------------------------------
# Network Interfaces
#---------------------------------------
NIC = [
network = "name_of_the_virtual_network", #Optional, XEN, KVM
ip = "ip_address", #Optional, XEN, KVM
bridge = "name_of_bridge_to_bind_if", #Optional, XEN, KVM
target = "device_name_to_map_if", #Optional, KVM
mac = "HW_address", #Optional, XEN, KVM
script = "path_to_script_to_bring_up_if"] #Optional, KVM
#---------------------------------------
# I/O Interfaces
#---------------------------------------
INPUT = [ #Optional, KVM
type = "mouse|tablet",
bus = "usb|ps2|xen" ]
GRAPHICS = [ #Optional, XEN, KVM
type = "vnc|sdl",
listen = "IP-to-listen-on",
port = "port_for_VNC_server",
passwd = "passwor_for_VNC_server" ]
#---------------------------------------
# Raw Hypervisor attributes
#---------------------------------------
RAW = [ # Optional, KVM, XEN
type = "xen|kvm",
data = "raw_domain_configutarion"]
#---------------------------------------
# Context for the VM
# values can use:
# $<template_variable>
# $<template_variable>[<attribute>]
# $<template_variable>[<attribute>, <attribute2>=<value2>]
# $NETWORK[<vnet_attribute>, NAME=<vnet_name>]
#---------------------------------------
CONTEXT = [ # Optional, KVM, XEN
var_1 = "value_1",
var_n = "value_n",
files = "space-separated list of paths to include in context device",
target= "device to attach the context device" ]
#---------------------------------------
# Scheduler
# Requirements expressions can use:
# $<template_variable>
# $<template_variable>[<attribute>]
# $<template_variable>[<attribute>, <attribute2>=<value2>]
#---------------------------------------
REQUIREMENTS = "Bool_expression_for_reqs" #Optional
RANK = "Arith_expression_to_rank_hosts" #Optional
+41 -30
View File
@@ -20,7 +20,6 @@ require 'erb'
require 'time'
require 'AWS'
require 'base64'
require 'CloudServer'
require 'ImageEC2'
@@ -74,7 +73,7 @@ class EC2QueryServer < CloudServer
@server_host=@config[:server]
end
@server_port=@config[:port]
@server_port=@config[:port]
print_configuration
end
@@ -89,20 +88,32 @@ class EC2QueryServer < CloudServer
def authenticate(params,env)
password = get_user_password(params['AWSAccessKeyId'])
return nil if !password
signature = case params['SignatureVersion']
when "1" then signature_version_1(params.clone, password)
when "2" then signature_version_2(params,
password,
env,
false)
end
signature = case params['SignatureVersion']
when "1" then signature_version_1(params.clone, password)
when "2" then signature_version_2(params,
password,
env,
true,
false)
end
if params['Signature']==signature
return one_client_user(params['AWSAccessKeyId'], password)
else
return nil
else
if params['SignatureVersion']=="2"
signature = signature_version_2(params,
password,
env,
false,
false)
if params['Signature']==signature
return one_client_user(params['AWSAccessKeyId'], password)
end
end
end
return nil
end
@@ -138,7 +149,7 @@ class EC2QueryServer < CloudServer
image.enable
erb_version = params['Version']
erb_version = params['Version']
response = ERB.new(File.read(@config[:views]+"/register_image.erb"))
return response.result(binding), 200
@@ -150,7 +161,7 @@ class EC2QueryServer < CloudServer
impool.info
erb_user_name = params['AWSAccessKeyId']
erb_version = params['Version']
erb_version = params['Version']
response = ERB.new(File.read(@config[:views]+"/describe_images.erb"))
return response.result(binding), 200
@@ -172,7 +183,7 @@ class EC2QueryServer < CloudServer
end
# Get the image
tmp, img=params['ImageId'].split('-')
tmp, img=params['ImageId'].split('-')
# Build the VM
erb_vm_info=Hash.new
@@ -198,19 +209,18 @@ class EC2QueryServer < CloudServer
erb_vm_info[:vm_id]=vm.id
erb_vm_info[:vm]=vm
erb_user_name = params['AWSAccessKeyId']
erb_version = params['Version']
erb_version = params['Version']
response = ERB.new(File.read(@config[:views]+"/run_instances.erb"))
return response.result(binding), 200
end
def describe_instances(params, one_client)
user_flag=-1
vmpool = VirtualMachinePool.new(one_client, user_flag)
vmpool.info
erb_version = params['Version']
erb_version = params['Version']
erb_user_name = params['AWSAccessKeyId']
response = ERB.new(File.read(@config[:views]+"/describe_instances.erb"))
@@ -222,7 +232,7 @@ class EC2QueryServer < CloudServer
vmid=params['InstanceId.1']
vmid=params['InstanceId.01'] if !vmid
tmp, vmid=vmid.split('-') if vmid[0]==?i
tmp, vmid=vmid.split('-') if vmid[0]==?i
vm = VirtualMachine.new(VirtualMachine.build_xml(vmid),one_client)
rc = vm.info
@@ -237,7 +247,7 @@ class EC2QueryServer < CloudServer
return OpenNebula::Error.new('Unsupported'),400 if OpenNebula::is_error?(rc)
erb_version = params['Version']
erb_version = params['Version']
response =ERB.new(File.read(@config[:views]+"/terminate_instances.erb"))
return response.result(binding), 200
@@ -259,18 +269,19 @@ private
end
# Calculates signature version 2
def signature_version_2(params, secret_key, env, urlencode=true)
def signature_version_2(params, secret_key, env, includeport=true, urlencode=true)
signature_params = params.reject { |key,value|
key=='Signature' or key=='file' }
server_str = @server_host
server_str = server_str + ":" + @server_port unless %w{2008-12-01 2009-11-30}.include? params["Version"]
if includeport
server_str = @server_host + ':' + @server_port
else
server_str = @server_host
end
canonical_str = AWS.canonical_string(signature_params,
server_str,
env['REQUEST_METHOD'])
server_str,
env['REQUEST_METHOD'])
# Use the correct signature strength
sha_strength = case params['SignatureMethod']
@@ -281,13 +292,13 @@ private
digest = OpenSSL::Digest::Digest.new(sha_strength)
b64hmac =
Base64.encode64(
Base64.encode64(
OpenSSL::HMAC.digest(digest, secret_key, canonical_str)).gsub("\n","")
if urlencode
return CGI::escape(b64hmac)
return CGI::escape(b64hmac)
else
return b64hmac
return b64hmac
end
end
+2
View File
@@ -95,6 +95,8 @@ void RequestManager::VirtualMachineAllocate::execute(
VirtualMachineAllocate::ipool->authorize_disk(vector,&ar);
}
vectors.clear();
num = vm_template->get("NIC",vectors);
for(int i=0; i<num; i++)