diff --git a/install.sh b/install.sh index b5c507ac43..ccddf49715 100755 --- a/install.sh +++ b/install.sh @@ -40,6 +40,7 @@ usage() { echo "-d: target installation directory, if not defined it'd be root. Must be" echo " an absolute path." echo "-c: install client utilities: OpenNebula cli, occi and ec2 client files" + echo "-s: install OpenNebula Sunstone" echo "-r: remove Opennebula, only useful if -d was not specified, otherwise" echo " rm -rf \$ONE_LOCATION would do the job" echo "-l: creates symlinks instead of copying files, useful for development" @@ -47,7 +48,7 @@ usage() { } #------------------------------------------------------------------------------- -TEMP_OPT=`getopt -o hkrlcu:g:d: -n 'install.sh' -- "$@"` +TEMP_OPT=`getopt -o hkrlcsu:g:d: -n 'install.sh' -- "$@"` if [ $? != 0 ] ; then usage @@ -60,6 +61,7 @@ INSTALL_ETC="yes" UNINSTALL="no" LINK="no" CLIENT="no" +SUNSTONE="no" ONEADMIN_USER=`id -u` ONEADMIN_GROUP=`id -g` SRC_DIR=$PWD @@ -70,7 +72,8 @@ while true ; do -k) INSTALL_ETC="no" ; shift ;; -r) UNINSTALL="yes" ; shift ;; -l) LINK="yes" ; shift ;; - -c) CLIENT="yes" ; shift ;; + -c) CLIENT="yes"; INSTALL_ETC="no" ; shift ;; + -s) SUNSTONE="yes"; INSTALL_ETC="no" ; shift ;; -u) ONEADMIN_USER="$2" ; shift 2;; -g) ONEADMIN_GROUP="$2"; shift 2;; -d) ROOT="$2" ; shift 2 ;; @@ -89,6 +92,7 @@ if [ -z "$ROOT" ] ; then ETC_LOCATION="/etc/one" LOG_LOCATION="/var/log/one" VAR_LOCATION="/var/lib/one" + SUNSTONE_LOCATION="$LIB_LOCATION/sunstone" IMAGES_LOCATION="$VAR_LOCATION/images" RUN_LOCATION="/var/run/one" LOCK_LOCATION="/var/lock/one" @@ -96,7 +100,19 @@ if [ -z "$ROOT" ] ; then SHARE_LOCATION="/usr/share/one" MAN_LOCATION="/usr/share/man/man8" - if [ "$CLIENT" = "no" ]; then + if [ "$CLIENT" = "yes" ]; then + MAKE_DIRS="$BIN_LOCATION $LIB_LOCATION" + + DELETE_DIRS="" + + CHOWN_DIRS="" + elif [ "$SUNSTONE" = "yes" ]; then + MAKE_DIRS="$BIN_LOCATION $LIB_LOCATION $VAR_LOCATION $SUNSTONE_LOCATION" + + DELETE_DIRS="$MAKE_DIRS" + + CHOWN_DIRS="" + else MAKE_DIRS="$BIN_LOCATION $LIB_LOCATION $ETC_LOCATION $VAR_LOCATION \ $INCLUDE_LOCATION $SHARE_LOCATION \ $LOG_LOCATION $RUN_LOCATION $LOCK_LOCATION \ @@ -106,12 +122,6 @@ if [ -z "$ROOT" ] ; then $RUN_LOCATION $SHARE_DIRS" CHOWN_DIRS="$LOG_LOCATION $VAR_LOCATION $RUN_LOCATION $LOCK_LOCATION" - else - MAKE_DIRS="$BIN_LOCATION $LIB_LOCATION" - - DELETE_DIRS="" - - CHOWN_DIRS="" fi else @@ -119,12 +129,21 @@ else LIB_LOCATION="$ROOT/lib" ETC_LOCATION="$ROOT/etc" VAR_LOCATION="$ROOT/var" + SUNSTONE_LOCATION="$LIB_LOCATION/sunstone" IMAGES_LOCATION="$VAR_LOCATION/images" INCLUDE_LOCATION="$ROOT/include" SHARE_LOCATION="$ROOT/share" MAN_LOCATION="$ROOT/share/man/man8" - if [ "$CLIENT" = "no" ]; then + if [ "$CLIENT" = "yes" ]; then + MAKE_DIRS="$BIN_LOCATION $LIB_LOCATION" + + DELETE_DIRS="$MAKE_DIRS" + elif [ "$SUNSTONE" = "yes" ]; then + MAKE_DIRS="$BIN_LOCATION $LIB_LOCATION $VAR_LOCATION $SUNSTONE_LOCATION" + + DELETE_DIRS="$MAKE_DIRS" + else MAKE_DIRS="$BIN_LOCATION $LIB_LOCATION $ETC_LOCATION $VAR_LOCATION \ $INCLUDE_LOCATION $SHARE_LOCATION $IMAGES_LOCATION \ $MAN_LOCATION" @@ -132,10 +151,6 @@ else DELETE_DIRS="$MAKE_DIRS" CHOWN_DIRS="$ROOT" - else - MAKE_DIRS="$BIN_LOCATION $LIB_LOCATION" - - DELETE_DIRS="$MAKE_DIRS" fi CHOWN_DIRS="$ROOT" @@ -188,6 +203,16 @@ VAR_DIRS="$VAR_LOCATION/remotes \ $VAR_LOCATION/remotes/vmm/xen \ $VAR_LOCATION/remotes/vmm/kvm" +SUNSTONE_DIRS="$SUNSTONE_LOCATION/models \ + $SUNSTONE_LOCATION/models/OpenNebulaJSON \ + $SUNSTONE_LOCATION/public \ + $SUNSTONE_LOCATION/public/js \ + $SUNSTONE_LOCATION/public/js/vendor \ + $SUNSTONE_LOCATION/public/css \ + $SUNSTONE_LOCATION/public/css/vendor \ + $SUNSTONE_LOCATION/public/images \ + $SUNSTONE_LOCATION/templates" + LIB_ECO_CLIENT_DIRS="$LIB_LOCATION/ruby \ $LIB_LOCATION/ruby/OpenNebula \ $LIB_LOCATION/ruby/cloud/ \ @@ -197,14 +222,19 @@ LIB_OCCI_CLIENT_DIRS="$LIB_LOCATION/ruby \ $LIB_LOCATION/ruby/OpenNebula \ $LIB_LOCATION/ruby/cloud/occi" +LIB_OCA_CLIENT_DIRS="$LIB_LOCATION/ruby \ + $LIB_LOCATION/ruby/OpenNebula" + LIB_CLI_DIRS="$LIB_LOCATION/ruby \ $LIB_LOCATION/ruby/OpenNebula" -if [ "$CLIENT" = "no" ]; then - MAKE_DIRS="$MAKE_DIRS $SHARE_DIRS $ETC_DIRS $LIB_DIRS $VAR_DIRS" -else +if [ "$CLIENT" = "yes" ]; then MAKE_DIRS="$MAKE_DIRS $LIB_ECO_CLIENT_DIRS $LIB_OCCI_CLIENT_DIRS \ $LIB_CLI_DIRS" +elif [ "$SUNSTONE" = "yes" ]; then + MAKE_DIRS="$MAKE_DIRS $SUNSTONE_DIRS $LIB_OCA_CLIENT_DIRS" +else + MAKE_DIRS="$MAKE_DIRS $SHARE_DIRS $ETC_DIRS $LIB_DIRS $VAR_DIRS $SUNSTONE_DIRS" fi #------------------------------------------------------------------------------- @@ -267,6 +297,21 @@ INSTALL_CLIENT_FILES=( RUBY_OPENNEBULA_LIB_FILES:$LIB_LOCATION/ruby/OpenNebula ) +INSTALL_SUNSTONE_FILES=( + SUNSTONE_FILES:$SUNSTONE_LOCATION + SUNSTONE_BIN_FILES:$BIN_LOCATION + SUNSTONE_MODELS_FILES:$SUNSTONE_LOCATION/models + SUNSTONE_MODELS_JSON_FILES:$SUNSTONE_LOCATION/models/OpenNebulaJSON + SUNSTONE_TEMPLATE_FILES:$SUNSTONE_LOCATION/templates + SUNSTONE_PUBLIC_JS_FILES:$SUNSTONE_LOCATION/public/js + SUNSTONE_PUBLIC_JS_VENDOR_FILES:$SUNSTONE_LOCATION/public/js/vendor + SUNSTONE_PUBLIC_CSS_FILES:$SUNSTONE_LOCATION/public/css + SUNSTONE_PUBLIC_CSS_VENDOR_FILES:$SUNSTONE_LOCATION/public/css/vendor + SUNSTONE_PUBLIC_IMAGES_FILES:$SUNSTONE_LOCATION/public/images + SUNSTONE_RUBY_LIB_FILES:$LIB_LOCATION/ruby + RUBY_OPENNEBULA_LIB_FILES:$LIB_LOCATION/ruby/OpenNebula +) + INSTALL_ETC_FILES=( ETC_FILES:$ETC_LOCATION VMM_EC2_ETC_FILES:$ETC_LOCATION/vmm_ec2 @@ -646,6 +691,80 @@ CLI_BIN_FILES="src/cli/onevm \ src/cli/oneimage \ src/cli/onecluster" +#----------------------------------------------------------------------------- +# Sunstone files +#----------------------------------------------------------------------------- + +SUNSTONE_FILES="src/sunstone/config.ru \ + src/sunstone/sunstone-server.rb" + +SUNSTONE_BIN_FILES="src/sunstone/bin/sunstone-server" + +SUNSTONE_MODELS_FILES="src/sunstone/models/OpenNebulaJSON.rb \ + src/sunstone/models/SunstoneServer.rb" + +SUNSTONE_MODELS_JSON_FILES="src/sunstone/models/OpenNebulaJSON/ClusterJSON.rb \ + src/sunstone/models/OpenNebulaJSON/HostJSON.rb \ + src/sunstone/models/OpenNebulaJSON/ImageJSON.rb \ + src/sunstone/models/OpenNebulaJSON/JSONUtils.rb \ + src/sunstone/models/OpenNebulaJSON/PoolJSON.rb \ + src/sunstone/models/OpenNebulaJSON/UserJSON.rb \ + src/sunstone/models/OpenNebulaJSON/VirtualMachineJSON.rb \ + src/sunstone/models/OpenNebulaJSON/VirtualNetworkJSON.rb" + +SUNSTONE_TEMPLATE_FILES="src/sunstone/templates/index.html \ + src/sunstone/templates/login.html" + +SUNSTONE_PUBLIC_JS_FILES="src/sunstone/public/js/layout.js \ + src/sunstone/public/js/login.js \ + src/sunstone/public/js/one-ui_views.js \ + src/sunstone/public/js/one-ui_views.templates.js \ + src/sunstone/public/js/opennebula.js" + +SUNSTONE_PUBLIC_JS_VENDOR_FILES="src/sunstone/public/js/vendor/base64.js \ + src/sunstone/public/js/vendor/jquery-1.4.4.min.js \ + src/sunstone/public/js/vendor/jquery.dataTables.min.js \ + src/sunstone/public/js/vendor/jquery.jgrowl_minimized.js \ + src/sunstone/public/js/vendor/jquery.layout.min-1.2.0.js \ + src/sunstone/public/js/vendor/jquery-ui-1.8.7.custom.min.js" + +SUNSTONE_PUBLIC_CSS_FILES="src/sunstone/public/css/application.css \ + src/sunstone/public/css/demo_table_jui.css \ + src/sunstone/public/css/jquery.jgrowl.css \ + src/sunstone/public/css/layout.css \ + src/sunstone/public/css/layout-default-latest.css \ + src/sunstone/public/css/login.css" + +SUNSTONE_PUBLIC_CSS_VENDOR_FILES="\ + src/sunstone/public/css/vendor/jquery-ui-1.8.7.custom.css \ + src/sunstone/public/css/vendor/ui-bg_flat_0_575c5b_40x100.png \ + src/sunstone/public/css/vendor/ui-bg_flat_0_8f9392_40x100.png \ + src/sunstone/public/css/vendor/ui-bg_flat_0_aaaaaa_40x100.png \ + src/sunstone/public/css/vendor/ui-bg_flat_75_ffffff_40x100.png \ + src/sunstone/public/css/vendor/ui-bg_glass_55_fbf9ee_1x400.png \ + src/sunstone/public/css/vendor/ui-bg_glass_65_ffffff_1x400.png \ + src/sunstone/public/css/vendor/ui-bg_glass_75_dadada_1x400.png \ + src/sunstone/public/css/vendor/ui-bg_glass_75_e6e6e6_1x400.png \ + src/sunstone/public/css/vendor/ui-bg_glass_95_fef1ec_1x400.png \ + src/sunstone/public/css/vendor/ui-bg_highlight-soft_75_cccccc_1x100.png \ + src/sunstone/public/css/vendor/ui-icons_222222_256x240.png \ + src/sunstone/public/css/vendor/ui-icons_2e83ff_256x240.png \ + src/sunstone/public/css/vendor/ui-icons_454545_256x240.png \ + src/sunstone/public/css/vendor/ui-icons_888888_256x240.png \ + src/sunstone/public/css/vendor/ui-icons_cd0a0a_256x240.png" + +SUNSTONE_PUBLIC_IMAGES_FILES="src/sunstone/public/images/ajax-loader.gif \ + src/sunstone/public/images/login_over.png \ + src/sunstone/public/images/login.png \ + src/sunstone/public/images/opennebula-sunstone-big.png \ + src/sunstone/public/images/opennebula-sunstone-small.png \ + src/sunstone/public/images/panel.png \ + src/sunstone/public/images/pbar.gif \ + src/sunstone/public/images/Refresh-icon.png" + +SUNSTONE_RUBY_LIB_FILES="src/mad/ruby/CommandManager.rb \ + src/oca/ruby/OpenNebula.rb" + #----------------------------------------------------------------------------- # MAN files #----------------------------------------------------------------------------- @@ -696,10 +815,12 @@ do_file() { } -if [ "$CLIENT" = "no" ]; then - INSTALL_SET=${INSTALL_FILES[@]} -else +if [ "$CLIENT" = "yes" ]; then INSTALL_SET=${INSTALL_CLIENT_FILES[@]} +elif [ "$SUNSTONE" = "yes" ]; then + INSTALL_SET=${INSTALL_SUNSTONE_FILES[@]} +else + INSTALL_SET="${INSTALL_FILES[@]} ${INSTALL_SUNSTONE_FILES[@]}" fi for i in ${INSTALL_SET[@]}; do @@ -713,7 +834,7 @@ for i in ${INSTALL_SET[@]}; do done done -if [ "$CLIENT" = "no" -a "$INSTALL_ETC" = "yes" ] ; then +if [ "$INSTALL_ETC" = "yes" ] ; then for i in ${INSTALL_ETC_FILES[@]}; do SRC=$`echo $i | cut -d: -f1` DST=`echo $i | cut -d: -f2` diff --git a/src/sunstone/bin/sunstone-server b/src/sunstone/bin/sunstone-server old mode 100644 new mode 100755 index 5ac68703d0..977750dd03 --- a/src/sunstone/bin/sunstone-server +++ b/src/sunstone/bin/sunstone-server @@ -1,3 +1,22 @@ +#!/bin/bash + +# -------------------------------------------------------------------------- # +# Copyright 2002-2011, OpenNebula Project Leads (OpenNebula.org) # +# # +# Licensed under the Apache License, Version 2.0 (the "License"); you may # +# not use this file except in compliance with the License. You may obtain # +# a copy of the License at # +# # +# http://www.apache.org/licenses/LICENSE-2.0 # +# # +# Unless required by applicable law or agreed to in writing, software # +# distributed under the License is distributed on an "AS IS" BASIS, # +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # +# See the License for the specific language governing permissions and # +# limitations under the License. # +#--------------------------------------------------------------------------- # + + if [ -z "$ONE_LOCATION" ]; then SUNSTONE_PID=/var/run/one/sunstone.pid SUNSTONE_SERVER=/usr/lib/one/sunstone/config.ru @@ -99,4 +118,4 @@ case "$1" in echo "Usage: sunstone {start|stop}" >&2 exit 3 ;; -esac \ No newline at end of file +esac diff --git a/src/sunstone/models/SunstoneServer.rb b/src/sunstone/models/SunstoneServer.rb index d42a10fceb..fbb9422c82 100644 --- a/src/sunstone/models/SunstoneServer.rb +++ b/src/sunstone/models/SunstoneServer.rb @@ -16,6 +16,14 @@ # TBD Change path for intallation tree +ONE_LOCATION = ENV["ONE_LOCATION"] + +if !ONE_LOCATION + VAR_LOCATION = "/var/lib/one" +else + VAR_LOCATION = ONE_LOCATION+"/var" +end + #require 'OpenNebulaJSON' require 'models/OpenNebulaJSON' include OpenNebulaJSON @@ -154,7 +162,7 @@ class SunstoneServer if user_id != "0" return [401, ""] end - + one_config = VAR_LOCATION + "/config" config = Hash.new diff --git a/src/sunstone/public/css/vendor/ui-icons_222222_256x240.png.old b/src/sunstone/public/css/vendor/ui-icons_222222_256x240.png.old deleted file mode 100644 index b273ff111d..0000000000 Binary files a/src/sunstone/public/css/vendor/ui-icons_222222_256x240.png.old and /dev/null differ diff --git a/src/sunstone/public/images/box_gradient.png b/src/sunstone/public/images/box_gradient.png deleted file mode 100644 index 4e2c718c0c..0000000000 Binary files a/src/sunstone/public/images/box_gradient.png and /dev/null differ diff --git a/src/sunstone/public/js/one-ui_views.js b/src/sunstone/public/js/one-ui_views.js index a3f27fb042..c36757be0f 100644 --- a/src/sunstone/public/js/one-ui_views.js +++ b/src/sunstone/public/js/one-ui_views.js @@ -2732,7 +2732,7 @@ function deleteVMachineElement(req){ } function addVMachineElement(request,vm_json){ - id = vm_json.VM,ID; + id = vm_json.VM.ID; notifySubmit('OpenNebula.VM.create',id); element = vMachineElementArray(vm_json); addElement(element,dataTable_vMachines); @@ -3020,7 +3020,7 @@ function updateVMInfo(request,vm){ \