[SOLVED] Problem using one.vn.update XML-RPC method

Hi all

We are using, to generate/update our OpenNebula templates, the useful XML-RPC API as system interface. Everything seems to work fine, we can create/remove/update resources but it seems that one.vn.update is not working.

We can create and remove vnets but not update them using one.vn.update method from RPC endpoint. We are using 4.14.2 version and perl-Net-OpenNebula, available from CPAN [1]

For example if we try to update an available vnet pool to increase the number of IPs we use the method as is described in the documentation [2], so it looks like this in XML format to update vnet id 2 (we want to update the pool size):

<?xml version="1.0" encoding="us-ascii"?><methodCall><methodName>one.vn.update</methodName><params><param><value><string>oneadmin:PASSWORD</string></value></param><param><value><int>2</int></value></param><param><value><string>
AR = [
    ip = &quot;10.140.1.10&quot;,
    size = &quot;20&quot;,
    type = &quot;IP4&quot;
]
BRIDGE = &quot;bridge1&quot;
BRIDGE_OVS = &quot;ovsbr0&quot;
NAME = &quot;pool1&quot;
NETWORK_MASK = &quot;255.255.0.0&quot;
VLAN = &quot;YES&quot;
VLAN_ID = &quot;0&quot;
QUATTOR = 1
</string></value></param><param><value><int>0</int></value></param></params></methodCall>

And from ONE RPC we get the vnet id in return, no error output (and it should means that everything went fine) but the vnet is not updated or modified at all. On the other hand we can update it from Sunstone without problems.

Something is missing or not documented regarding this method? we are able to update the rest of resources (images/VM templates) but not the vnets… any clue?

Thanks in advance!
Alvaro

Hi,

The vnet template used to create the VNet can include the Address Ranges, but after the vnet creation, ARs must be managed with the addar/rmar/updatear methods.

Regards

Hi @cmartin

Thanks for the info! so we can’t use one.vn.update to update the whole template right? just:

BRIDGE = “br100”
DNS = “10.140.1.1”
GATEWAY = “10.140.1.1”
NAME = “pool1”
NETWORK_MASK = “255.255.0.0”
VLAN = “YES”

and for the AR:

AR = [
ip = “10.140.1.100”,
size = “17”,
type = “IP4”
]

we must use one.vn.update_ar method as usual, right?

Cheers
Alvaro

That’s right.

Actually the same happens with the name. You can define it in the template file, but OpenNebula processes and removes it from the template that ends inside the VNet. You need to use the rename methods afterwards, updating the template with a new NAME=XX has no effect.

Thanks! :thumbsup:

Hi @cmartin

I’m trying now to use one.vn.update_ar method as is described in [1], but now I get this error message from the RPC endpoint:

_rpc failed to make request faultCode -501 faultString Not enough parameters method one.vn.update_ar args [int, 1], [string, AR = [
ar_id = “0”,
ip = “10.1.1.10”,
size = “10”,
type = “IP4”
]

So I’m using 3 inputs, the session string and the object id to update an specific AR and the template string… but it seems that update_ar method requires something else. Maybe it also requires a new input to merge or replace the new info? as one.vn.update does?

IN Int Update type: 0: Replace the whole template. 1: Merge new template with the existing one.

I don’t know if this input is also required by one.vn.update_ar, if so the XML-RPC API documentation should be updated. do you know what’s the issue?

Cheers and thanks!
Alvaro

I just checked the code and the docs are correct, updatear requires string,int,string.
The problem must be somewhere else, sorry.

One more thing, this could be it. I just saw that your log says one.vn.updatear. The api call is actually one.vn.update_ar

Hi @cmartin

Yes is something else, the name is ok, it was a typo writing this message in the forum, I found that running our script the rpm xml template string is empty (so that’s the reason why I get the error message):

 RPC request <?xml version="1.0" encoding="us-ascii"?><methodCall><methodName>one.vn.update_ar</methodName><params><param><value><string>oneadmin:PASSWORD</string></value></param><param><value><int>6</int></value></param></params></methodCall>

I will continue debugging our script to know what is going on…

Thanks!
Alvaro

Finally I found the issue, instead of an string with the new template we sent an array.

Thanks a lot and sorry for the noise…

Alvaro