diff --git a/README b/README.md similarity index 100% rename from README rename to README.md diff --git a/install.sh b/install.sh index e8363d17c8..09d1a76a80 100755 --- a/install.sh +++ b/install.sh @@ -598,7 +598,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" diff --git a/share/etc/oned.conf b/share/etc/oned.conf index 2f5519e1a7..0203b6fc84 100644 --- a/share/etc/oned.conf +++ b/share/etc/oned.conf @@ -382,7 +382,7 @@ VM_HOOK = [ # on = "ERROR", # command = "host_error.rb", # arguments = "$HID -r n", -# remote = no ] +# remote = "no" ] #------------------------------------------------------------------------------- # This two hooks can be used to automatically delete or resubmit VMs that reach # the "failed" state. This way, the administrator doesn't have to interact @@ -393,14 +393,14 @@ VM_HOOK = [ # #VM_HOOK = [ # name = "on_failure_delete", -# on = "FAILURE", -# command = "onevm delete", +# on = "FAILED", +# command = "/usr/bin/env onevm delete", # arguments = "$VMID" ] # #VM_HOOK = [ # name = "on_failure_resubmit", -# on = "FAILURE", -# command = "onevm resubmit", +# on = "FAILED", +# command = "/usr/bin/env onevm resubmit", # arguments = "$VMID" ] #------------------------------------------------------------------------------- diff --git a/share/examples/vm.schema b/share/examples/vm.schema deleted file mode 100644 index 608c07ce03..0000000000 --- a/share/examples/vm.schema +++ /dev/null @@ -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: -# $ -# $[] -# $[, =] -# $NETWORK[, 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: -# $ -# $[] -# $[, =] -#--------------------------------------- - -REQUIREMENTS = "Bool_expression_for_reqs" #Optional -RANK = "Arith_expression_to_rank_hosts" #Optional diff --git a/src/cli/oneuser b/src/cli/oneuser index 538d3466bc..305cc276ce 100755 --- a/src/cli/oneuser +++ b/src/cli/oneuser @@ -151,7 +151,7 @@ EOT end end -oneup_opts=OneUPParse.new([:list]) +oneup_opts=OneUPParse.new([:list, :xml]) oneup_opts.parse(ARGV) ops=oneup_opts.options diff --git a/src/cloud/ec2/lib/EC2QueryServer.rb b/src/cloud/ec2/lib/EC2QueryServer.rb index 0de20daac5..e93e06b66e 100644 --- a/src/cloud/ec2/lib/EC2QueryServer.rb +++ b/src/cloud/ec2/lib/EC2QueryServer.rb @@ -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 @@ -143,7 +154,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 @@ -155,7 +166,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 @@ -177,7 +188,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 @@ -203,19 +214,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")) @@ -227,7 +237,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 @@ -242,7 +252,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 @@ -264,18 +274,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'] @@ -286,13 +297,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 diff --git a/src/rm/RequestManagerAllocate.cc b/src/rm/RequestManagerAllocate.cc index f926b0c960..6ae73f60bc 100644 --- a/src/rm/RequestManagerAllocate.cc +++ b/src/rm/RequestManagerAllocate.cc @@ -97,6 +97,8 @@ void RequestManager::VirtualMachineAllocate::execute( VirtualMachineAllocate::ipool->authorize_disk(vector,uid,&ar); } + vectors.clear(); + num = vm_template->get("NIC",vectors); for(int i=0; ivirtio'); + $('input#TYPE', section_raw).val("kvm"); $(section_inputs).show(); @@ -1281,8 +1284,9 @@ function createVMachineDialog(){ $('select#boot_method option#no_boot').html("Please choose"); $('.kernel, .bootloader', $('div#os_boot_opts')).hide(); + $('div#disks select#BUS option#virtio').remove(); - $('input#TYPE', section_raw).val("kvm"); + $('input#TYPE', section_raw).val("xen"); $(section_inputs).hide(); //not present for xen update_dynamic_css(); }; @@ -1714,6 +1718,25 @@ function createVMachineDialog(){ $('fieldset',section_context).toggle(); return false; }); + + $('#add_context_button', section_context).click(function(){ + var name = $('#var_name',section_context).val(); + var value = $('#var_value',section_context).val(); + if (!name.length || !value.length) { + notifyError("Context variable name and value must be filled in"); + return false; + } + option= ''; + $('select#context_box',section_context).append(option); + return false; + }); + + $('#remove_context_button', section_context).click(function(){ + box_remove_element(section_context,'#context_box'); + return false; + }); }; @@ -1852,7 +1875,8 @@ function createVMachineDialog(){ notifyError("There are mandatory fields missing in the OS Boot options section"); return false; }; - addSectionJSON(vm_json,scope); + vm_json["OS"] = {}; + addSectionJSON(vm_json["OS"],scope); //process disks scope = section_disks; @@ -1874,11 +1898,15 @@ function createVMachineDialog(){ vm_json["GRAPHICS"] = {}; addSectionJSON(vm_json["GRAPHICS"],scope); - //context -> include + //context scope = section_context; - var context = $('#CONTEXT',scope).val(); - if (context) - vm_json["CONTEXT"] = context; + vm_json["CONTEXT"] = {}; + var pair; + $('#context_box option',scope).each(function(){ + name = $(this).attr("name"); + value = $(this).val(); + vm_json["CONTEXT"][name]=value; + }); //placement -> fetch with value scope = section_placement; @@ -2102,7 +2130,7 @@ function createImageDialog(){ $('#create_image_form_manual').submit(function(){ template=$('#template',this).val(); - OpenNebula.Image.create({data: template,success: addImageElement,error: onError}); + OpenNebula.Image.register({data: template,success: addImageElement,error: onError}); $create_image_dialog.dialog('close'); return false; }); @@ -2446,7 +2474,7 @@ function imageElementArray(image_json){ return [ '', image.ID, - image.USERNAME ? image.USERNAME : getUserName(image.ID), + image.USERNAME ? image.USERNAME : getUserName(image.UID), image.NAME, OpenNebula.Helper.image_type(image.TYPE), pretty_time(image.REGTIME), diff --git a/src/sunstone/public/js/one-ui_views.templates.js b/src/sunstone/public/js/one-ui_views.templates.js index 6a3a83873d..51361cd2e9 100644 --- a/src/sunstone/public/js/one-ui_views.templates.js +++ b/src/sunstone/public/js/one-ui_views.templates.js @@ -392,7 +392,7 @@ var create_vm_tmpl = \ \
CPU architecture to virtualization
\ \ @@ -436,9 +436,9 @@ var create_vm_tmpl = \ \
Boot device type
\ \ @@ -693,14 +693,27 @@ var create_vm_tmpl = \
\
\ -

Add context

\ +

Add context variables

\
\
Context\ -
\ - \ - \ - \ -
\ +
\ + \ + \ +
Name for the context variable
\ +
\ +
\ + \ + \ +
Value of the context variable
\ +
\ +
\ + \ + \ +
\ + \ + \ +
\
\
\ \