F #4913: Pass tm 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 committed 2017-04-18 10:21:58 +02:00
1 parent 1aaf04e45c
commit 179bf23d9b
5 files changed
+19 -13

No files matched your search

+4 -3
View File
@@ -115,9 +115,10 @@ begin
end
rescue Exception => e
STDERR.puts "Error clone virtual disk #{src_path} in "\
"datastore #{target_ds_name_vc}. "\
"Reason: #{e.message}\n#{e.backtrace}"
message = "Error clone virtual disk #{src_path} in "\
"datastore #{target_ds_name_vc}. "\
"Reason: #{e.message}\n#{e.backtrace}"
STDERR.puts error_message(message)
exit -1
ensure
vi_client.close_connection if vi_client
+3 -2
View File
@@ -101,8 +101,9 @@ begin
source_ds_vc.copy_virtual_disk(src_path, target_ds_vc, target_path)
rescue Exception => e
STDERR.puts "Error copying img #{src_path} to #{target_ds_name_vc} "\
"Reason: #{e.message}\n#{e.backtrace}"
message = "Error copying img #{src_path} to #{target_ds_name_vc} "\
"Reason: #{e.message}\n#{e.backtrace}"
STDERR.puts error_message(message)
exit -1
ensure
vi_client.close_connection if vi_client
+6 -4
View File
@@ -115,8 +115,9 @@ if path.match(/disk\.\d+$/)
end
rescue Exception => e
STDERR.puts "Error delete virtual disk #{img_path} in datastore #{dsid}."\
" Reason: #{e.message}\n#{e.backtrace}"
message = "Error delete virtual disk #{img_path} in datastore #{dsid}."\
" Reason: #{e.message}\n#{e.backtrace}"
STDERR.puts error_message(message)
exit -1
ensure
vi_client.close_connection if vi_client
@@ -253,8 +254,9 @@ else
# Destroy the VM unless the instantiate as persistent is used
vm.destroy if !vm.instantiated_as_persistent?
rescue Exception => e
STDERR.puts "Error unregistering vm #{vmid} (#{vm_ref})."\
" Reason: #{e.message}\n#{e.backtrace}"
message = "Error unregistering vm #{vmid} (#{vm_ref})."\
" Reason: #{e.message}\n#{e.backtrace}"
STDERR.puts error_message(message)
exit -1
ensure
vi_client.close_connection if vi_client
+3 -2
View File
@@ -86,8 +86,9 @@ begin
end
rescue Exception => e
STDERR.puts "Error creating virtual disk in #{ds_vc['name']}."\
" Reason: #{e.message}\n#{e.backtrace}"
message = "Error creating virtual disk in #{ds_vc['name']}."\
" Reason: #{e.message}\n#{e.backtrace}"
STDERR.puts error_message(message)
exit -1
ensure
vi_client.close_connection if vi_client
+3 -2
View File
@@ -69,8 +69,9 @@ begin
vm.detach_disk(disk) if !vm.has_snapshots? && !vm.instantiated_as_persistent?
rescue Exception => e
STDERR.puts "Error detaching virtual disk #{disk_id} from vm #{vmid}."\
" Reason: #{e.message}\n#{e.backtrace}"
message = "Error detaching virtual disk #{disk_id} from vm #{vmid}."\
" Reason: #{e.message}\n#{e.backtrace}"
STDERR.puts error_message(message)
exit -1
ensure
vi_client.close_connection if vi_client