diff --git a/src/cloud/occi/lib/ui/public/css/login.css b/src/cloud/occi/lib/ui/public/css/login.css index 2fdd890a84..b58bacd20f 100644 --- a/src/cloud/occi/lib/ui/public/css/login.css +++ b/src/cloud/occi/lib/ui/public/css/login.css @@ -132,12 +132,19 @@ div#login input#login_btn:hover { } .error_message { + width: 400px; + margin-left: auto; + margin-right: auto; display: none; position: relative; top: 80px; - font-family: Arial, Helvetica, sans-serif; - color:red; - font-size:1.6em; + font-size:1.0em; +} + +#login_spinner { + left: 44px; + position: relative; + top: 2px; } #label_remember { diff --git a/src/cloud/occi/lib/ui/public/js/login.js b/src/cloud/occi/lib/ui/public/js/login.js index 721200f945..363fb781fd 100644 --- a/src/cloud/occi/lib/ui/public/js/login.js +++ b/src/cloud/occi/lib/ui/public/js/login.js @@ -24,14 +24,20 @@ function auth_error(req, error){ switch (status){ case 401: - $("#one_error").hide(); - $("#auth_error").fadeIn("slow"); + $("#error_box").text("Invalid username or password"); break; case 500: - $("#auth_error").hide(); - $("#one_error").fadeIn("slow"); + $("#error_box").text("OpenNebula is not running or there was a server exception. Please check the server logs."); break; + case 0: + $("#error_box").text("No answer from server. Is it running?"); + break; + default: + $("#error_box").text("Unexpected error. Status "+status+". Check the server logs."); + }; + $("#error_box").fadeIn("slow"); + $("#login_spinner").hide(); } function authenticate(){ @@ -40,6 +46,9 @@ function authenticate(){ password = Crypto.SHA1(password); var remember = $("#check_remember").is(":checked"); + $("#error_box").fadeOut("slow"); + $("#login_spinner").show(); + var obj = { data: {username: username, password: password}, remember: remember, @@ -70,4 +79,5 @@ $(document).ready(function(){ }; $("input#username.box").focus(); + $("#login_spinner").hide(); }); diff --git a/src/cloud/occi/lib/ui/public/js/occi.js b/src/cloud/occi/lib/ui/public/js/occi.js index a818fe8008..a841b00ded 100644 --- a/src/cloud/occi/lib/ui/public/js/occi.js +++ b/src/cloud/occi/lib/ui/public/js/occi.js @@ -189,7 +189,7 @@ var OCCI = { $.ajax({ url: resource.toLowerCase(), type: "GET", - data: {timeout: timeout}, + data: {timeout: timeout, verbose: true}, dataType: "xml ONEjson", success: function(response){ var res = {}; diff --git a/src/cloud/occi/lib/ui/public/js/plugins/compute.js b/src/cloud/occi/lib/ui/public/js/plugins/compute.js index 5613a1b3a2..99402b25a0 100644 --- a/src/cloud/occi/lib/ui/public/js/plugins/compute.js +++ b/src/cloud/occi/lib/ui/public/js/plugins/compute.js @@ -153,13 +153,6 @@ var vm_actions = { error: onError }, - "VM.showstate" : { - type: "single", - call: OCCI.VM.show, - callback: updateVMStateCB, - error: onError - }, - "VM.refresh" : { type: "custom", call : function (){ @@ -178,7 +171,7 @@ var vm_actions = { "VM.suspend" : { type: "multiple", call: OCCI.VM.suspend, - callback: updateVMStateCB, + callback: updateVMachineElement, elements: vmElements, error: onError, notify: true @@ -187,7 +180,7 @@ var vm_actions = { "VM.resume" : { type: "multiple", call: OCCI.VM.resume, - callback: updateVMStateCB, + callback: updateVMachineElement, elements: vmElements, error: onError, notify: true @@ -196,7 +189,7 @@ var vm_actions = { "VM.stop" : { type: "multiple", call: OCCI.VM.stop, - callback: updateVMStateCB, + callback: updateVMachineElement, elements: vmElements, error: onError, notify: true @@ -214,7 +207,7 @@ var vm_actions = { "VM.shutdown" : { type: "multiple", call: OCCI.VM.shutdown, - callback: updateVMStateCB, + callback: updateVMachineElement, elements: vmElements, error: onError, notify: true @@ -223,7 +216,7 @@ var vm_actions = { "VM.cancel" : { type: "multiple", call: OCCI.VM.cancel, - callback: updateVMStateCB, + callback: updateVMachineElement, elements: vmElements, error: onError, notify: true @@ -240,7 +233,7 @@ var vm_actions = { "VM.saveas" : { type: "single", call: OCCI.VM.saveas, - callback: updateVMStateCB, + callback: updateVMachineElement, error:onError }, @@ -259,7 +252,7 @@ var vm_actions = { }; var options = ""; for (var i = 0; i'+type+''; }; $('#dialog select#instance_type').html(options); @@ -423,7 +416,7 @@ function vMachineElementArray(vm_json){ return [ '', id, - name + VMStateBulletStr(vm_json) + name ]; } @@ -473,16 +466,15 @@ function updateVMachinesView(request, vmachine_list){ $.each(vmachine_list,function(){ el_array = vMachineElementArray(this); vmachine_list_array.push(el_array); - Sunstone.runAction("VM.showstate",el_array[1]); }); updateView(vmachine_list_array,dataTable_vMachines); updateDashboard("vms",vmachine_list); }; -function updateVMStateCB(request,vm){ +function VMStateBulletStr(vm){ var vm_state = vm.COMPUTE.STATE; - var state_html = vm_state; + var state_html = ""; switch (vm_state) { case "INIT": case "PENDING": @@ -499,13 +491,8 @@ function updateVMStateCB(request,vm){ state_html = ''+vm_state+''; break; }; - - var tag = 'input#vm_'+vm.COMPUTE.ID; - var array = vMachineElementArray(vm); - array[2] = state_html + array[2]; - updateSingleElement(array,dataTable_vMachines,tag); -}; - + return state_html; +} // Refreshes the information panel for a VM function updateVMInfo(request,vm){ diff --git a/src/cloud/occi/lib/ui/templates/login.html b/src/cloud/occi/lib/ui/templates/login.html index 82b80c0785..8bf6d0c005 100644 --- a/src/cloud/occi/lib/ui/templates/login.html +++ b/src/cloud/occi/lib/ui/templates/login.html @@ -3,7 +3,7 @@ OpenNebula Self-Service Login - + @@ -28,11 +28,7 @@
-
- Invalid username or password -
-
- OpenNebula is not running +
@@ -46,7 +42,7 @@ - + retrieving
diff --git a/src/im_mad/remotes/vmware.d/vmware.rb b/src/im_mad/remotes/vmware.d/vmware.rb index b4c061656c..ea6920571e 100755 --- a/src/im_mad/remotes/vmware.d/vmware.rb +++ b/src/im_mad/remotes/vmware.d/vmware.rb @@ -106,7 +106,7 @@ conf = YAML::load(File.read(CONF_FILE)) rc, data = do_action("virsh -c #{@uri} --readonly nodeinfo") if rc == false - exit info + exit data end data.split(/\n/).each{|line| diff --git a/src/ozones/Server/etc/ozones-server.conf b/src/ozones/Server/etc/ozones-server.conf index 022158205e..8b09856d69 100644 --- a/src/ozones/Server/etc/ozones-server.conf +++ b/src/ozones/Server/etc/ozones-server.conf @@ -23,6 +23,7 @@ ###################### :databasetype: sqlite +#:databaseserver: dbuser:dbpassword@localhost #:htaccess: /var/www/.htaccess :dbdebug: no diff --git a/src/ozones/Server/lib/OZones/ApacheWritter.rb b/src/ozones/Server/lib/OZones/ApacheWritter.rb index 327874a2e4..ca3ae1fdd3 100644 --- a/src/ozones/Server/lib/OZones/ApacheWritter.rb +++ b/src/ozones/Server/lib/OZones/ApacheWritter.rb @@ -28,12 +28,20 @@ module OZones zone.vdcs.all.each{|vdc| htaccess << "RewriteRule ^#{vdc.NAME} " + "#{zone.ENDPOINT} [P]\n" + if zone.SUNSENDPOINT != nil htaccess << "RewriteRule ^sunstone_#{vdc.NAME}/(.+) " + "#{zone.SUNSENDPOINT}/$1 [P]\n" htaccess << "RewriteRule ^sunstone_#{vdc.NAME} " + "#{zone.SUNSENDPOINT}/ [P]\n" end + + if zone.SELFENDPOINT != nil + htaccess << "RewriteRule ^self_#{vdc.NAME}/(.+) " + + "#{zone.SELFENDPOINT}/$1 [P]\n" + htaccess << "RewriteRule ^self_#{vdc.NAME} " + + "#{zone.SELFENDPOINT}/ [P]\n" + end } } diff --git a/src/ozones/Server/lib/OZones/Zones.rb b/src/ozones/Server/lib/OZones/Zones.rb index 5c1230945f..6e9aae9db7 100644 --- a/src/ozones/Server/lib/OZones/Zones.rb +++ b/src/ozones/Server/lib/OZones/Zones.rb @@ -30,6 +30,7 @@ module OZones property :ONEPASS, String, :required => true property :ENDPOINT, String, :required => true property :SUNSENDPOINT, String + property :SELFENDPOINT, String has n, :vdcs diff --git a/src/ozones/Server/ozones-server.rb b/src/ozones/Server/ozones-server.rb index 84dc77d9b7..a3fb9d8b85 100755 --- a/src/ozones/Server/ozones-server.rb +++ b/src/ozones/Server/ozones-server.rb @@ -57,7 +57,20 @@ config=YAML::load(config_data) db_type = config[:databasetype] -db_url = db_type + "://" + VAR_LOCATION + "/ozones.db" +case db_type + when "sqlite" then + db_url = db_type + "://" + VAR_LOCATION + "/ozones.db" + when "mysql","postgres" then + if config[:databaseserver].nil? + warn "DB server needed for this type of DB backend" + exit -1 + end + + db_url = db_type + "://" + config[:databaseserver] + "/ozones" + else + warn "DB type #{db_type} not recognized" + exit -1 +end ############################################################################## # DB bootstrapping diff --git a/src/ozones/Server/public/css/login.css b/src/ozones/Server/public/css/login.css index 1ea3b09872..217c8c12ca 100644 --- a/src/ozones/Server/public/css/login.css +++ b/src/ozones/Server/public/css/login.css @@ -133,12 +133,19 @@ div#login input#login_btn:hover { } .error_message { + width: 400px; + margin-left: auto; + margin-right: auto; display: none; position: relative; top: 80px; - font-family: Arial, Helvetica, sans-serif; - color:red; - font-size:1.6em; + font-size:1.0em; +} + +#login_spinner { + left: 44px; + position: relative; + top: 2px; } #label_remember { diff --git a/src/ozones/Server/public/js/login.js b/src/ozones/Server/public/js/login.js index 70b26a3011..1ddc1ecd61 100644 --- a/src/ozones/Server/public/js/login.js +++ b/src/ozones/Server/public/js/login.js @@ -23,15 +23,21 @@ function auth_error(req, error){ var status = error.error.http_status; switch (status){ - case 401: - $("#one_error").hide(); - $("#auth_error").fadeIn("slow"); - break; - case 500: - $("#auth_error").hide(); - $("#one_error").fadeIn("slow"); - break; - } + case 401: + $("#error_box").text("Invalid username or password"); + break; + case 500: + $("#error_box").text("OpenNebula is not running or there was a server exception. Please check the server logs."); + break; + case 0: + $("#error_box").text("No answer from server. Is it running?"); + break; + default: + $("#error_box").text("Unexpected error. Status "+status+". Check the server logs."); + + }; + $("#error_box").fadeIn("slow"); + $("#login_spinner").hide(); } function authenticate(){ @@ -39,6 +45,9 @@ function authenticate(){ var password = $("#password").val(); var remember = $("#check_remember").is(":checked"); + $("#error_box").fadeOut("slow"); + $("#login_spinner").show(); + oZones.Auth.login({ data: {username: username , password: password} , remember: remember @@ -61,4 +70,5 @@ $(document).ready(function(){ }; $("input#username.box").focus(); + $("#login_spinner").hide(); }); diff --git a/src/ozones/Server/public/js/plugins/vdcs-tab.js b/src/ozones/Server/public/js/plugins/vdcs-tab.js index 2077aa5e2e..d03b75c7f8 100644 --- a/src/ozones/Server/public/js/plugins/vdcs-tab.js +++ b/src/ozones/Server/public/js/plugins/vdcs-tab.js @@ -516,6 +516,10 @@ function setupCreateVDCDialog(){ function openCreateVDCDialog(){ var dialog = $('div#create_vdc_dialog') + if (!zones_select){ + notifyError(tr("No zones defined: You need to create at least 1 zone before creating an VDC")); + return false; + }; $('select#zoneid',dialog).html(zones_select); $('select#zoneid',dialog).trigger("change"); $('#vdc_available_hosts_list',dialog).empty(); diff --git a/src/ozones/Server/templates/login.html b/src/ozones/Server/templates/login.html index 6038b56e55..d1001aaaa4 100644 --- a/src/ozones/Server/templates/login.html +++ b/src/ozones/Server/templates/login.html @@ -3,7 +3,7 @@ OpenNebula oZones Login - + @@ -24,11 +24,7 @@
-
- Invalid username or password -
-
- OpenNebula is not running +
@@ -42,6 +38,7 @@ + retrieving
diff --git a/src/sunstone/public/css/login.css b/src/sunstone/public/css/login.css index 9c92aa9279..d275f49a57 100644 --- a/src/sunstone/public/css/login.css +++ b/src/sunstone/public/css/login.css @@ -134,10 +134,17 @@ div#login input#login_btn:hover { .error_message { display: none; position: relative; + width:400px; + margin-left: auto; + margin-right: auto; top: 80px; - font-family: Arial, Helvetica, sans-serif; - color:red; - font-size:1.6em; + font-size:1.0em; +} + +#login_spinner { + left: 44px; + position: relative; + top: 2px; } #label_remember { diff --git a/src/sunstone/public/js/login.js b/src/sunstone/public/js/login.js index 953f46aa1f..6b460d35c0 100644 --- a/src/sunstone/public/js/login.js +++ b/src/sunstone/public/js/login.js @@ -24,14 +24,19 @@ function auth_error(req, error){ switch (status){ case 401: - $("#one_error").hide(); - $("#auth_error").fadeIn("slow"); + $("#error_box").text("Invalid username or password"); break; case 500: - $("#auth_error").hide(); - $("#one_error").fadeIn("slow"); + $("#error_box").text("OpenNebula is not running or there was a server exception. Please check the server logs."); break; + case 0: + $("#error_box").text("No answer from server. Is it running?"); + break; + default: + $("#error_box").text("Unexpected error. Status "+status+". Check the server logs."); }; + $("#error_box").fadeIn("slow"); + $("#login_spinner").hide(); } function authenticate(){ @@ -39,6 +44,9 @@ function authenticate(){ var password = $("#password").val(); var remember = $("#check_remember").is(":checked"); + $("#error_box").fadeOut("slow"); + $("#login_spinner").show(); + OpenNebula.Auth.login({ data: {username: username , password: password} , remember: remember @@ -61,4 +69,5 @@ $(document).ready(function(){ }; $("input#username.box").focus(); + $("#login_spinner").hide(); }); diff --git a/src/sunstone/public/js/plugins/users-tab.js b/src/sunstone/public/js/plugins/users-tab.js index a9d35c164f..19d48435e1 100644 --- a/src/sunstone/public/js/plugins/users-tab.js +++ b/src/sunstone/public/js/plugins/users-tab.js @@ -131,9 +131,11 @@ var user_actions = { "User.passwd" : { type: "multiple", call: OpenNebula.User.passwd, - //nocallback + callback: function(req,res){ + notifyMessage(tr("Change password successful")); + }, elements: userElements, - error: onError + error: onError, }, "User.chgrp" : { type: "multiple", @@ -492,6 +494,7 @@ function popUpCreateUserDialog(){ function popUpUpdatePasswordDialog(){ + $('#new_password',$update_pw_dialog).val(""); $update_pw_dialog.dialog('open'); } diff --git a/src/sunstone/templates/login.html b/src/sunstone/templates/login.html index c942f3184f..1dc5352d14 100644 --- a/src/sunstone/templates/login.html +++ b/src/sunstone/templates/login.html @@ -3,6 +3,7 @@ OpenNebula Sunstone Login + @@ -25,11 +26,7 @@
-
- Invalid username or password -
-
- OpenNebula is not running +
@@ -43,6 +40,7 @@ + retrieving