[one-users] [OCA JAVA] Allocate VM from XML template

Carlos Martín Sánchez cmartin at opennebula.org
Fri Oct 19 07:42:35 PDT 2012


Hi,

To create new VMs, you can either:
- create a Template (OpenNebula Template, not the string), and instantiate
it [1]
- directly create a VirtualMachine from the string description template [2]

In both cases, the description string can be in NAME=VALUE format, or in
XML. The core will accept any of them; copied from [3]:


The methods that accept XML templates require the root element to be
TEMPLATE. For instance, this template:

NAME = abc
MEMORY = 1024
ATT1 = value1

Can be also given to OpenNebula with the following XML:

<TEMPLATE>
  <NAME>abc</NAME>
  <MEMORY>1024</MEMORY>
  <ATT1>value1</ATT1>
</TEMPLATE>


Regards

[1]
http://opennebula.org/doc/3.6/oca/java/org/opennebula/client/template/Template.html#instantiate()
[2]
http://opennebula.org/doc/3.6/oca/java/org/opennebula/client/vm/VirtualMachine.html#allocate(org.opennebula.client.Client,
java.lang.String)
[3] http://opennebula.org/documentation:rel3.6:api

--
Carlos Martín, MSc
Project Engineer
OpenNebula - The Open-source Solution for Data Center Virtualization
www.OpenNebula.org | cmartin at opennebula.org |
@OpenNebula<http://twitter.com/opennebula><cmartin at opennebula.org>



On Fri, Oct 19, 2012 at 11:50 AM, Alessio Rocchi <alexrocchi at gmail.com>wrote:

> Hi everybody,
> first of all, I apologize if this is not the correct place to post
> development messages. In this case, I'd be glad if anyone in this list
> could contribute to point me out to the right location.
> I'm stuck on a problem with Java API (OCA v.3.6): I need to allocate a VM
> (VirtualMachine.allocate()) using an existing template (i.e.: using its XML
> format).
> The basic example on the ONE site doesn't help me, because the template is
> "cabled" into the source code and created as plain String (i.e.: not in
> XML).
> I saw that OCA 3.0 (no more downloadable, as i could see) had a very
> useful method allocateByTemplate(), allowing to pass a template id... But
> such method seems to be removed in versions > 3.0.
> Does anyone could give me an example or an advice on how to proceed?
> Thank you very much,
> Alex
>
> --
> Ing. Alessio Rocchi
> ENEA UTICT-HPC
> Frascati Research Center
> V. Enrico Fermi 45
> IT - 00044 Frascati (Roma)
>
>
> _______________________________________________
> Users mailing list
> Users at lists.opennebula.org
> http://lists.opennebula.org/listinfo.cgi/users-opennebula.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opennebula.org/pipermail/users-opennebula.org/attachments/20121019/c8eb9263/attachment-0002.htm>


More information about the Users mailing list