mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-21 14:50:08 +03:00
M #-: Add retries to vCenter tm clone operation
(cherry picked from commit 51c21c42660625e5a276f9a8c074bcbdcea92b24)
This commit is contained in:
parent
07284af09d
commit
a2ee52f40d
@ -44,6 +44,7 @@ $LOAD_PATH << RUBY_LIB_LOCATION
|
||||
$LOAD_PATH << File.dirname(__FILE__)
|
||||
|
||||
require 'vcenter_driver'
|
||||
CONFIG = VCenterConf.new
|
||||
|
||||
src = ARGV[0]
|
||||
dst = ARGV[1]
|
||||
@ -89,6 +90,7 @@ target_path_escaped = VCenterDriver::FileHelper
|
||||
target_path = VCenterDriver::FileHelper.unescape_path(target_path_escaped)
|
||||
|
||||
begin
|
||||
retries ||= 0
|
||||
vi_client = VCenterDriver::VIClient.new_from_host(host_id)
|
||||
disk_xpath ="TEMPLATE/DISK[SOURCE=\"#{src_path_escaped}\"]"
|
||||
one_disk = one_vm.retrieve_xmlelements(disk_xpath) rescue nil
|
||||
@ -110,7 +112,7 @@ begin
|
||||
# We overwrite the reference in target_ds_ref from the StoragePod
|
||||
# to the single recommended DS
|
||||
target_ds_ref = vm.recommended_ds(target_ds_ref)
|
||||
end
|
||||
end
|
||||
|
||||
source_ds_vc = VCenterDriver::Datastore.new_from_ref(source_ds_ref,
|
||||
vi_client)
|
||||
@ -135,6 +137,10 @@ rescue StandardError => e
|
||||
if VCenterDriver::CONFIG[:debug_information]
|
||||
STDERR.puts "#{message} #{e.backtrace}"
|
||||
end
|
||||
|
||||
sleep 60
|
||||
retry if retries < CONFIG[:retries]
|
||||
|
||||
exit(-1)
|
||||
ensure
|
||||
vi_client.close_connection if vi_client
|
||||
|
Loading…
x
Reference in New Issue
Block a user