diff --git a/include/Group.h b/include/Group.h index f732811b33..ff21f8e06a 100644 --- a/include/Group.h +++ b/include/Group.h @@ -1,5 +1,5 @@ /* ------------------------------------------------------------------------ */ -/* Copyright 2002-2010, OpenNebula Project Leads (OpenNebula.org) */ +/* 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 */ diff --git a/include/Nebula.h b/include/Nebula.h index 082c4f5fb7..fbfc81d6f6 100644 --- a/include/Nebula.h +++ b/include/Nebula.h @@ -228,7 +228,7 @@ public: static string version() { - return "OpenNebula 2.3.0"; + return "OpenNebula 2.9.80"; }; static string db_version() diff --git a/install.sh b/install.sh index 684b69caba..b74d9c9864 100755 --- a/install.sh +++ b/install.sh @@ -912,7 +912,7 @@ SUNSTONE_PUBLIC_IMAGES_FILES="src/sunstone/public/images/ajax-loader.gif \ # ACCT files #----------------------------------------------------------------------------- -ACCT_BIN_FILES="src/acct/acctd" +ACCT_BIN_FILES="src/acct/oneacctd" ACCT_LIB_FILES="src/acct/monitoring.rb \ src/acct/accounting.rb \ diff --git a/share/bundler/Gemfile b/share/bundler/Gemfile index aeea6a1363..2c1a01207f 100644 --- a/share/bundler/Gemfile +++ b/share/bundler/Gemfile @@ -54,6 +54,22 @@ group :ozones_server_sqlite do gem 'dm-sqlite-adapter' end +group :acct do + gem 'sequel' + gem 'sqlite3' + gem 'mysql' +end + +group :acct_sqlite do + gem 'sequel' + gem 'sqlite3' +end + +group :acct_mysql do + gem 'sequel' + gem 'mysql' +end + diff --git a/share/bundler/install_gems b/share/bundler/install_gems index baee64cb18..a2ccb62942 100755 --- a/share/bundler/install_gems +++ b/share/bundler/install_gems @@ -3,7 +3,7 @@ PACKAGES=%w{optional sunstone quota cloud ozones_client ozones_server ozones_server_mysql ozones_server_sqlite} -DEFAULT=%w{optional sunstone quota cloud ozones_server} +DEFAULT=%w{optional sunstone quota cloud ozones_server acct} class String @@ -21,6 +21,29 @@ def try_library(name, error_message) end end +def install_warning(packages) + puts "Use -h for help" + puts + puts "About to install the gems for these components:" + puts "* "<0 packages=ARGV @@ -58,8 +85,10 @@ no_packages<<'dummy' without="--without #{no_packages.join(' ')}" -command_string = "bundle #{without}" +command_string = "bundle install #{without}" + +install_warning(packages) puts command_string -#system command_string +system command_string diff --git a/src/acct/etc/acctd.conf b/src/acct/etc/acctd.conf index 7b4e099817..bfb1879c88 100644 --- a/src/acct/etc/acctd.conf +++ b/src/acct/etc/acctd.conf @@ -15,7 +15,7 @@ #--------------------------------------------------------------------------- # # Database URI -:DB: sqlite:///tmp/test_one_acct.db +#:DB: sqlite:///var/one/oneacct.db # Duration of each daemon loop in seconds :STEP: 300 # 5 minutes diff --git a/src/acct/acctd b/src/acct/oneacctd similarity index 85% rename from src/acct/acctd rename to src/acct/oneacctd index 5b0a8283bc..195b5f492d 100755 --- a/src/acct/acctd +++ b/src/acct/oneacctd @@ -60,7 +60,28 @@ start) # acctd not running, safe to start $ACCTD_CMD &> $ACCTD_LOG & - echo $! > $ACCTD_PID_FILE + + LASTRC=$? + LASTPID=$! + + if [ $LASTRC -ne 0 ]; then + echo "Error executing acctd." + echo "Check $ACCTD_LOG for more information" + exit 1 + else + echo $LASTPID > $ACCTD_PID_FILE + fi + + sleep 2 + ps $LASTPID > /dev/null 2>&1 + + if [ $? -ne 0 ]; then + echo "Error executing acctd." + echo "Check $ACCTD_LOG for more information" + exit 1 + fi + + echo "acctd started" ;; stop) # check if running @@ -74,6 +95,8 @@ stop) ACCTD_PID=`cat $ACCTD_PID_FILE 2>/dev/null` kill $ACCTD_PID &> /dev/null rm -f $ACCTD_PID_FILE &> /dev/null + + echo "acctd stop" ;; *) echo "Usage: acctd {start|stop}" >&2 diff --git a/src/acct/watch_helper.rb b/src/acct/watch_helper.rb index 4cc5ab9c98..c9112b2496 100644 --- a/src/acct/watch_helper.rb +++ b/src/acct/watch_helper.rb @@ -6,13 +6,20 @@ module WatchHelper if !ONE_LOCATION ACCTD_CONF="/etc/one/acctd.conf" + ACCT_DB="/var/one/oneacct.db" else ACCTD_CONF=ONE_LOCATION+"/etc/acctd.conf" + ACCT_DB=ONE_LOCATION+"/var/oneacct.db" end CONF = YAML.load_file(ACCTD_CONF) - DB = Sequel.connect(CONF[:DB]) + if CONF[:DB] + DB = Sequel.connect(CONF[:DB]) + else + DB = Sequel.connect("sqlite//#{ACCT_DB}") + end + VM_DELTA = { :net_rx => { :type => Integer, diff --git a/src/cli/cli_helper.rb b/src/cli/cli_helper.rb index daa359c665..92cc0b5045 100644 --- a/src/cli/cli_helper.rb +++ b/src/cli/cli_helper.rb @@ -192,8 +192,7 @@ module CLIHelper size=@columns[field][:size] return "%#{minus}#{size}.#{size}s" % [ data.to_s ] else - puts "Column not defined" - exit -1 + exit -1, "Column not defined" end end diff --git a/src/cli/command_parser.rb b/src/cli/command_parser.rb index 6190027c2d..166566c3ac 100755 --- a/src/cli/command_parser.rb +++ b/src/cli/command_parser.rb @@ -169,13 +169,7 @@ EOT if comm check_args!(comm_name, comm[:arity], comm[:args_format]) - begin - rc = comm[:proc].call - rescue Exception =>e - puts e.message - exit -1 - end - + rc = comm[:proc].call if rc.instance_of?(Array) puts rc[1] exit rc.first diff --git a/src/cli/etc/group.default b/src/cli/etc/group.default new file mode 100644 index 0000000000..98b60b3931 --- /dev/null +++ b/src/cli/etc/group.default @@ -0,0 +1,4 @@ +# This rule allows users in the new group to create common resources +VM+NET+IMAGE+TEMPLATE/* CREATE +# This rule allows users in the group to deploy VMs in any host in the cloud +HOST/* USE diff --git a/src/cli/one_helper.rb b/src/cli/one_helper.rb index 1a918b89ef..7ab77512f8 100644 --- a/src/cli/one_helper.rb +++ b/src/cli/one_helper.rb @@ -21,7 +21,7 @@ include OpenNebula module OpenNebulaHelper ONE_VERSION=<<-EOT -OpenNebula 2.3.0 +OpenNebula 2.9.80 Copyright 2002-2011, OpenNebula Project Leads (OpenNebula.org) Licensed under the Apache License, Version 2.0 (the "License"); you may diff --git a/src/cloud/common/CloudClient.rb b/src/cloud/common/CloudClient.rb index 8a4d436927..509b7ab98b 100644 --- a/src/cloud/common/CloudClient.rb +++ b/src/cloud/common/CloudClient.rb @@ -173,7 +173,7 @@ module CloudCLI def version_text version=<OpenNebula
Cloud API' \ -bottom 'Visit OpenNebula.org
Copyright 2002-2010 © +href="http://opennebula.org/">OpenNebula.org
Copyright 2002-2011 © OpenNebula Project Leads (OpenNebula.org).' } diff --git a/src/pool/PoolObjectSQL.cc b/src/pool/PoolObjectSQL.cc index 07684932b3..390a31da33 100644 --- a/src/pool/PoolObjectSQL.cc +++ b/src/pool/PoolObjectSQL.cc @@ -1,5 +1,5 @@ /* -------------------------------------------------------------------------- */ -/* Copyright 2002-2010, OpenNebula Project Leads (OpenNebula.org) */ +/* 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 */ diff --git a/src/scheduler/src/client/SConstruct b/src/scheduler/src/client/SConstruct index d9509465b1..74642b8d42 100644 --- a/src/scheduler/src/client/SConstruct +++ b/src/scheduler/src/client/SConstruct @@ -1,7 +1,7 @@ # SConstruct for src/pool # -------------------------------------------------------------------------- # -# Copyright 2002-2010, OpenNebula Project Leads (OpenNebula.org) # +# 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 # diff --git a/src/sunstone/views/index.erb b/src/sunstone/views/index.erb index b77533915e..22087fa722 100644 --- a/src/sunstone/views/index.erb +++ b/src/sunstone/views/index.erb @@ -67,7 +67,7 @@