rvalle
(Rafael)
March 27, 2018, 8:22am
1
Hi!
In Sunstone I can list and select a marketplace app, choose a datastore and easily create a VM template from that marketplace app.
What is the equivalent using XMLRPC? after reviewing the documentation I am missing something.
Is it possible to create VM templates from Marketplace apps using XMLRPC?
juanmont
(Juan Jose Montiel Cano)
March 27, 2018, 10:51am
2
Hi rvalle!
You can use the export
action: http://docs.opennebula.org/5.4/integration/system_interfaces/api.html#onemarketapp
You need to specify an ID of a marketplace app, a name for the new template and the id of a datastore.
Regards!
rvalle
(Rafael)
March 27, 2018, 10:57am
3
is this export action available via XML-RPC?
The documentation you referred me to lists : “– (ruby method)” as the XML-RPC method name.
rvalle
(Rafael)
March 27, 2018, 11:51am
4
@juanmont I can see in the source code that for some reason, it is not available in the XML-RPC…
I have reported the issue: https://github.com/OpenNebula/one/issues/1903
ruben
(Rubén S. Montero)
March 28, 2018, 7:14pm
5
Hi Rafael,
You are right this is a ruby method that orchestrate the export logic operations: create image, create a new template that refers to that image…
This would probably not be moved to the oned logic. So probably the best idea would to mimic the ruby logic:
# dsid [Integer] datastore to save images
# name [String] of the new object
# vmtemplate_name [String] name for the VM Template, if the App has one
#
# @return [Hash, OpenNebula::Error] with the ID and type of the created
# objects. Instead of an ID, the array may contain OpenNebula::Error with
# specific object creation errors
# { :vm => [ vm ids/OpenNebula::Error ],
# :vmtemplate => [ vmtemplates ids/OpenNebula::Error ],
# :image => [ vm ids/OpenNebula::Error ] }
def export(options={})
return Error.new("Missing datastore id") if options[:dsid].nil?
return Error.new("Missing name to export app") if options[:name].nil?
rc = info
return rc if OpenNebula.is_error?(rc)
return Error.new("App is not in READY state") if state_str!="READY"
case type_str
when "IMAGE"
if !self['APPTEMPLATE64'].nil?
rvalle
(Rafael)
March 29, 2018, 1:43pm
6
I see…
Somehow I presumed that this Rubi code was part of the platform “core”. But now I see that it is part of another wrapper of the XMLRPC API.
In terms of the OCA API this export is just a “helper”, and it is entirely built on top of the XMLRPC API, is that right?
If that is the case, we can now workaround this issue easily, as you say. Which is very good news.
I still think that it would be better at implemented at the XMLRPC end, mainly because now all the client APIs should replicate this functionality. But anyway, that is for you to decide.
rvalle
(Rafael)
April 1, 2018, 7:29am
7
Thanks @ruben , it was actually quite straight forward to implement the export method. its now in pyone 1.1.2