diff --git a/include/ImageManager.h b/include/ImageManager.h index 7ba9299606..4e7daca0dd 100644 --- a/include/ImageManager.h +++ b/include/ImageManager.h @@ -86,14 +86,6 @@ public: */ Image * acquire_image(int image_id); - /** - * Try to acquire an image from the repository for a VM. - * @param name of the image - * @param id of owner - * @return pointer to the image or 0 if could not be acquired - */ - Image * acquire_image(const string& name, int uid); - /** * Releases an image and triggers any needed operations in the repo * @param iid image id of the image to be released diff --git a/include/ImagePool.h b/include/ImagePool.h index 1c192997ec..1162653c09 100644 --- a/include/ImagePool.h +++ b/include/ImagePool.h @@ -78,17 +78,6 @@ public: return static_cast(PoolSQL::get(oid,lock)); }; - /** - * Function to get an Image from the pool using the image name - * @param name of the image - * @param lock locks the User mutex - * @return a pointer to the Image, 0 if the image could not be loaded - */ - Image * get(const string& name, int uid, bool lock) - { - return static_cast(PoolSQL::get(name,uid,lock)); - } - /** * Update a particular Image * @param image pointer to Image @@ -127,7 +116,10 @@ public: * automatically increased. * @param img_type will be set to the used image's type * @param uid of VM owner (to look for the image id within its images) - * @return 0 on success, -1 error, -2 not using the pool + * @return 0 on success, + * -1 error, + * -2 not using the pool, + * -3 deprecated NAME found */ int disk_attribute(VectorAttribute * disk, int disk_id, diff --git a/src/cli/command_parser.rb b/src/cli/command_parser.rb index 9bfbfb576b..6190027c2d 100755 --- a/src/cli/command_parser.rb +++ b/src/cli/command_parser.rb @@ -62,9 +62,17 @@ module CommandParser @args = args @options = Hash.new - set :format, :file, "" do |arg| format_file(arg) ; end - set :format, :range, "" do |arg| format_range(arg) ; end - set :format, :text, "" do |arg| format_text(arg) ; end + set :format, :file, "Path to a file" do |arg| + format_file(arg) + end + + set :format, :range, "List of id's in the form 1,8..15" do |arg| + format_range(arg) + end + + set :format, :text, "String" do |arg| + format_text(arg) + end instance_eval(&block) diff --git a/src/cli/etc/onevm.yaml b/src/cli/etc/onevm.yaml index 5d1e61513f..c0275162a3 100644 --- a/src/cli/etc/onevm.yaml +++ b/src/cli/etc/onevm.yaml @@ -1,7 +1,7 @@ --- :ID: :desc: ONE identifier for Virtual Machine - :size: 4 + :size: 6 :NAME: :desc: Name of the Virtual Machine diff --git a/src/cli/one_helper/oneuser_helper.rb b/src/cli/one_helper/oneuser_helper.rb index c88233e766..7550d667b0 100644 --- a/src/cli/one_helper/oneuser_helper.rb +++ b/src/cli/one_helper/oneuser_helper.rb @@ -26,7 +26,7 @@ class OneUserHelper < OpenNebulaHelper::OneHelper end def self.password_to_str_desc - "TBD" + "User password" end def self.password_to_str(arg, options) diff --git a/src/cli/one_helper/onevm_helper.rb b/src/cli/one_helper/onevm_helper.rb index 12bcc100c5..7215a7a547 100644 --- a/src/cli/one_helper/onevm_helper.rb +++ b/src/cli/one_helper/onevm_helper.rb @@ -105,7 +105,7 @@ class OneVMHelper < OpenNebulaHelper::OneHelper def format_pool(pool, options, top=false) config_file=self.class.table_conf table=CLIHelper::ShowTable.new(config_file, self) do - column :ID, "ONE identifier for Virtual Machine", :size=>4 do |d| + column :ID, "ONE identifier for Virtual Machine", :size=>6 do |d| d["ID"] end diff --git a/src/cli/oneuser b/src/cli/oneuser index ec0af84fe9..6fba896458 100755 --- a/src/cli/oneuser +++ b/src/cli/oneuser @@ -55,7 +55,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do PLAIN={ :name => "plain", :short => "-p", - :large => "--plain-password", + :large => "--plain", :description => "Store plain password" } diff --git a/src/image/ImageManagerActions.cc b/src/image/ImageManagerActions.cc index dad727ce9f..9d88e98ea1 100644 --- a/src/image/ImageManagerActions.cc +++ b/src/image/ImageManagerActions.cc @@ -46,31 +46,6 @@ Image * ImageManager::acquire_image(int image_id) /* -------------------------------------------------------------------------- */ -Image * ImageManager::acquire_image(const string& name, int uid) -{ - Image * img; - int rc; - - img = ipool->get(name,uid,true); - - if ( img == 0 ) - { - return 0; - } - - rc = acquire_image(img); - - if ( rc != 0 ) - { - img->unlock(); - img = 0; - } - - return img; -} - -/* -------------------------------------------------------------------------- */ - int ImageManager::acquire_image(Image *img) { int rc = 0; diff --git a/src/image/ImagePool.cc b/src/image/ImagePool.cc index 980715b6b9..5dfb6c6915 100644 --- a/src/image/ImagePool.cc +++ b/src/image/ImagePool.cc @@ -64,7 +64,6 @@ int ImagePool::allocate ( string& error_str) { Image * img; - Image * img_aux; string name; ostringstream oss; @@ -78,14 +77,6 @@ int ImagePool::allocate ( goto error_name; } - // Check for duplicates - img_aux = get(name,uid,false); - - if( img_aux != 0 ) - { - goto error_duplicated; - } - // --------------------------------------------------------------------- // Insert the Object in the pool & Register the image in the repository // --------------------------------------------------------------------- @@ -108,12 +99,7 @@ int ImagePool::allocate ( error_name: oss << "NAME cannot be empty."; - goto error_common; -error_duplicated: - oss << "NAME is already taken by IMAGE " << img_aux->get_oid() << "."; - -error_common: delete img; *oid = -1; @@ -140,41 +126,34 @@ int ImagePool::disk_attribute(VectorAttribute * disk, Nebula& nd = Nebula::instance(); ImageManager * imagem = nd.get_imagem(); + istringstream is; + int image_id; + source = disk->vector_value("IMAGE"); - if (source.empty()) + if (!source.empty()) { - istringstream is; - int image_id; + return -3; + } - source = disk->vector_value("IMAGE_ID"); + source = disk->vector_value("IMAGE_ID"); - if (!source.empty()) + if (!source.empty()) + { + is.str(source); + is >> image_id; + + if( !is.fail() ) { - is.str(source); - is >> image_id; + img = imagem->acquire_image(image_id); - if( !is.fail() ) + if (img == 0) { - img = imagem->acquire_image(image_id); - - if (img == 0) - { - return -1; - } + return -1; } } } - else - { - img = imagem->acquire_image(source,uid); - - if (img == 0) - { - return -1; - } - } - + if (img == 0) { string type = disk->vector_value("TYPE"); @@ -220,31 +199,22 @@ void ImagePool::authorize_disk(VectorAttribute * disk,int uid, AuthRequest * ar) string source; Image * img = 0; - source = disk->vector_value("IMAGE"); + istringstream is; + int image_id; + + source = disk->vector_value("IMAGE_ID"); if (source.empty()) { - istringstream is; - int image_id; - - source = disk->vector_value("IMAGE_ID"); - - if (source.empty()) - { - return; - } - - is.str(source); - is >> image_id; - - if( !is.fail() ) - { - img = get(image_id,true); - } + return; } - else + + is.str(source); + is >> image_id; + + if( !is.fail() ) { - img = get(source,uid,true); + img = get(image_id,true); } if (img == 0) diff --git a/src/image/test/ImagePoolTest.cc b/src/image/test/ImagePoolTest.cc index c190a08f1d..b3f5e7c8f9 100644 --- a/src/image/test/ImagePoolTest.cc +++ b/src/image/test/ImagePoolTest.cc @@ -139,8 +139,6 @@ class ImagePoolTest : public PoolTest CPPUNIT_TEST ( names_initialization ); CPPUNIT_TEST ( update ); - CPPUNIT_TEST ( get_using_name ); - CPPUNIT_TEST ( wrong_get_name ); CPPUNIT_TEST ( duplicates ); CPPUNIT_TEST ( extra_attributes ); CPPUNIT_TEST ( wrong_templates ); @@ -244,13 +242,13 @@ public: // allocated images. imp = new ImagePool(db,"OS", "hd"); - img = imp->get(names[0], uids[0], false); + img = imp->get(0, false); CPPUNIT_ASSERT( img != 0 ); - img = imp->get(names[1], uids[1], false); + img = imp->get(2, false); CPPUNIT_ASSERT( img == 0 ); - img = imp->get(names[2], uids[2], false); + img = imp->get(1, false); CPPUNIT_ASSERT( img != 0 ); @@ -322,65 +320,6 @@ public: CPPUNIT_ASSERT( no_value == "" ); }; -/* -------------------------------------------------------------------------- */ -/* -------------------------------------------------------------------------- */ - - void get_using_name() - { - int oid_0, oid_1; - ImagePool * imp = static_cast(pool); - - // Allocate two objects - oid_0 = allocate(0); - oid_1 = allocate(1); - - // --------------------------------- - // Get first object and check its integrity - obj = pool->get(oid_0, false); - CPPUNIT_ASSERT( obj != 0 ); - check(0, obj); - - // Get using its name - obj = imp->get(names[1], uids[1], true); - CPPUNIT_ASSERT( obj != 0 ); - obj->unlock(); - - check(1, obj); - - - // --------------------------------- - // Clean the cache, forcing the pool to read the objects from the DB - pool->clean(); - - // Get first object and check its integrity - obj = imp->get(names[0], uids[0], false); - check(0, obj); - - // Get using its name - obj = imp->get(oid_1, false); - check(1, obj); - }; - -/* -------------------------------------------------------------------------- */ -/* -------------------------------------------------------------------------- */ - - void wrong_get_name() - { - ImagePool * imp = static_cast(pool); - - // The pool is empty - // Non existing name - obj = imp->get("Wrong name", 0, true); - CPPUNIT_ASSERT( obj == 0 ); - - // Allocate an object - allocate(0); - - // Ask again for a non-existing name - obj = imp->get("Non existing name",uids[0], true); - CPPUNIT_ASSERT( obj == 0 ); - } - /* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */ @@ -394,15 +333,15 @@ public: CPPUNIT_ASSERT( oid == 0 ); CPPUNIT_ASSERT( oid == rc ); - // Try to allocate twice the same image, should fail + // Try to allocate twice the same image, should work rc = imp->allocate(uids[0], templates[0], &oid); - CPPUNIT_ASSERT( rc == -1 ); - CPPUNIT_ASSERT( oid == rc ); + CPPUNIT_ASSERT( rc == 1 ); + CPPUNIT_ASSERT( oid == 1 ); // Try again, this time with different uid. Should be allowed rc = imp->allocate(uids[1], templates[0], &oid); CPPUNIT_ASSERT( rc >= 0 ); - CPPUNIT_ASSERT( oid == rc ); + CPPUNIT_ASSERT( oid == 2 ); } /* -------------------------------------------------------------------------- */ diff --git a/src/sunstone/models/SunstoneServer.rb b/src/sunstone/models/SunstoneServer.rb index 0ed284f9a7..9e56959a3f 100644 --- a/src/sunstone/models/SunstoneServer.rb +++ b/src/sunstone/models/SunstoneServer.rb @@ -56,22 +56,26 @@ class SunstoneServer ############################################################################ # ############################################################################ - def get_pool(kind) - user_flag = -2 + def get_pool(kind,gid) pool = case kind when "group" then GroupPoolJSON.new(@client) when "host" then HostPoolJSON.new(@client) - when "image" then ImagePoolJSON.new(@client, user_flag) - when "template" then TemplatePoolJSON.new(@client, user_flag) - when "vm" then VirtualMachinePoolJSON.new(@client, user_flag) - when "vnet" then VirtualNetworkPoolJSON.new(@client, user_flag) + when "image" then ImagePoolJSON.new(@client) + when "template" then TemplatePoolJSON.new(@client) + when "vm" then VirtualMachinePoolJSON.new(@client) + when "vnet" then VirtualNetworkPoolJSON.new(@client) when "user" then UserPoolJSON.new(@client) else error = Error.new("Error: #{kind} resource not supported") return [404, error.to_json] end - rc = pool.info + rc = case kind + when "group","host","user" then pool.info + else + gid != "0" ? pool.info_group : pool.info_all + end + if OpenNebula.is_error?(rc) return [500, rc.to_json] else diff --git a/src/sunstone/public/js/opennebula.js b/src/sunstone/public/js/opennebula.js index 6c9d1a3c0b..dab77dd8a3 100644 --- a/src/sunstone/public/js/opennebula.js +++ b/src/sunstone/public/js/opennebula.js @@ -1645,12 +1645,12 @@ var OpenNebula = { } } }); - }, - - "chown": function(params) - { - OpenNebula.Helper.chown(params,OpenNebula.Group.resource,"group"); } + + // "chown": function(params) + // { + // OpenNebula.Helper.chown(params,OpenNebula.Group.resource,"group"); + // } }, "User": { @@ -1824,67 +1824,6 @@ var OpenNebula = { var action = OpenNebula.Helper.action(method, {"group_id": gid}); var request = OpenNebula.Helper.request(OpenNebula.User.resource,method, [id, gid]); - $.ajax({ - url: "user/" + id + "/action", - type: "POST", - data: JSON.stringify(action), - success: function() - { - if (callback) - { - callback(request); - } - }, - error: function(response) - { - if (callback_error) - { - callback_error(request, OpenNebula.Error(response)); - } - } - }); - }, - - "addgroup" : function(params){ - var callback = params.success; - var callback_error = params.error; - var id = params.data.id; - var gid = params.data.extra_param; - - var method = "addgroup"; - var action = OpenNebula.Helper.action(method, {"group_id": gid}); - var request = OpenNebula.Helper.request(OpenNebula.User.resource,method, [id, gid]); - - $.ajax({ - url: "user/" + id + "/action", - type: "POST", - data: JSON.stringify(action), - success: function() - { - if (callback) - { - callback(request); - } - }, - error: function(response) - { - if (callback_error) - { - callback_error(request, OpenNebula.Error(response)); - } - } - }); - }, - "delgroup" : function(params){ - var callback = params.success; - var callback_error = params.error; - var id = params.data.id; - var gid = params.data.extra_param; - - var method = "delgroup"; - var action = OpenNebula.Helper.action(method, {"group_id": gid}); - var request = OpenNebula.Helper.request(OpenNebula.User.resource,method, [id, gid]); - $.ajax({ url: "user/" + id + "/action", type: "POST", @@ -1905,6 +1844,67 @@ var OpenNebula = { } }); } + + // "addgroup" : function(params){ + // var callback = params.success; + // var callback_error = params.error; + // var id = params.data.id; + // var gid = params.data.extra_param; + + // var method = "addgroup"; + // var action = OpenNebula.Helper.action(method, {"group_id": gid}); + // var request = OpenNebula.Helper.request(OpenNebula.User.resource,method, [id, gid]); + + // $.ajax({ + // url: "user/" + id + "/action", + // type: "POST", + // data: JSON.stringify(action), + // success: function() + // { + // if (callback) + // { + // callback(request); + // } + // }, + // error: function(response) + // { + // if (callback_error) + // { + // callback_error(request, OpenNebula.Error(response)); + // } + // } + // }); + // }, + // "delgroup" : function(params){ + // var callback = params.success; + // var callback_error = params.error; + // var id = params.data.id; + // var gid = params.data.extra_param; + + // var method = "delgroup"; + // var action = OpenNebula.Helper.action(method, {"group_id": gid}); + // var request = OpenNebula.Helper.request(OpenNebula.User.resource,method, [id, gid]); + + // $.ajax({ + // url: "user/" + id + "/action", + // type: "POST", + // data: JSON.stringify(action), + // success: function() + // { + // if (callback) + // { + // callback(request); + // } + // }, + // error: function(response) + // { + // if (callback_error) + // { + // callback_error(request, OpenNebula.Error(response)); + // } + // } + // }); + // } }, "Image": { diff --git a/src/sunstone/public/js/plugins/dashboard-tab.js b/src/sunstone/public/js/plugins/dashboard-tab.js index 4e5f8e7503..08914d197b 100644 --- a/src/sunstone/public/js/plugins/dashboard-tab.js +++ b/src/sunstone/public/js/plugins/dashboard-tab.js @@ -99,7 +99,7 @@ var dashboard_tab_content =

Quickstart

\
\
\ - \ + \ Host
\ Group
\ VM Template
\ diff --git a/src/sunstone/public/js/plugins/dashboard-users-tab.js b/src/sunstone/public/js/plugins/dashboard-users-tab.js index f1306f9514..e54ce3f8e0 100644 --- a/src/sunstone/public/js/plugins/dashboard-users-tab.js +++ b/src/sunstone/public/js/plugins/dashboard-users-tab.js @@ -81,7 +81,7 @@ var dashboard_tab_content =

Quickstart

\
\ \ \ \ - \ + \ \ \ \ @@ -93,7 +93,7 @@ var user_actions = { error: onError }); }, - condition: function(){ uid == 0 }, + condition: True, notify: false }, @@ -108,27 +108,27 @@ var user_actions = { notify: true }, - "User.addgroup" : { - type: "multiple", - call: OpenNebula.User.addgroup, - callback : function(req){ - Sunstone.runAction("User.show",req.request.data[0]); - }, - elements : function() {return getSelectedNodes(dataTable_users);}, - error: onError, - notify: true - }, + // "User.addgroup" : { + // type: "multiple", + // call: OpenNebula.User.addgroup, + // callback : function(req){ + // Sunstone.runAction("User.show",req.request.data[0]); + // }, + // elements : function() {return getSelectedNodes(dataTable_users);}, + // error: onError, + // notify: true + // }, - "User.delgroup" : { - type: "multiple", - call: OpenNebula.User.delgroup, - callback : function(req){ - Sunstone.runAction("User.show",req.request.data[0]); - }, - elements : function() {return getSelectedNodes(dataTable_users);}, - error: onError, - notify: true - }, + // "User.delgroup" : { + // type: "multiple", + // call: OpenNebula.User.delgroup, + // callback : function(req){ + // Sunstone.runAction("User.show",req.request.data[0]); + // }, + // elements : function() {return getSelectedNodes(dataTable_users);}, + // error: onError, + // notify: true + // }, "User.show" : { type: "single", @@ -161,25 +161,25 @@ var user_buttons = { }, "User.chgrp" : { type: "confirm_with_select", - text: "Change main group", + text: "Change group", select: function(){ return groups_select; }, tip: "This will change the main group of the selected users. Select the new group:", condition: True }, - "User.addgroup" : { - type: "confirm_with_select", - text: "Add to group", - select: function(){ return groups_select; }, - tip: "Select the new group to add users:", - condition: True - }, - "User.delgroup" : { - type: "confirm_with_select", - text: "Delete from group", - select: function(){ return groups_select; }, - tip: "Select the group from which to delete users:", - condition: True - }, + // "User.addgroup" : { + // type: "confirm_with_select", + // text: "Add to group", + // select: function(){ return groups_select; }, + // tip: "Select the new group to add users:", + // condition: True + // }, + // "User.delgroup" : { + // type: "confirm_with_select", + // text: "Delete from group", + // select: function(){ return groups_select; }, + // tip: "Select the group from which to delete users:", + // condition: True + // }, "User.delete" : { type: "action", text: "Delete", @@ -191,7 +191,7 @@ var users_tab = { title: "Users", content: users_tab_content, buttons: user_buttons, - condition: function(){ return uid == 0; } + condition: True } Sunstone.addActions(user_actions); @@ -201,52 +201,12 @@ Sunstone.addMainTab('users_tab',users_tab); // added to the dataTable function userElementArray(user_json){ var user = user_json.USER; - if (!user.NAME || user.NAME == {}){ - name = ""; - } else { - name = user.NAME; - } - - var groups_str=""; - if (user.GROUPS.ID.constructor == Array){ //several groups - for (var i=0; i< user.GROUPS.ID.length; i++){ - groups_str+=getGroupName(user.GROUPS.ID[i])+', '; - }; - groups_str = groups_str.slice(0,-2); - } else { //one group - groups_str = getGroupName(user.GROUPS.ID); - }; - - // var groups_full_str=getGroupName(user.GID)+", "; - // var group_field; - - // if (user.GROUPS.ID){ - // $.each(user.GROUPS.ID,function() { - // if (i<=5) { - // groups_str+=getGroupName(this)+", "; - // }; - // groups_full_str+=getGroupName(this)+", "; - // i++; - // }); - // if (i>0){ - // groups_str = groups_str.slice(0, -2); - // groups_full_str = groups_str.slice(0, -2); - // }; - // if (i>5){ - // groups_str+="..."; - // group_field = '
'+groups_str+'
'; - // } else { - // group_field=groups_str; - // }; - // } - - return [ '', user.ID, - name, - groups_str + user.NAME, + user.GNAME ] } @@ -305,7 +265,7 @@ function setupCreateUserDialog(){ $('#create_user_form').submit(function(){ var user_name=$('#username',this).val(); var user_password=$('#pass',this).val(); - if (!user_name.length && !user_password.length){ + if (!user_name.length || !user_password.length){ notifyError("User name and password must be filled in"); return false; } @@ -337,30 +297,29 @@ function setUserAutorefresh(){ $(document).ready(function(){ //if we are not oneadmin, our tab will not even be in the DOM. - if (uid==0) { - dataTable_users = $("#datatable_users").dataTable({ - "bJQueryUI": true, - "bSortClasses": false, - "sPaginationType": "full_numbers", - "bAutoWidth":false, - "aoColumnDefs": [ - { "bSortable": false, "aTargets": ["check"] }, - { "sWidth": "60px", "aTargets": [0] }, - { "sWidth": "35px", "aTargets": [1] } - ] - }); - dataTable_users.fnClearTable(); - addElement([ - spinner, - '','',''],dataTable_users); + dataTable_users = $("#datatable_users").dataTable({ + "bJQueryUI": true, + "bSortClasses": false, + "sPaginationType": "full_numbers", + "bAutoWidth":false, + "aoColumnDefs": [ + { "bSortable": false, "aTargets": ["check"] }, + { "sWidth": "60px", "aTargets": [0] }, + { "sWidth": "35px", "aTargets": [1] } + ] + }); + dataTable_users.fnClearTable(); + addElement([ + spinner, + '','',''],dataTable_users); - Sunstone.runAction("User.list"); + Sunstone.runAction("User.list"); - setupCreateUserDialog(); - setUserAutorefresh(); + setupCreateUserDialog(); + setUserAutorefresh(); + + initCheckAllBoxes(dataTable_users); + tableCheckboxesListener(dataTable_users); + shortenedInfoFields('#datatable_users'); - initCheckAllBoxes(dataTable_users); - tableCheckboxesListener(dataTable_users); - shortenedInfoFields('#datatable_users'); - } }) diff --git a/src/sunstone/public/js/plugins/vms-tab.js b/src/sunstone/public/js/plugins/vms-tab.js index 035423e7ec..6d9089ff04 100644 --- a/src/sunstone/public/js/plugins/vms-tab.js +++ b/src/sunstone/public/js/plugins/vms-tab.js @@ -419,7 +419,7 @@ var vm_buttons = { text: "Change owner", select: function() {return users_select;}, tip: "Select the new owner:", - condition: True + condition: function() { return gid == 0; } }, "VM.chgrp" : { @@ -427,7 +427,7 @@ var vm_buttons = { text: "Change group", select: function() {return groups_select;}, tip: "Select the new group:", - condition: True + condition: function() { return gid == 0; } }, "VM.shutdown" : { diff --git a/src/sunstone/public/js/plugins/vnets-tab.js b/src/sunstone/public/js/plugins/vnets-tab.js index 8658d833fb..be5e3f96f2 100644 --- a/src/sunstone/public/js/plugins/vnets-tab.js +++ b/src/sunstone/public/js/plugins/vnets-tab.js @@ -264,7 +264,7 @@ var vnet_buttons = { text: "Change owner", select: function() {return users_select;}, tip: "Select the new owner:", - condition: True + condition: function() { return gid == 0; } }, "Network.chgrp" : { @@ -272,7 +272,7 @@ var vnet_buttons = { text: "Change group", select: function() {return groups_select;}, tip: "Select the new group:", - condition: True + condition: function() { return gid == 0; } }, "Network.delete" : { diff --git a/src/sunstone/public/js/sunstone.js b/src/sunstone/public/js/sunstone.js index 7aa658c361..02d808c99d 100644 --- a/src/sunstone/public/js/sunstone.js +++ b/src/sunstone/public/js/sunstone.js @@ -374,9 +374,10 @@ function readCookie(){ //sets the user info in the top bar and creates a listner in the //signout button function setLogin(){ - //This two variables can be used anywhere + //This variables can be used anywhere username = cookie["one-user"]; uid = cookie["one-user_id"]; + gid = cookie["one-user_gid"]; $("#user").html(username); $("#logout").click(function(){ diff --git a/src/sunstone/sunstone-server.rb b/src/sunstone/sunstone-server.rb index 5c63fc18ac..010b62d64f 100755 --- a/src/sunstone/sunstone-server.rb +++ b/src/sunstone/sunstone-server.rb @@ -137,6 +137,9 @@ get '/' do response.set_cookie("one-user_id", :value=>"#{session[:user_id]}", :expires=>time) + response.set_cookie("one-user_gid", + :value=>"#{session[:user_gid]}", + :expires=>time) p = SunstonePlugins.new @plugins = p.authorized_plugins(session[:user], session[:user_gname]) @@ -187,7 +190,7 @@ end # GET Pool information ############################################################################## get '/:pool' do - @SunstoneServer.get_pool(params[:pool]) + @SunstoneServer.get_pool(params[:pool],session[:user_gid]) end ############################################################################## diff --git a/src/vm/VirtualMachine.cc b/src/vm/VirtualMachine.cc index 6d5e0da844..5e40bcead8 100644 --- a/src/vm/VirtualMachine.cc +++ b/src/vm/VirtualMachine.cc @@ -725,6 +725,10 @@ int VirtualMachine::get_disk_images(string& error_str) { goto error_image; } + else if ( rc == -3) + { + goto error_name; + } } return 0; @@ -744,6 +748,9 @@ error_max_db: error_image: error_str = "Could not get disk image for VM."; +error_name: + error_str = "NAME is not supported for DISK. Use IMAGE_ID instead."; + error_common: NebulaLog::log("ONE",Log::ERROR, error_str); return -1;
\ - \ + \ VM Template
\ VM Instance
\ Virtual Network
\ diff --git a/src/sunstone/public/js/plugins/groups-tab.js b/src/sunstone/public/js/plugins/groups-tab.js index e78b0870b2..6caec7c306 100644 --- a/src/sunstone/public/js/plugins/groups-tab.js +++ b/src/sunstone/public/js/plugins/groups-tab.js @@ -107,14 +107,14 @@ var group_actions = { notify:true }, - "Group.chown" : { - type: "multiple", - call : OpenNebula.Group.chown, - callback : updateGroupElement, - elements: function() { return getSelectedNodes(dataTable_groups); }, - error : onError, - notify:true - }, + // "Group.chown" : { + // type: "multiple", + // call : OpenNebula.Group.chown, + // callback : updateGroupElement, + // elements: function() { return getSelectedNodes(dataTable_groups); }, + // error : onError, + // notify:true + // }, } @@ -130,13 +130,13 @@ var group_buttons = { text: "+ New Group", condition : True }, - "Group.chown" : { - type: "confirm_with_select", - text: "Change group owner", - select: function(){return users_select}, - tip: "Select the new group owner:", - condition : True - }, + // "Group.chown" : { + // type: "confirm_with_select", + // text: "Change group owner", + // select: function(){return users_select}, + // tip: "Select the new group owner:", + // condition : True + // }, "Group.delete" : { type: "action", diff --git a/src/sunstone/public/js/plugins/images-tab.js b/src/sunstone/public/js/plugins/images-tab.js index 343f345fc5..88726fcb37 100644 --- a/src/sunstone/public/js/plugins/images-tab.js +++ b/src/sunstone/public/js/plugins/images-tab.js @@ -359,14 +359,14 @@ var image_buttons = { text: "Change owner", select: function() {return users_select;}, tip: "Select the new owner:", - condition: True + condition: function() { return gid == 0; } }, "Image.chgrp" : { type: "confirm_with_select", text: "Change group", select: function() {return groups_select;}, tip: "Select the new group:", - condition: True + condition: function() { return gid == 0; } }, "action_list" : { type: "select", diff --git a/src/sunstone/public/js/plugins/templates-tab.js b/src/sunstone/public/js/plugins/templates-tab.js index 51646f88cd..48661607e2 100644 --- a/src/sunstone/public/js/plugins/templates-tab.js +++ b/src/sunstone/public/js/plugins/templates-tab.js @@ -711,14 +711,14 @@ var template_buttons = { text: "Change owner", select: function() {return users_select;}, tip: "Select the new owner:", - condition: True + condition: function(){return gid==0;} }, "Template.chgrp" : { type: "confirm_with_select", text: "Change group", select: function() {return groups_select;}, tip: "Select the new group:", - condition: True + condition: function(){return gid==0;} }, "action_list" : { type: "select", diff --git a/src/sunstone/public/js/plugins/users-tab.js b/src/sunstone/public/js/plugins/users-tab.js index dc8f568dfc..d36105e279 100644 --- a/src/sunstone/public/js/plugins/users-tab.js +++ b/src/sunstone/public/js/plugins/users-tab.js @@ -29,7 +29,7 @@ var users_tab_content =
AllIDNameGroupsGroup