diff --git a/src/cli/onemarketapp b/src/cli/onemarketapp index 2b420610ba..708fd32bfb 100755 --- a/src/cli/onemarketapp +++ b/src/cli/onemarketapp @@ -95,7 +95,7 @@ CommandParser::CmdParser.new(ARGV) do NO = { :name => 'no', :large => '--no', - :description => 'Do not import associated VM templates/images', + :description => 'Do not import/export associated VM templates/images', :proc => lambda do |_, options| options[:no] = 'no' end @@ -122,7 +122,8 @@ CommandParser::CmdParser.new(ARGV) do EXPORT_OPTIONS = [OneDatastoreHelper::DATASTORE, OneDatastoreHelper::FILE_DATASTORE, OneMarketPlaceAppHelper::VMNAME, - TAG] + TAG, + NO] IMPORT_OPTIONS = [YES, NO, MARKET, OneMarketPlaceAppHelper::VMNAME] ######################################################################## @@ -270,7 +271,8 @@ CommandParser::CmdParser.new(ARGV) do :dsid => options[:datastore], :name => args[1], :vmtemplate_name => options[:vmname], - :url_args => tag + :url_args => tag, + :notemplate => options[:no] == 'no' ) if OpenNebula.is_error?(rc) diff --git a/src/oca/ruby/opennebula/marketplaceapp_ext.rb b/src/oca/ruby/opennebula/marketplaceapp_ext.rb index 213f4af3a2..bebb2ef174 100644 --- a/src/oca/ruby/opennebula/marketplaceapp_ext.rb +++ b/src/oca/ruby/opennebula/marketplaceapp_ext.rb @@ -92,6 +92,7 @@ module OpenNebula::MarketPlaceAppExt # :url_args [String] optional URL arguments # :dsid [String] Datastore id to create the image # :f_dsid [String] Files Datastore id + # :notemplate [Bool] if true do not create vm_template (if any) # @return [Hash] # :image [Array] of the new image # :image_type [String] of the new image (CONTEXT, KERNEL, CDROM) @@ -142,6 +143,12 @@ module OpenNebula::MarketPlaceAppExt end end + ds = OpenNebula::Datastore.new_with_id(dsid, @client) + rc = ds.info + + is_vcenter = !OpenNebula.is_error?(rc) && + (ds['TEMPLATE/DRIVER'] == 'vcenter') + #--------------------------------------------------------------- # Allocate the image in OpenNebula #--------------------------------------------------------------- @@ -158,6 +165,7 @@ module OpenNebula::MarketPlaceAppExt image.delete_element('TEMPLATE/FORMAT') image.delete_element('TEMPLATE/DRIVER') + image.delete_element('TEMPLATE/DEV_PREFIX') if is_vcenter image.update(image.template_xml) @@ -167,7 +175,7 @@ module OpenNebula::MarketPlaceAppExt #--------------------------------------------------------------- # Created an associated VMTemplate if needed #--------------------------------------------------------------- - if self['TEMPLATE/VMTEMPLATE64'].nil? + if self['TEMPLATE/VMTEMPLATE64'].nil? || options[:notemplate] return rc_info end