diff --git a/src/datastore_mad/remotes/vcenter/cp b/src/datastore_mad/remotes/vcenter/cp index 915676b9d0..0772ef678d 100755 --- a/src/datastore_mad/remotes/vcenter/cp +++ b/src/datastore_mad/remotes/vcenter/cp @@ -106,8 +106,9 @@ if VCenterDriver::FileHelper.remote_or_needs_unpack?(img_path) downsh_args << '--convert vmdk' downloader = "#{File.dirname(__FILE__)}/../downloader.sh #{downsh_args}" + b64 = Base64.encode64(drv_action.to_xml).gsub!("\n", '') - rc = system("#{downloader} #{img_path} #{temp_file}") + rc = system("DRV_ACTION=#{b64} #{downloader} #{img_path} #{temp_file}") if there_is_not_system_error?(rc) STDERR.puts "Error downloading #{img_path}" @@ -171,17 +172,17 @@ files_to_upload.each_with_index do |f, index| cmd = "#{File.dirname(__FILE__)}/../vcenter_uploader.rb #{uploader_args}" - stdout_str, status = Open3.capture2(cmd) - - if last_file_to_upload?(index, files_to_upload) - puts "%s %s" % [stdout_str, "vmdk"] + target, stderr, status = Open3.capture3(cmd) + + if !status.success? + STDERR.puts "Cannot upload file #{f}: #{stderr}" + FileUtils.rm_rf(temp_file) if temp_file + exit(-1) end - next if status.success? - - STDERR.puts "Cannot upload file #{f}" - FileUtils.rm_rf(temp_file) if temp_file - exit(-1) + if last_file_to_upload?(index, files_to_upload) + puts "#{target.gsub("\n", '')} vmdk" + end end FileUtils.rm_rf(temp_file) if temp_file diff --git a/src/vmm_mad/remotes/lib/vcenter_driver/file_helper.rb b/src/vmm_mad/remotes/lib/vcenter_driver/file_helper.rb index d1817b6bf8..18063bb8b5 100644 --- a/src/vmm_mad/remotes/lib/vcenter_driver/file_helper.rb +++ b/src/vmm_mad/remotes/lib/vcenter_driver/file_helper.rb @@ -65,7 +65,7 @@ module VCenterDriver end def self.remote?(file) - file.match(%r{^https?://}) + file.match(%r{^https?://}) || file.match(%r{^s3?://}) end def self.vmdk?(file)