From 9d40fba0fbf40ed9a7da961b98436e8f45644a09 Mon Sep 17 00:00:00 2001 From: Hector Sanjuan Date: Wed, 23 Feb 2011 17:33:16 +0100 Subject: [PATCH 01/18] Feature #495: Remove from cluster fixed --- src/sunstone/public/js/one-ui_views.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/sunstone/public/js/one-ui_views.js b/src/sunstone/public/js/one-ui_views.js index 3d643492cf..7f4e1b1eeb 100644 --- a/src/sunstone/public/js/one-ui_views.js +++ b/src/sunstone/public/js/one-ui_views.js @@ -739,9 +739,8 @@ function actionButtonListener(){ nodes_id.push($(this).val()); //Calling action(id,callback,error_callback) if (extra_param!=null){ //action with two parameters - data = extra_param; - data.id = $(this).val(); - (eval(action)({data: data, success: callback, error: onError})); + var data_arg = {cluster_id: extra_param, id: $(this).val()}; + (eval(action)({data: data_arg, success: callback, error: onError})); } else { //action with one parameter (eval(action)({data:{id:$(this).val()},success: callback,error: onError})); }; From 8a6146249c3ac3d1caec74f574f136842a386b0a Mon Sep 17 00:00:00 2001 From: Hector Sanjuan Date: Wed, 23 Feb 2011 17:55:11 +0100 Subject: [PATCH 02/18] Feature #495: Fixed cluster updates --- src/sunstone/public/js/one-ui_views.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/sunstone/public/js/one-ui_views.js b/src/sunstone/public/js/one-ui_views.js index 7f4e1b1eeb..a3f27fb042 100644 --- a/src/sunstone/public/js/one-ui_views.js +++ b/src/sunstone/public/js/one-ui_views.js @@ -345,11 +345,11 @@ function refreshButtonListener(){ callback = updateHostsView; waiting_nodes(dataTable_hosts); OpenNebula.Host.list({success: callback, error: onError}); + callback = updateClustersView; + OpenNebula.Cluster.list({success: callback, error: onError}); break; case "OpenNebula.Cluster.list": - callback = updateClustersView; - waiting_nodes(dataTable_clusters); - OpenNebula.Cluster.list({success: callback, error: onError}); + //we have no cluster button for this break; case "OpenNebula.VM.list": callback = updateVMachinesView; @@ -523,7 +523,7 @@ function confirmWithSelectListener(){ dataTable="null"; select_var = clusters_select; callback = function (){ - OpenNebula.Host.list({success: updateClustersView,error: onError}); + OpenNebula.Cluster.list({success: updateClustersView,error: onError}); } break; case "OpenNebula.VM.deploy": @@ -1045,7 +1045,7 @@ function createClusterDialog(){ //If it's successfull we refresh the list. OpenNebula.Cluster.create({ data:cluster_json, success: function(){ - OpenNebula.Cluster.list(updateClustersView,onError)}, + OpenNebula.Cluster.list({success:updateClustersView,error:onError})}, error: onError}); $create_cluster_dialog.dialog('close'); return false; From 57193578e2197aff4e460dceadae383368b3ae08 Mon Sep 17 00:00:00 2001 From: Hector Sanjuan Date: Wed, 23 Feb 2011 18:52:41 +0100 Subject: [PATCH 03/18] Feature #495: Do not show leases on ranged vnets --- src/sunstone/public/js/one-ui_views.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/sunstone/public/js/one-ui_views.js b/src/sunstone/public/js/one-ui_views.js index c36757be0f..bdee84ff12 100644 --- a/src/sunstone/public/js/one-ui_views.js +++ b/src/sunstone/public/js/one-ui_views.js @@ -3107,14 +3107,16 @@ function updateVNetworkInfo(request,vn){ Public\ '+(parseInt(vn_info.PUBLIC) ? "yes" : "no" )+'\ \ - \ - \ +
'; + if (vn_info.TEMPLATE.TYPE == "FIXED"){ + rendered_info += '\ \ \ '+ prettyPrintJSON(vn_info.LEASES)+ - '
Leases information
\ - \ + ''; + } + rendered_info += '\
\ \ '+ From 6a6c865a6219c59637dc49c2baca1f4869b9c999 Mon Sep 17 00:00:00 2001 From: Hector Sanjuan Date: Wed, 23 Feb 2011 19:03:58 +0100 Subject: [PATCH 04/18] Fixed image creation --- src/sunstone/public/js/one-ui_views.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sunstone/public/js/one-ui_views.js b/src/sunstone/public/js/one-ui_views.js index bdee84ff12..c9a94f55fd 100644 --- a/src/sunstone/public/js/one-ui_views.js +++ b/src/sunstone/public/js/one-ui_views.js @@ -2089,7 +2089,7 @@ function createImageDialog(){ break; } obj = { "image" : img_json }; - OpenNebula.Image.create({data: obj,success: addImageElement,error: onError}); + OpenNebula.Image.register({data: obj,success: addImageElement,error: onError}); $create_image_dialog.dialog('close'); return false; From b8f3cbd42a8f8434299d7b2331ae32256f30af1a Mon Sep 17 00:00:00 2001 From: Hector Sanjuan Date: Wed, 23 Feb 2011 19:07:14 +0100 Subject: [PATCH 05/18] Feature #495: Image state in the extended info fixed --- src/sunstone/public/js/one-ui_views.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sunstone/public/js/one-ui_views.js b/src/sunstone/public/js/one-ui_views.js index c9a94f55fd..2139dd22f1 100644 --- a/src/sunstone/public/js/one-ui_views.js +++ b/src/sunstone/public/js/one-ui_views.js @@ -3172,7 +3172,7 @@ function updateImageInfo(request,img){ \ \ \ - \ + \ \
Virtual Network template
State'+img_info.STATE+''+OpenNebula.Helper.resource_state.("image",img_info.STATE)+'
\
\ From df519779131d1f39ed4c2c480b8ac066fdb2ff13 Mon Sep 17 00:00:00 2001 From: Hector Sanjuan Date: Wed, 23 Feb 2011 19:12:15 +0100 Subject: [PATCH 06/18] Fixed public persistency flag in extended image info --- src/sunstone/public/js/one-ui_views.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sunstone/public/js/one-ui_views.js b/src/sunstone/public/js/one-ui_views.js index 2139dd22f1..90f4db5986 100644 --- a/src/sunstone/public/js/one-ui_views.js +++ b/src/sunstone/public/js/one-ui_views.js @@ -3160,11 +3160,11 @@ function updateImageInfo(request,img){ \ \ Public\ - '+(img_info.PUBLIC ? "yes" : "no")+'\ + '+(parseInt(img_info.PUBLIC) ? "yes" : "no")+'\ \ \ Persistent\ - '+(img_info.PERSISTENT ? "yes" : "no")+'\ + '+(parseInt(img_info.PERSISTENT) ? "yes" : "no")+'\ \ \ Source\ @@ -3172,7 +3172,7 @@ function updateImageInfo(request,img){ \ \ State\ - '+OpenNebula.Helper.resource_state.("image",img_info.STATE)+'\ + '+OpenNebula.Helper.resource_state("image",img_info.STATE)+'\ \ \ \ From 7b6f3307bc618112b58a49e139186174575ef8b8 Mon Sep 17 00:00:00 2001 From: Hector Sanjuan Date: Wed, 23 Feb 2011 19:15:12 +0100 Subject: [PATCH 07/18] Feature #495: Removed preset value in the image attribute dialog --- src/sunstone/public/js/one-ui_views.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sunstone/public/js/one-ui_views.js b/src/sunstone/public/js/one-ui_views.js index 90f4db5986..51baf489ce 100644 --- a/src/sunstone/public/js/one-ui_views.js +++ b/src/sunstone/public/js/one-ui_views.js @@ -809,11 +809,11 @@ function setupImageAttributesDialogs(){
\ \ \ - \ + \
\
\ \ - \ + \
\
\ \ From 1696587c75e85d2607de8b96ebaeb32452c29036 Mon Sep 17 00:00:00 2001 From: Hector Sanjuan Date: Wed, 23 Feb 2011 19:18:18 +0100 Subject: [PATCH 08/18] Feature #495: Fixed image attribute dialog size --- src/sunstone/public/js/one-ui_views.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sunstone/public/js/one-ui_views.js b/src/sunstone/public/js/one-ui_views.js index 51baf489ce..eba872a6e1 100644 --- a/src/sunstone/public/js/one-ui_views.js +++ b/src/sunstone/public/js/one-ui_views.js @@ -826,7 +826,7 @@ function setupImageAttributesDialogs(){ autoOpen:false, width:400, modal:true, - height:270, + height:200, resizable:false, }); From 7288f5c189b2705fe7514ea71b895d742058ddfe Mon Sep 17 00:00:00 2001 From: Hector Sanjuan Date: Wed, 23 Feb 2011 19:25:04 +0100 Subject: [PATCH 09/18] Feature #495: Select all checkbox autoselects when all is checked and viceversa. --- src/sunstone/public/js/one-ui_views.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/sunstone/public/js/one-ui_views.js b/src/sunstone/public/js/one-ui_views.js index eba872a6e1..6c910c7b1a 100644 --- a/src/sunstone/public/js/one-ui_views.js +++ b/src/sunstone/public/js/one-ui_views.js @@ -2235,9 +2235,17 @@ function tableCheckboxesListener(dataTable){ dataTable = $(this).parents('table').dataTable(); context = dataTable.parents('form'); last_action_b = $('.last_action_button',context); - nodes_length = $('input:checked',dataTable.fnGetNodes()).length; + nodes = dataTable.fnGetNodes(); + total_length = nodes.length; + checked_length = $('input:checked',nodes).length; - if (nodes_length){ + if (total_length == checked_length){ + $('.check_all',dataTable).attr("checked","checked"); + } else { + $('.check_all',dataTable).removeAttr("checked"); + } + + if (checked_length){ $('.top_button, .list_button',context).button("enable"); if (last_action_b.length && last_action_b.val().length){ last_action_b.button("enable"); From 95b4b90d8f0152f884f79d71f6a054b0c220b0dd Mon Sep 17 00:00:00 2001 From: Hector Sanjuan Date: Wed, 23 Feb 2011 19:32:47 +0100 Subject: [PATCH 10/18] Feature #495: Fixed some column sizes --- src/sunstone/public/js/one-ui_views.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/sunstone/public/js/one-ui_views.js b/src/sunstone/public/js/one-ui_views.js index 6c910c7b1a..7e2410edcd 100644 --- a/src/sunstone/public/js/one-ui_views.js +++ b/src/sunstone/public/js/one-ui_views.js @@ -179,7 +179,8 @@ function initDataTables(){ "aoColumnDefs": [ { "bSortable": false, "aTargets": ["check"] }, { "sWidth": "60px", "aTargets": [0] }, - { "sWidth": "35px", "aTargets": [1] } + { "sWidth": "35px", "aTargets": [1] }, + { "sWidth": "100px", "aTargets": [2] } ] }); @@ -190,8 +191,9 @@ function initDataTables(){ "sPaginationType": "full_numbers", "aoColumnDefs": [ { "bSortable": false, "aTargets": ["check"] }, - { "sWidth": "60px", "aTargets": [0,5,6,7] }, - { "sWidth": "35px", "aTargets": [1] } + { "sWidth": "60px", "aTargets": [0,4,5,6,7] }, + { "sWidth": "35px", "aTargets": [1] }, + { "sWidth": "100px", "aTargets": [2] } ] }); @@ -217,7 +219,8 @@ function initDataTables(){ "aoColumnDefs": [ { "bSortable": false, "aTargets": ["check"] }, { "sWidth": "60px", "aTargets": [0,3] }, - { "sWidth": "35px", "aTargets": [1] } + { "sWidth": "35px", "aTargets": [1] }, + { "sWidth": "100px", "aTargets": [2,3] } ] }); From 28b5ad6f2c69cb605a8638944fb050cd1f692c5a Mon Sep 17 00:00:00 2001 From: Hector Sanjuan Date: Wed, 23 Feb 2011 19:48:16 +0100 Subject: [PATCH 11/18] Feature #495: Fixed user refresh button and consider empty pool possibility --- src/sunstone/public/js/one-ui_views.templates.js | 2 +- src/sunstone/public/js/opennebula.js | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/sunstone/public/js/one-ui_views.templates.js b/src/sunstone/public/js/one-ui_views.templates.js index 67dbaa50b6..244050c1bd 100644 --- a/src/sunstone/public/js/one-ui_views.templates.js +++ b/src/sunstone/public/js/one-ui_views.templates.js @@ -895,7 +895,7 @@ var userlist_tmpl = '
\
\
\ - OpenNebula.VM.list\ + OpenNebula.User.list\
\
\ \ diff --git a/src/sunstone/public/js/opennebula.js b/src/sunstone/public/js/opennebula.js index 59c3e2a622..c7e7502f16 100644 --- a/src/sunstone/public/js/opennebula.js +++ b/src/sunstone/public/js/opennebula.js @@ -126,7 +126,9 @@ var OpenNebula = { var p_pool = []; - pool = response[pool_name][type]; + if (response[pool_name]) { + pool = response[pool_name][type]; + } else { pull = null }; if (pool == null) { From 46f7a1852800eea51fc52b5ed828ad0b4be536f5 Mon Sep 17 00:00:00 2001 From: Hector Sanjuan Date: Wed, 23 Feb 2011 19:56:12 +0100 Subject: [PATCH 12/18] Feature #495: Update select lists of images and networks when a new element is added --- src/sunstone/public/js/one-ui_views.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/sunstone/public/js/one-ui_views.js b/src/sunstone/public/js/one-ui_views.js index 7e2410edcd..513de90782 100644 --- a/src/sunstone/public/js/one-ui_views.js +++ b/src/sunstone/public/js/one-ui_views.js @@ -2771,11 +2771,14 @@ function updateVNetworkElement(request, vn_json){ function deleteVNetworkElement(req){ deleteElement(dataTable_vNetworks,'#vnetwork_'+req.request.data); + //How to delete vNetwork select option here? } function addVNetworkElement(request,vn_json){ element = vNetworkElementArray(vn_json); addElement(element,dataTable_vNetworks); + vnetworks_select += ""; + $('div.vm_section#networks select#NETWORK').html(vnetworks_select); } @@ -2828,11 +2831,14 @@ function updateImageElement(request, image_json){ function deleteImageElement(req){ deleteElement(dataTable_images,'#image_'+req.request.data); + //how to update the image select here? } function addImageElement(request, image_json){ element = imageElementArray(image_json); addElement(element,dataTable_images); + images_select += ""; + $('div.vm_section#disks select#IMAGE').html(images_select); } function updateImagesView(request, images_list){ From eede785e7034bd74f6a1d968a6e8562e9e7424cc Mon Sep 17 00:00:00 2001 From: Hector Sanjuan Date: Thu, 24 Feb 2011 11:28:24 +0100 Subject: [PATCH 13/18] Feature #495: Delete cluster as button and not as list item --- src/sunstone/public/js/one-ui_views.templates.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sunstone/public/js/one-ui_views.templates.js b/src/sunstone/public/js/one-ui_views.templates.js index 244050c1bd..a31490e7de 100644 --- a/src/sunstone/public/js/one-ui_views.templates.js +++ b/src/sunstone/public/js/one-ui_views.templates.js @@ -168,14 +168,14 @@ var hostlist_tmpl =
\
\ \ + \ \
\
\ - \ + \
\
\ \ From adda759f2055331756eefa6fedd8b03a5aec04f7 Mon Sep 17 00:00:00 2001 From: Hector Sanjuan Date: Thu, 24 Feb 2011 11:41:44 +0100 Subject: [PATCH 14/18] Feature #495: Improved path vs source radio labels in the new image dialog --- src/sunstone/public/js/one-ui_views.templates.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/sunstone/public/js/one-ui_views.templates.js b/src/sunstone/public/js/one-ui_views.templates.js index a31490e7de..a9dbe832eb 100644 --- a/src/sunstone/public/js/one-ui_views.templates.js +++ b/src/sunstone/public/js/one-ui_views.templates.js @@ -1042,10 +1042,13 @@ var create_image_tmpl =
\
\ \ - Provide a path
\ - Provide a source
\ - Create an empty datablock\ -
Please choose path if you have a file-based image. Choose source otherwise or create an empty datablock disk.
\ + \ +
\ + \ +
\ + \ + \ +
Please choose path if you have a file-based image. Choose source otherwise or create an empty datablock disk.

\
\
\ \ From d3c19cc91a57a360ebfebbfe581f08b35c5a1f32 Mon Sep 17 00:00:00 2001 From: Daniel Molina Date: Thu, 24 Feb 2011 12:31:24 +0100 Subject: [PATCH 15/18] feature #495: Add usage to sunstone-server --- src/sunstone/bin/sunstone-server | 33 +++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/src/sunstone/bin/sunstone-server b/src/sunstone/bin/sunstone-server index 977750dd03..06efb73b8a 100755 --- a/src/sunstone/bin/sunstone-server +++ b/src/sunstone/bin/sunstone-server @@ -32,6 +32,14 @@ fi PORT="4567" HOST="127.0.0.1" +usage() { + echo + echo "Usage: sunstone-server [-H host] [-p port]" + echo + echo "-H: Host for the Sunstone server, default value: localhost" + echo "-p: Port for incoming connections, default value: 4567" +} + setup() { @@ -92,30 +100,25 @@ stop() # Kill the sunstone daemon kill -INT `cat $SUNSTONE_PID` &> /dev/null + # Remove pid files + rm -f $SUNSTONE_LOCK_FILE &> /dev/null + echo "sunstone-server stopped" } -while getopts "p:h:" OPTION +while getopts "p:H:" OPTION do case $OPTION in - p) PORT=$OPTARG;; - h) HOST=$OPTARG;; - \?) echo "Invalid option: -$OPTARG" >&2; exit 3 ;; + p) PORT=$OPTARG;; + H) HOST=$OPTARG;; + *) usage; exit 3;; esac done shift $((OPTIND-1)) case "$1" in - start) - setup - start - ;; - stop) - stop - ;; - *) - echo "Usage: sunstone {start|stop}" >&2 - exit 3 - ;; + start) setup; start;; + stop) stop;; + *) usage; exit 3;; esac From c92baa6cd223c9bfd5aad877aa09e4b9271cd287 Mon Sep 17 00:00:00 2001 From: Daniel Molina Date: Thu, 24 Feb 2011 12:31:57 +0100 Subject: [PATCH 16/18] feature #495: Change user_flag for pools --- src/sunstone/models/SunstoneServer.rb | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/sunstone/models/SunstoneServer.rb b/src/sunstone/models/SunstoneServer.rb index fbb9422c82..be52bde555 100644 --- a/src/sunstone/models/SunstoneServer.rb +++ b/src/sunstone/models/SunstoneServer.rb @@ -14,8 +14,6 @@ # limitations under the License. # #--------------------------------------------------------------------------- # -# TBD Change path for intallation tree - ONE_LOCATION = ENV["ONE_LOCATION"] if !ONE_LOCATION @@ -24,7 +22,6 @@ else VAR_LOCATION = ONE_LOCATION+"/var" end -#require 'OpenNebulaJSON' require 'models/OpenNebulaJSON' include OpenNebulaJSON @@ -61,9 +58,8 @@ class SunstoneServer ############################################################################ # ############################################################################ - def get_pool(kind, user_id) - user_flag = user_id=="0" ? -2 : -1 - + def get_pool(kind) + user_flag = -1 pool = case kind when "cluster" then ClusterPoolJSON.new(@client) when "host" then HostPoolJSON.new(@client) From 0b1f69a8ad14bcd7f850440702eca2de8a2fefb4 Mon Sep 17 00:00:00 2001 From: Daniel Molina Date: Thu, 24 Feb 2011 12:33:43 +0100 Subject: [PATCH 17/18] feature #495: Change error when VM log is not found --- src/sunstone/models/SunstoneServer.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/sunstone/models/SunstoneServer.rb b/src/sunstone/models/SunstoneServer.rb index be52bde555..0efa1dc63e 100644 --- a/src/sunstone/models/SunstoneServer.rb +++ b/src/sunstone/models/SunstoneServer.rb @@ -195,8 +195,7 @@ class SunstoneServer begin log = File.read(vm_log_file) rescue Exception => e - error = Error.new("Error: log for VM #{id} not available") - return [500, error.to_s] + return [200, "Log for VM #{id} not available"] end return [200, log] From beed4932dea8c8219abd335a81c468a54bda404a Mon Sep 17 00:00:00 2001 From: Daniel Molina Date: Thu, 24 Feb 2011 12:34:22 +0100 Subject: [PATCH 18/18] feature #495: Change user_flag for GET pool --- src/sunstone/sunstone-server.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sunstone/sunstone-server.rb b/src/sunstone/sunstone-server.rb index c71b857aa1..f855f3e0bc 100755 --- a/src/sunstone/sunstone-server.rb +++ b/src/sunstone/sunstone-server.rb @@ -123,7 +123,7 @@ end # GET Pool information ############################################################################## get '/:pool' do - @SunstoneServer.get_pool(params[:pool], session["user_id"]) + @SunstoneServer.get_pool(params[:pool]) end ##############################################################################