1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-21 14:50:08 +03:00

feature #200: Fix troublesome deadlock

This commit is contained in:
Tino Vázquez 2010-06-21 19:27:04 +02:00
parent d6c547a35f
commit e38764e7e2
4 changed files with 22 additions and 19 deletions

View File

@ -298,10 +298,9 @@ def str_running_time(data)
end
def str_register_time(data)
regtime=Time.at(data["REGTIME"].to_i)
"%02d %02d:%02d:%02d" % [regtime.yday-1, regtime.hour,
regtime.min, regtime.sec]
regtime=Time.at(data["REGTIME"].to_i).getgm
regtime.strftime("%b %d, %Y %H:%M")
end

View File

@ -44,7 +44,7 @@ ShowTableImage={
:desc => "Name of the owner",
:size => 8,
:proc => lambda {|d,e|
d["USERNAME"]
d["UID"]
}
},
:name => {
@ -66,7 +66,7 @@ ShowTableImage={
:regtime => {
:name => "REGTIME",
:desc => "Registration time of the Image",
:size => 3,
:size => 20,
:proc => lambda {|d,e|
str_register_time(d)
}
@ -82,7 +82,7 @@ ShowTableImage={
:desc => "State of the Image",
:size => 2,
:proc => lambda {|d,e|
d.short_state_str
d.state_str
}
},
:runningvms => {
@ -134,7 +134,7 @@ class ImageShow
end
result=[true, ""]
header_vm_small
header_image_small
if options
puts @table.data_str(vms, options)
@ -240,7 +240,7 @@ def get_user_flags
ops
end
oneimage_opts=OnevmParse.new
oneimage_opts=OneImageParse.new
oneimage_opts.parse(ARGV)
ops=oneimage_opts.options
@ -286,7 +286,6 @@ when "list"
ops.merge!(get_user_flags)
if !ops[:xml]
imagelist=ImageShow.new(get_one_client, ops[:filter_user].to_i)
ops[:columns]=ops[:list] if ops[:list]
result=imagelist.list_short(ops)
else
@ -327,8 +326,8 @@ when "show"
puts str % ["REGISTER TIME", value]
puts str % ["PUBLIC", image[:public]]
puts str % ["STATE", image.state_str]
puts str % ["STATE", image[:runningvms]]
puts str % ["STATE", image.short_state_str]
puts str % ["RUNNING_VMS", image[:runningvms]]
puts
@ -339,10 +338,7 @@ when "show"
puts image.to_xml
end
end
else
oneimage_opts.print_help
exit -1
end
when "delete"
check_parameters("delete", 1)
@ -360,6 +356,10 @@ when "delete"
break
end
end
else
oneimage_opts.print_help
exit -1
end
if OpenNebula.is_error?(result)
puts "Error: " + result.message

View File

@ -76,6 +76,8 @@ ImagePool::ImagePool( SqlDB * db,
sql << "SELECT oid, name FROM " << Image::table;
rc = db->exec(sql, this);
unset_callback();
if ( rc != 0 )
{
@ -147,7 +149,7 @@ int ImagePool::allocate (
}
img->get_template_attribute("PUBLIC", public_attr);
TO_UPPER( public_attr );
TO_UPPER( public_attr );
img->image_template.erase("PUBLIC");
img->get_template_attribute("ORIGINAL_PATH", original_path);
@ -257,7 +259,7 @@ int ImagePool::dump(ostringstream& oss, const string& where)
set_callback(static_cast<Callbackable::Callback>(&ImagePool::dump_cb),
static_cast<void *>(&oss));
cmd << "SELECT * FROM " << Image::table;
if ( !where.empty() )
@ -268,6 +270,8 @@ int ImagePool::dump(ostringstream& oss, const string& where)
rc = db->exec(cmd, this);
oss << "</IMAGE_POOL>";
unset_callback();
return rc;
}

View File

@ -14,7 +14,7 @@ module OpenNebula
IMAGE_STATES=%w{INIT LOCKED READY USED}
IMAGE_HOST_STATES={
IMAGE_SHORT_STATES={
"INIT" => "lock",
"LOCKED" => "lock",
"READY" => "rdy",