F #4913: Fix vcenter datastore cp and vcenter_uploader

This commit is contained in:
mcabrerizo committed 2017-06-12 18:01:48 +02:00
1 parent bb9f21f2fa
commit bebd7ac5bd
2 files changed
+6 -6

No files matched your search

+4 -4
View File
@@ -38,7 +38,7 @@ drv_action = OpenNebula::XMLElement.new
drv_action.initialize_xml(Base64.decode64(drv_action_enc), 'DS_DRIVER_ACTION_DATA')
img_path = drv_action["/DS_DRIVER_ACTION_DATA/IMAGE/PATH"]
host_id = drv_action["/DS_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/VCENTER_ONE_HOST_ID"]
ds_id = drv_action["/DS_DRIVER_ACTION_DATA/DATASTORE/ID"]
ds_ref = drv_action["/DS_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/VCENTER_DS_REF"]
ds_image_dir = drv_action["/DS_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/VCENTER_DS_IMAGE_DIR"] || "one"
md5 = drv_action["/DS_DRIVER_ACTION_DATA/IMAGE/TEMPLATE/MD5"]
@@ -121,7 +121,7 @@ files_to_upload.each_with_index do |f, index|
end
# Change path if vmdk is part of filename but it's not the extension
if /[^.]+vmdk$/.match(path) && VCenterDriver::FileHelper.is_vmdk?(f)
if !!/[^.]+vmdk$/.match(path) && VCenterDriver::FileHelper.is_vmdk?(f)
path.gsub!(/vmdk$/,'')
extension = '.vmdk'
end
@@ -133,10 +133,10 @@ files_to_upload.each_with_index do |f, index|
end
if index == files_to_upload.size - 1
uploader_args = host_id + " " + ds_ref + " " +
uploader_args = ds_id + " " + ds_ref + " " +
"#{path}#{extension}" + " " + f
else
uploader_args = host_id + " " + ds_ref + " " +
uploader_args = ds_id + " " + ds_ref + " " +
path + " " + f + " &> /dev/null"
end
@@ -29,13 +29,13 @@ $: << File.dirname(__FILE__)
require 'vcenter_driver'
host_id = ARGV[0]
ds_id = ARGV[0]
target_ds_ref = ARGV[1]
target_path = ARGV[2]
source_path = ARGV[3]
begin
vi_client = VCenterDriver::VIClient.new_from_host(host_id)
vi_client = VCenterDriver::VIClient.new_from_datastore(ds_id)
ds = VCenterDriver::Datastore.new_from_ref(target_ds_ref, vi_client)
# Setting "." as the source will read from the stdin