mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-30 22:50:10 +03:00
M #-: Marketplace minor improvements
- Add support for --no in onemarketapp export and API call - Remove DEV_PREFIX for vcenter datastores and Image objects
This commit is contained in:
parent
ef4e528172
commit
44beefa77e
@ -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)
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user