diff --git a/src/datastore_mad/remotes/vcenter/cp b/src/datastore_mad/remotes/vcenter/cp index abc273fcaa..9ec3fd4830 100755 --- a/src/datastore_mad/remotes/vcenter/cp +++ b/src/datastore_mad/remotes/vcenter/cp @@ -57,15 +57,9 @@ md5 = drv_action["/DS_DRIVER_ACTION_DATA/IMAGE/TEMPLATE/MD5"] sha1 = drv_action["/DS_DRIVER_ACTION_DATA/IMAGE/TEMPLATE/SHA1"] nodecomp = drv_action["/DS_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/NO_DECOMPRESS"] limit_bw = drv_action["/DS_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/LIMIT_TRANSFER_BW"] -format = drv_action["IMAGE/TEMPLATE/FORMAT"] check_valid img_path, "img_path" -if format != 'vmdk' && format != 'iso' - one_img = VCenterDriver::VIHelper.one_item(OpenNebula::Image, id) - one_img.replace({'FORMAT' => 'vmdk'}) -end - # if image is already in a vCenter datastore return the path if img_path.start_with? "vcenter://" img_path = img_path.sub("vcenter://", "") diff --git a/src/oca/ruby/opennebula/marketplaceapp.rb b/src/oca/ruby/opennebula/marketplaceapp.rb index 88ff95a32e..36352cc2bb 100644 --- a/src/oca/ruby/opennebula/marketplaceapp.rb +++ b/src/oca/ruby/opennebula/marketplaceapp.rb @@ -193,6 +193,17 @@ module OpenNebula image = Image.new(Image.build_xml, @client) rc = image.allocate(tmpl, options[:dsid]) + ds = OpenNebula::Datastore.new_with_id(options[:dsid], @client) + image.info + ds.info + + xpath = 'TEMPLATE/DRIVER' + if ds[xpath] == 'vcenter' && self['FORMAT'] != 'iso' && self['FORMAT'] != 'vmdk' + image.replace({'FORMAT' => 'vmdk'}) + elsif ds[xpath] && ds[xpath] != 'vcenter' && self['FORMAT'] == 'vmdk' + image.replace({'FORMAT' => ds[xpath] }) + end + return { :image => [rc] } if OpenNebula.is_error?(rc) image_id = image.id