F #4913: Add missing backtrace to rescue clause in VMM/DS actions

This commit is contained in:
mcabrerizo committed 2017-02-20 13:43:09 +01:00
1 parent d7162d4252
commit 245dc56c54
7 files changed
+16 -15

No files matched your search

+2 -1
View File
@@ -76,6 +76,7 @@ begin
puts ds.copy_virtual_disk(src_path, target_ds_name, target_path)
rescue Exception => e
STDERR.puts "Error cloning img #{src_path}. Reason: #{e.message}"
STDERR.puts "Error cloning img #{src_path}."\
" Reason: \"#{e.message}\"\n#{e.backtrace}"
exit -1
end
+1 -1
View File
@@ -77,7 +77,7 @@ if VCenterDriver::FileHelper.is_remote_or_needs_unpack?(img_path)
temp_file = File.join(temp_folder, File.basename(target_path))
# Create tmp directory
FileUtils.mkdir_p(temp_folder) if !File.directory?(temp_folder)
FileUtils.mkdir_p(temp_folder)
# Specify downloader args
downsh_args = " "
+1 -1
View File
@@ -82,6 +82,6 @@ begin
puts ds.create_virtual_disk(img_name, size, adapter_type, disk_type)
rescue Exception => e
STDERR.puts "Error creating virtual disk #{img_src}."\
" Reason: #{e.message}"
" Reason: \"#{e.message}\"\n#{e.backtrace}"
exit -1
end
+1 -1
View File
@@ -68,7 +68,7 @@ if img_path.start_with? "vcenter://"
rescue Exception => e
STDERR.puts "Error calculating image #{img_path} size."\
" Reason: #{e.message}"
" Reason: \"#{e.message}\"\n#{e.backtrace}"
exit -1
end
else
@@ -92,6 +92,6 @@ begin
end
rescue Exception => e
STDERR.puts "Cannot download image #{u.path} from datastore #{ds_name} "\
"on #{hostname}. Reason: #{e.message}"
"on #{hostname}. Reason: \"#{e.message}\"\n#{e.backtrace}"
exit -1
end
@@ -50,7 +50,7 @@ begin
puts target_path
rescue Exception => e
STDERR.puts "Cannot upload image to datastore #{ds_name} "\
"Reason: #{e.message}"
"Reason: \"#{e.message}\"\n#{e.backtrace}"
exit -1
end
@@ -272,7 +272,7 @@ class VirtualMachine
:spec => clone_spec).wait_for_completion
rescue Exception => e
if !e.message.start_with?('DuplicateName')
raise "Cannot clone VM Template: #{e.message}"
raise "Cannot clone VM Template: #{e.message}\n#{e.backtrace}"
end
vm_folder = cluster.get_dc.vm_folder
@@ -501,7 +501,7 @@ class VirtualMachine
begin
@item.ReconfigVM_Task(:spec => spec).wait_for_completion
rescue Exception => e
raise "Cannot create snapshot for VM: #{e.message}"
raise "Cannot create snapshot for VM: #{e.message}\n#{e.backtrace}"
end
end
@@ -644,7 +644,7 @@ class VirtualMachine
begin
@item.ReconfigVM_Task(:spec => spec).wait_for_completion
rescue Exception => e
raise "Cannot attach NIC to VM: #{e.message}"
raise "Cannot attach NIC to VM: #{e.message}\n#{e.backtrace}"
end
end
@@ -687,7 +687,7 @@ class VirtualMachine
begin
@item.ReconfigVM_Task(:spec => spec_hash).wait_for_completion
rescue Exception => e
raise "Cannot detach NIC from VM: #{e.message}"
raise "Cannot detach NIC from VM: #{e.message}\n#{e.backtrace}"
end
end
@@ -755,7 +755,7 @@ class VirtualMachine
begin
@item.ReconfigVM_Task(:spec => spec).wait_for_completion
rescue Exception => e
raise "Cannot attach DISK to VM: #{e.message}"
raise "Cannot attach DISK to VM: #{e.message}\n#{e.backtrace}"
end
end
@@ -783,7 +783,7 @@ class VirtualMachine
begin
@item.ReconfigVM_Task(:spec => spec_hash).wait_for_completion
rescue Exception => e
raise "Cannot detach DISK to VM: #{e.message}"
raise "Cannot detach DISK to VM: #{e.message}\n#{e.backtrace}"
end
end
@@ -1000,7 +1000,7 @@ class VirtualMachine
begin
@item.CreateSnapshot_Task(snapshot_hash).wait_for_completion
rescue Exception => e
raise "Cannot create snapshot for VM: #{e.message}"
raise "Cannot create snapshot for VM: #{e.message}\n#{e.backtrace}"
end
return snapshot_name
@@ -1018,7 +1018,7 @@ class VirtualMachine
revert_snapshot_hash = { :_this => snapshot }
snapshot.RevertToSnapshot_Task(revert_snapshot_hash).wait_for_completion
rescue Exception => e
raise "Cannot revert snapshot of VM: #{e.message}"
raise "Cannot revert snapshot of VM: #{e.message}\n#{e.backtrace}"
end
end
@@ -1037,7 +1037,7 @@ class VirtualMachine
}
snapshot.RemoveSnapshot_Task(delete_snapshot_hash).wait_for_completion
rescue Exception => e
raise "Cannot delete snapshot of VM: #{e.message}"
raise "Cannot delete snapshot of VM: #{e.message}\n#{e.backtrace}"
end
end