[one-users] OCCI compute creation problem

Daniel Molina dmolina at opennebula.org
Tue Apr 26 09:54:16 PDT 2011


In the previous mail you were getting the following error:
[VirtualMachineAllocate] Error trying to PARSE VM TEMPLATE Returned
error code [1].. Reason: syntax error, unexpected EQUAL, expecting
$end or VARIABLE at line 26, columns 377:383

In the last mail the error is on the template section instead of the
allocate one. Did you change anything?

Try f.puts template.message instead of  f.puts template to check the error.

On 26 April 2011 18:40, Florin Antonescu <florinantonescu at gmail.com> wrote:
> I added the following code to OCCIServer.rb:
>  # --- Generate the template and Allocate the new Instance ---
>         template = vm.to_one_template
>         File.open("/tmp/occi.template.txt", "w") do |f|
>                 f.puts template
>         end
> and the output was:
> $ cat /tmp/occi.template.txt
> #<OpenNebula::Error:0xb771e67c>
> 500
> in the Java client I get a HTTP 500 error code with the message: Wrong type!
> The file common.erb contains:
> $ cat /srv/cloud/one/etc/occi_templates/common.erb
> #
> # This template is processed by the OCCI Server to include specific data for
> the
> # instance, you should not need to modify the ruby code.
> # You can add common attributes for your cloud templates (e.g. OS)
> #
> NAME   = "<%= @vm_info['NAME'] %>"
> <% @vm_info.each('DISK') do |disk| %>
>     <% if disk.attr('STORAGE','href') %>
>       DISK = [ IMAGE_ID = <%= disk.attr('STORAGE','href').split('/').last %>
>            ]
>     <% end %>
> <% end %>
> <% @vm_info.each('NIC') do |nic| %>
>     <% if nic.attr('NETWORK','href') %>
>       NIC = [ NETWORK_ID = <%= nic.attr('NETWORK','href').split('/').last %>
>           <% if nic['IP'] %>
>               ,IP = <%= nic['IP'] %>
>           <% end %>
>           ]
>     <% end %>
> <% end %>
> <% if @vm_info.has_elements?('CONTEXT') %>
>         CONTEXT = [
>         <% first = true %>
>         <% @vm_info.each('CONTEXT/*') do |cont| %>
>             <% if cont.text %>
>             <% if first %>
>                     <%= cont.name %> = "<%= cont.text %>"
>                     <% first = false %>
>                 <% else %>
>                     ,<%= cont.name %> = "<%= cont.text %>"
>                 <% end %>
>                 <% end %>
>         <% end %>
>         ]
> <% end %>
> INSTANCE_TYPE = <%= @vm_info['INSTANCE_TYPE']%>
> Any suggestion about how to proceed?
>
> On Tue, Apr 26, 2011 at 4:31 PM, Daniel Molina <dmolina at opennebula.org>
> wrote:
>>
>> Hi,
>>
>> Would you mind to send the content of the common.erb file inside the
>> occi_templates folder and the template that is built by OCCI (line 162
>> inside the OCCIServer.rb file, you can write that variable into a
>> file).
>>
>> Regards.
>>
>>
>> On 17 April 2011 16:07, Florin Antonescu <florinantonescu at gmail.com>
>> wrote:
>> > Hi there!
>> > I am having a bit of a problem with creating compute instances both
>> > command
>> > line using occi-compute and from a Java client, maybe someone can give
>> > me a
>> > hint. I am using OpenNebula 2.2 on top of Ubuntu Desktop 10.10.
>> > Both command line client and Java client work for creating blockstorage
>> > images, so I don't think authentication is a problem.
>> > If I try to create the VM from command line using
>> > $ occi-compute create compute.xml -D --url http://192.168.141.129:5000
>> > I get the following error message:
>> > [VirtualMachineAllocate] Error trying to PARSE VM TEMPLATE Returned
>> > error
>> > code [1].. Reason: syntax error, unexpected EQUAL, expecting $end or
>> > VARIABLE at line 26, columns 377:383
>> > The compute.xml file contains: $ cat compute.xml
>> > <COMPUTE>
>> > <NAME>MyCompute</NAME>
>> > <INSTANCE_TYPE>tiny</INSTANCE_TYPE>
>> > <DISK>
>> > <STORAGE href="http://192.168.141.129:5000/storage/0"/>
>> > <TYPE>DISK</TYPE>
>> > <TARGET>hda</TARGET>
>> > </DISK>
>> > <NIC>
>> > <NETWORK href="http://192.168.141.129:5000/network/5"/>
>> > </NIC>
>> > </COMPUTE>
>> > If I try to create the same instance from the Java client i receive this
>> > error message: Wrong type!
>> > The storage image exists and has this description: $ oneimage show 0
>> > IMAGE  INFORMATION
>> > ID             : 0
>> > NAME           : ttylinux
>> > TYPE           : OS
>> > REGISTER TIME  : 04/08 21:19:30
>> > PUBLIC         : Yes
>> > PERSISTENT     : No
>> > SOURCE         :
>> > /srv/cloud/one/var//images/42f54d261985fd2b5941566878dbb03fc1e6b399
>> > STATE          : rdy
>> > RUNNING_VMS    : 0
>> > IMAGE TEMPLATE
>> > BUS=IDE
>> > DESCRIPTION=Minimalist Linux distribution
>> > DEV_PREFIX=hd
>> > NAME=ttylinux
>> > PATH=/srv/cloud/one/one-templates/ttylinux.img
>> > TYPE=OS
>> > Also, the network has this description: $ onevnet show 5
>> > VIRTUAL NETWORK 5 INFORMATION
>> > ID:       : 5
>> > UID:      : 1
>> > PUBLIC    : Y
>> > VIRTUAL NETWORK TEMPLATE
>> > BRIDGE=virbr0
>> > LEASES=[ IP=192.168.255.10 ]
>> > LEASES=[ IP=192.168.255.11 ]
>> > LEASES=[ IP=192.168.255.12 ]
>> > LEASES=[ IP=192.168.255.13 ]
>> > NAME=Another small network
>> > TYPE=FIXED
>> > LEASES INFORMATION
>> > LEASE=[ IP=192.168.255.10, MAC=02:00:c0:a8:ff:0a, USED=0, VID=-1 ]
>> > LEASE=[ IP=192.168.255.11, MAC=02:00:c0:a8:ff:0b, USED=0, VID=-1 ]
>> > LEASE=[ IP=192.168.255.12, MAC=02:00:c0:a8:ff:0c, USED=0, VID=-1 ]
>> > LEASE=[ IP=192.168.255.13, MAC=02:00:c0:a8:ff:0d, USED=0, VID=-1 ]
>> > The tiny template has been added to tiny.erb: $ cat
>> > etc/occi_templates/tiny.erb
>> > CPU    = 0.1
>> > MEMORY = 64
>> > and has been enabled in occi-server.config: $ cat etc/occi-server.conf |
>> > grep tiny
>> > VM_TYPE=[NAME=tiny, TEMPLATE=tiny.erb]
>> > Any ideas on how to overcome this issue?
>> > Thank you,
>> > Florian
>> > _______________________________________________
>> > Users mailing list
>> > Users at lists.opennebula.org
>> > http://lists.opennebula.org/listinfo.cgi/users-opennebula.org
>> >
>> >
>>
>>
>>
>> --
>> Daniel Molina, Cloud Technology Engineer/Researcher
>> Major Contributor
>> OpenNebula - The Open Source Toolkit for Cloud Computing
>> www.OpenNebula.org | dmolina at opennebula.org
>
>



-- 
Daniel Molina, Cloud Technology Engineer/Researcher
Major Contributor
OpenNebula - The Open Source Toolkit for Cloud Computing
www.OpenNebula.org | dmolina at opennebula.org



More information about the Users mailing list