diff --git a/src/market_mad/remotes/one/monitor b/src/market_mad/remotes/one/monitor index 9e5309116c..2f7efca070 100755 --- a/src/market_mad/remotes/one/monitor +++ b/src/market_mad/remotes/one/monitor @@ -21,6 +21,7 @@ require 'uri' require 'json' require 'base64' require 'rexml/document' +require 'securerandom' # OpenNebula MarketPlace class OneMarket @@ -111,14 +112,12 @@ class OneMarket def render_vmtemplate(tmpl, app) print_var(tmpl, 'SIZE', 0) - print_var(tmpl, 'MD5', app['md5']) if app['disks'] - app['disks'].each do |disk| - dname = disk.keys.first - + app['disks'].each do |app_name| tmpl << <<-EOT.strip - DISK = [ NAME = "#{dname}", APP="#{disk[dname]}" ] + DISK = [ NAME = "#{SecureRandom.hex[0..9]}", + APP="#{app_name}" ] EOT end end @@ -137,14 +136,11 @@ class OneMarket def render_service_template(tmpl, app) print_var(tmpl, 'SIZE', 0) - print_var(tmpl, 'MD5', app['md5']) if app['roles'] - app['roles'].each do |role| - rname = role.keys.first - + app['roles'].each do |role_name, app_name| tmpl << <<-EOT.strip - ROLE = [ NAME = "#{rname}", APP="#{role[rname]}" ] + ROLE = [ NAME = "#{role_name}", APP="#{app_name}" ] EOT end end diff --git a/src/oca/ruby/opennebula/marketplaceapp_ext.rb b/src/oca/ruby/opennebula/marketplaceapp_ext.rb index e9503af9db..d7974298da 100644 --- a/src/oca/ruby/opennebula/marketplaceapp_ext.rb +++ b/src/oca/ruby/opennebula/marketplaceapp_ext.rb @@ -73,6 +73,8 @@ module OpenNebula::MarketPlaceAppExt when 'IMAGE' export_image(options) when 'VMTEMPLATE' + options[:notemplate] = true + export_vm_template(options) when 'SERVICE_TEMPLATE' export_service_template(options) @@ -328,10 +330,12 @@ module OpenNebula::MarketPlaceAppExt tmpl['roles'].each do |role| t_id = roles.find {|_, v| v[:names].include?(role['name']) } - next if t_id.nil? || t_id[1].nil? || t_id[1][:vmtemplate] + if t_id.nil? || t_id[1].nil? || t_id[1][:vmtemplate].nil? + next + end role['vm_template'] = nil - role['vm_template'] = t_id[1][:vmtemplate] + role['vm_template'] = t_id[1][:vmtemplate][0] end # -------------------------------------------------------------- @@ -387,8 +391,9 @@ module OpenNebula::MarketPlaceAppExt obj.extend(MarketPlaceAppExt) rc = obj.export( - :dsid => options[:dsid], - :name => "#{options[:name]}-#{idx}" + :dsid => options[:dsid], + :name => "#{options[:name]}-#{idx}", + :notemplate => options[:notemplate] ) image = rc[:image].first if rc[:image]