1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-01-17 02:03:40 +03:00

Merge branch 'one-2.0' of dsa-research.org:one into one-2.0

This commit is contained in:
Ruben S. Montero 2010-09-08 22:38:47 +02:00
commit b7263201d7
6 changed files with 42 additions and 11 deletions

View File

@ -206,6 +206,9 @@ Commands:
template is a file name where the Image description is located
* addattr (Add a new image attribute)
oneimage addattr <image_id> <attribute_name> <attribute_value>
* update (Modifies an image attribute)
oneimage update <image_id> <attribute_name> <attribute_value>
@ -333,7 +336,7 @@ when "register", "create", "add"
end
when "update"
when "update", "addattr"
check_parameters("update", 3)
image_id=get_image_id(ARGV[0])

View File

@ -57,18 +57,21 @@ class InformationManager < OpenNebulaDriver
# Execute the run_probes in the remote host
#---------------------------------------------------------------------------
def action_monitor(number, host, do_update)
log_lambda=lambda do |message|
log(number, message)
end
if do_update == "1"
# Use SCP to sync:
sync_cmd = "scp -r #{REMOTES_LOCATION}/. #{host}:#{@remote_dir}"
# Use rsync to sync:
# sync_cmd = "rsync -Laz #{REMOTES_LOCATION} #{host}:#{@remote_dir}"
LocalCommand.run(sync_cmd)
else
LocalCommand.run(sync_cmd, log_lambda)
end
cmd = SSHCommand.run("#{@remote_dir}/im/run_probes #{@hypervisor}",
host)
cmd = SSHCommand.run("#{@remote_dir}/im/run_probes #{@hypervisor}",
host, log_lambda)
if cmd.code == 0
send_message("MONITOR", RESULT[:success], number, cmd.stdout)

View File

@ -27,6 +27,7 @@ end
######
nodeinfo_text = `virsh -c qemu:///system nodeinfo`
exit(-1) if $?!=0
nodeinfo_text.split(/\n/).each{|line|
if line.match('^CPU\(s\)')
@ -45,6 +46,8 @@ nodeinfo_text.split(/\n/).each{|line|
NETINTERFACE = "eth1"
top_text=`top -bin2`
exit(-1) if $?!=0
top_text.gsub!(/^top.*^top.*?$/m, "") # Strip first top output
top_text.split(/\n/).each{|line|
@ -73,6 +76,7 @@ top_text.split(/\n/).each{|line|
$free_memory=`free -k|grep "buffers\/cache"|awk '{print $4}'`
net_text=`cat /proc/net/dev`
exit(-1) if $?!=0
net_text.split(/\n/).each{|line|
if line.match("^ *#{NETINTERFACE}")

View File

@ -29,6 +29,11 @@ function run_dir {
for i in `ls *`;do
if [ -x "$i" ]; then
./$i
EXIT_CODE=$?
if [ "x$EXIT_CODE" != "x0" ]; then
echo "Error executing $i" 1>&2
exit $EXIT_CODE
fi
fi
done
)
@ -36,9 +41,23 @@ function run_dir {
data=$(
run_dir 'common.d'
EXIT_CODE=$?
if [ "x$EXIT_CODE" != "x0" ]; then
exit $EXIT_CODE
fi
if [ -d "$HYPERVISOR_DIR" ]; then
run_dir $HYPERVISOR_DIR
fi
)
EXIT_CODE=$?
echo $data | tr '\n' ' '
if [ "x$EXIT_CODE" != "x0" ]; then
exit $EXIT_CODE
fi

View File

@ -27,7 +27,10 @@ def print_info(name, value)
end
xentop_text=`sudo #{XENTOP_PATH} -bi2`
exit(-1) if $?!=0
xm_text=`sudo #{XM_PATH} info`
exit(-1) if $?!=0
xentop_text.gsub!(/^xentop.*^xentop.*?$/m, "") # Strip first top output
xentop_text.gsub!("no limit", "no_limit")

View File

@ -7,15 +7,14 @@ module OpenNebula
def create(image, template, copy=true)
if image.nil?
error_msg = "Image could not be found, aborting."
result = OpenNebula::Error.new(error_msg)
return OpenNebula::Error.new(error_msg)
end
# ------ Allocate the Image ------
result = image.allocate(template)
if OpenNebula.is_error?(result)
puts result.message
exit -1
return result
end
@ -29,7 +28,7 @@ module OpenNebula
if !File.exists?(file_path)
error_msg = "Image file could not be found, aborting."
result = OpenNebula::Error.new(error_msg)
return OpenNebula::Error.new(error_msg)
end
result = copy(file_path, image['SOURCE'])
@ -61,7 +60,7 @@ module OpenNebula
def delete(image)
if image.nil?
error_msg = "Image could not be found, aborting."
result = OpenNebula::Error.new(error_msg)
return OpenNebula::Error.new(error_msg)
end
result = image.info
@ -82,7 +81,7 @@ module OpenNebula
def update_source(image, source)
if image.nil?
error_msg = "Image could not be found, aborting."
result = OpenNebula::Error.new(error_msg)
return OpenNebula::Error.new(error_msg)
end
result = image.info