diff --git a/src/cli/client_utilities.rb b/src/cli/client_utilities.rb index 4419b9dd91..4386d8dbd9 100644 --- a/src/cli/client_utilities.rb +++ b/src/cli/client_utilities.rb @@ -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 diff --git a/src/cli/oneimage b/src/cli/oneimage index b96ce18d71..f8f2e52790 100755 --- a/src/cli/oneimage +++ b/src/cli/oneimage @@ -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 diff --git a/src/image/ImagePool.cc b/src/image/ImagePool.cc index 5eda9d392d..cd53daf15d 100644 --- a/src/image/ImagePool.cc +++ b/src/image/ImagePool.cc @@ -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(&ImagePool::dump_cb), static_cast(&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 << ""; + + unset_callback(); return rc; } diff --git a/src/oca/ruby/OpenNebula/Image.rb b/src/oca/ruby/OpenNebula/Image.rb index 3769e7460e..7f59f9a43c 100644 --- a/src/oca/ruby/OpenNebula/Image.rb +++ b/src/oca/ruby/OpenNebula/Image.rb @@ -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",