mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-22 18:50:08 +03:00
Merge branch 'master' of git.opennebula.org:one
This commit is contained in:
commit
ac30c6589c
@ -166,6 +166,10 @@ public:
|
||||
};
|
||||
|
||||
~UserDelete(){};
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
||||
int drop(int oid, PoolObjectSQL * object, string& error_msg);
|
||||
};
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
@ -7,19 +7,23 @@ PACKAGES=%w{optional sunstone quota cloud ozones_client ozones_server
|
||||
|
||||
DEFAULT=%w{optional sunstone quota cloud ozones_server acct}
|
||||
|
||||
SQLITE='sqlite3-ruby --version 1.2.0'
|
||||
if defined?(RUBY_VERSION) && RUBY_VERSION>="1.8.7"
|
||||
SQLITE='sqlite3'
|
||||
else
|
||||
SQLITE='sqlite3-ruby --version 1.2.0'
|
||||
end
|
||||
|
||||
GROUPS={
|
||||
:optional => %w{nokogiri xmlparser},
|
||||
:quota => [SQLITE, 'sequel'],
|
||||
:sunstone => %w{json rack sinatra thin},
|
||||
:sunstone => ['json', 'rack', 'sinatra', 'thin', 'sequel', SQLITE],
|
||||
:cloud => %w{amazon-ec2 rack sinatra thin uuid curb},
|
||||
:ozones_client => %w{json},
|
||||
:ozones_server => %w{json datamapper dm-sqlite-adapter dm-mysql-adapter}+[
|
||||
:ozones_server => %w{json data_mapper dm-sqlite-adapter dm-mysql-adapter}+[
|
||||
SQLITE, 'mysql'
|
||||
],
|
||||
:ozones_server_sqlite => %w{json datamapper dm-sqlite-adapter}<<SQLITE,
|
||||
:ozones_server_mysql => %w{json datamapper dm-mysql-adapter mysql},
|
||||
:ozones_server_sqlite => %w{json data_mapper dm-sqlite-adapter}<<SQLITE,
|
||||
:ozones_server_mysql => %w{json data_mapper dm-mysql-adapter mysql},
|
||||
:acct => ['sequel', SQLITE, 'mysql'],
|
||||
:acct_sqlite => ['sequel', SQLITE],
|
||||
:acct_mysql => ['sequel', 'mysql']
|
||||
@ -105,9 +109,17 @@ def get_gems(packages)
|
||||
end
|
||||
|
||||
def detect_distro
|
||||
lsb_info=`lsb_release -a`
|
||||
if $?!=0 && false
|
||||
STDERR.puts("lsb_release command not found")
|
||||
begin
|
||||
lsb_info=`lsb_release -a`
|
||||
rescue
|
||||
end
|
||||
|
||||
if $?.exitstatus!=0
|
||||
STDERR.puts(<<-EOT.unindent(12))
|
||||
lsb_release command not found. If you are using a RedHat based
|
||||
distribution install redhat-lsb
|
||||
|
||||
EOT
|
||||
return nil
|
||||
end
|
||||
|
||||
|
@ -40,6 +40,8 @@ else
|
||||
LOCK_FILE=$ONE_LOCATION/var/.lock
|
||||
fi
|
||||
|
||||
KILL_9_SECONDS=5
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Function that checks for running daemons and gets PORT from conf
|
||||
#------------------------------------------------------------------------------
|
||||
@ -81,7 +83,19 @@ setup()
|
||||
stop()
|
||||
{
|
||||
if [ -f $ONE_PID ]; then
|
||||
kill `cat $ONE_PID` > /dev/null 2>&1
|
||||
PID=$(cat $ONE_PID)
|
||||
kill $PID > /dev/null 2>&1
|
||||
|
||||
counter=0
|
||||
while ps $PID > /dev/null 2>&1; do
|
||||
let counter=counter+1
|
||||
if [ $counter -gt $KILL_9_SECONDS ]; then
|
||||
kill -9 $PID > /dev/null 2>&1
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
|
||||
rm -f $ONE_PID > /dev/null 2>&1
|
||||
fi
|
||||
|
||||
|
@ -375,7 +375,7 @@ EOT
|
||||
def OpenNebulaHelper.update_template(id, resource)
|
||||
require 'tempfile'
|
||||
|
||||
tmp = Tempfile.new(id)
|
||||
tmp = Tempfile.new(id.to_s)
|
||||
path = tmp.path
|
||||
|
||||
tmp << resource.template_str
|
||||
|
@ -65,7 +65,7 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
|
||||
def format_resource(vm)
|
||||
str_h1="%-80s"
|
||||
str="%-20s: %-20s"
|
||||
|
||||
|
||||
CLIHelper.print_header(
|
||||
str_h1 % "VIRTUAL MACHINE #{vm['ID']} INFORMATION")
|
||||
puts str % ["ID", vm.id.to_s]
|
||||
@ -77,8 +77,10 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
|
||||
puts str % ["HOSTNAME",
|
||||
vm['/VM/HISTORY_RECORDS/HISTORY[last()]/HOSTNAME']] if
|
||||
%w{ACTIVE SUSPENDED}.include? vm.state_str
|
||||
puts str % ["START TIME", OpenNebulaHelper.time_to_str(vm['STIME'])]
|
||||
puts str % ["END TIME", OpenNebulaHelper.time_to_str(vm['ETIME'])]
|
||||
puts str % ["START TIME",
|
||||
OpenNebulaHelper.time_to_str(vm['/VM/STIME'])]
|
||||
puts str % ["END TIME",
|
||||
OpenNebulaHelper.time_to_str(vm['/VM/ETIME'])]
|
||||
value=vm['DEPLOY_ID']
|
||||
puts str % ["DEPLOY ID", value=="" ? "-" : value]
|
||||
|
||||
|
@ -213,14 +213,16 @@ module OpenNebula
|
||||
# Set the specified vm's disk to be saved in a new image
|
||||
# when the VirtualMachine shutdowns
|
||||
#
|
||||
# +disk_id+ ID of the disk to be saved
|
||||
# @param disk_id [Integer] ID of the disk to be saved
|
||||
# @param image_name [String] Name for the new image where the
|
||||
# disk will be saved
|
||||
#
|
||||
# +image_name+ Name for the new image where the disk will be saved
|
||||
# @return [Integer, OpenNebula::Error] the new Image ID in case of
|
||||
# success, error otherwise
|
||||
def save_as(disk_id, image_name)
|
||||
return Error.new('ID not defined') if !@pe_id
|
||||
|
||||
rc = @client.call(VM_METHODS[:savedisk], @pe_id, disk_id, image_name)
|
||||
rc = nil if !OpenNebula.is_error?(rc)
|
||||
|
||||
return rc
|
||||
end
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/ruby
|
||||
#!/usr/bin/env ruby
|
||||
|
||||
ONE_LOCATION=ENV["ONE_LOCATION"]
|
||||
|
||||
@ -15,7 +15,7 @@ require 'command_parser'
|
||||
require 'ozones_helper/vdc_helper.rb'
|
||||
|
||||
cmd=CommandParser::CmdParser.new(ARGV) do
|
||||
usage "ovdcs COMMAND [args..] [options..]"
|
||||
usage "`ovdcs` command [<args>] [<options>]"
|
||||
version OpenNebulaHelper::ONE_VERSION
|
||||
|
||||
########################################################################
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/ruby
|
||||
#!/usr/bin/env ruby
|
||||
|
||||
ONE_LOCATION=ENV["ONE_LOCATION"]
|
||||
|
||||
@ -15,7 +15,7 @@ require 'command_parser'
|
||||
require 'ozones_helper/zones_helper.rb'
|
||||
|
||||
cmd=CommandParser::CmdParser.new(ARGV) do
|
||||
usage "ozones COMMAND [args..] [options..]"
|
||||
usage "`ozones` <command> [<args>] [<options>]"
|
||||
version OpenNebulaHelper::ONE_VERSION
|
||||
|
||||
########################################################################
|
||||
|
@ -66,12 +66,15 @@ start()
|
||||
echo "The port $PORT is being used. Please specify a different one."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
# Start the ozones daemon
|
||||
touch $OZONES_LOCK_FILE
|
||||
rackup $OZONES_SERVER -s thin -p $PORT -o $HOST \
|
||||
-P $OZONES_PID &> $OZONES_LOG &
|
||||
|
||||
sleep 2
|
||||
ps -p $(cat $OZONES_PID 2>/dev/null) > /dev/null 2>&1
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Error executing $OZONES_SERVER, please check the log $OZONES_LOG"
|
||||
exit 1
|
||||
|
@ -70,3 +70,32 @@ int ImageDelete::drop(int oid, PoolObjectSQL * object, string& error_msg)
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
int UserDelete::drop(int oid, PoolObjectSQL * object, string& error_msg)
|
||||
{
|
||||
User * user = static_cast<User *>(object);
|
||||
int group_id = user->get_gid();
|
||||
|
||||
int rc = pool->drop(object, error_msg);
|
||||
|
||||
object->unlock();
|
||||
|
||||
if ( rc == 0 )
|
||||
{
|
||||
Nebula& nd = Nebula::instance();
|
||||
GroupPool * gpool = nd.get_gpool();
|
||||
|
||||
Group * group = gpool->get(group_id, true);
|
||||
|
||||
if( group != 0 )
|
||||
{
|
||||
group->del_user(oid);
|
||||
gpool->update(group);
|
||||
|
||||
group->unlock();
|
||||
}
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user