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

F #4913: Pass datastore action error message to the driver (ERROR attr) so you don't have to look for it in the log

This commit is contained in:
mcabrerizo 2017-04-18 10:25:53 +02:00
parent 179bf23d9b
commit 9f2a63cc1c
6 changed files with 18 additions and 12 deletions

View File

@ -68,8 +68,9 @@ begin
puts ds.copy_virtual_disk(src_path, target_ds_vc, target_path)
rescue Exception => e
STDERR.puts "Error cloning img #{src_path} to #{target_ds_name}"\
" Reason: \"#{e.message}\"\n#{e.backtrace}"
message = "Error cloning img #{src_path} to #{target_ds_name}"\
" Reason: \"#{e.message}\"\n#{e.backtrace}"
STDERR.puts error_message(message)
exit -1
ensure
vi_client.close_connection if vi_client

View File

@ -50,8 +50,9 @@ ds_name = drv_action["/DS_DRIVER_ACTION_DATA/DATASTORE/NAME"]
if img_source.nil?
STDERR.puts "Not enough information to export the image,"\
" missing image source."
message = "Not enough information to export the image,"\
" missing image source."
STDERR.puts error_message(message)
exit -1
end

View File

@ -74,8 +74,9 @@ begin
puts ds.create_virtual_disk(img_name, size, adapter_type, disk_type)
rescue Exception => e
STDERR.puts "Error creating virtual disk #{img_name}."\
" Reason: \"#{e.message}\"\n#{e.backtrace}"
message = "Error creating virtual disk #{img_name}."\
" Reason: \"#{e.message}\"\n#{e.backtrace}"
STDERR.puts error_message(message)
exit -1
ensure
vi_client.close_connection if vi_client

View File

@ -55,8 +55,9 @@ begin
puts storage.monitor
rescue Exception => e
STDERR.puts "Error monitoring host #{id}."\
" Reason: \"#{e.message}\"\n#{e.backtrace}"
message = "Error monitoring host #{id}."\
" Reason: \"#{e.message}\"\n#{e.backtrace}"
STDERR.puts error_message(message)
exit -1
ensure
vi_client.close_connection if vi_client

View File

@ -72,8 +72,9 @@ begin
ds.rm_directory(img_dir) if ds.dir_empty?(img_dir)
end
rescue Exception => e
STDERR.puts "Error deleting virtual disk #{img_src}."\
" Reason: \"#{e.message}\"\n#{e.backtrace}"
message = "Error deleting virtual disk #{img_src}."\
" Reason: \"#{e.message}\"\n#{e.backtrace}"
STDERR.puts error_message(message)
exit -1
ensure
vi_client.close_connection if vi_client

View File

@ -56,8 +56,9 @@ if img_path.start_with? "vcenter://"
puts ds.stat(img_path.sub("vcenter://",""))
rescue Exception => e
STDERR.puts "Error calculating image #{img_path} size."\
" Reason: \"#{e.message}\"\n#{e.backtrace}"
message = "Error calculating image #{img_path} size."\
" Reason: \"#{e.message}\"\n#{e.backtrace}"
STDERR.puts error_message(message)
exit -1
ensure
vi_client.close_connection if vi_client