0

In OpenNebula 5.4, I am able to instantiate a Service from a Service Template using Curl, but I don't know how to provide a service name. The website example works as expected:

curl http://127.0.0.1:2474/service_template/4/action -u 'oneadmin:opennebula' -v -X POST --data '{
  "action": {
    "perform":"instantiate"
  }
}'

Creates a service, with the same name than the service template. But if I run the same trying to add a parameter for that instantiate action (as done when performing an action on a given service), for example:

curl http://127.0.0.1:2474/service_template/4/action -u 'oneadmin:opennebula' -v -X POST --data '{
  "action": {
    "perform":"instantiate", 
    "params" : { 
       "name" : "new_name" 
     }
  }
}'

It ignores that param, resulting in the same as when running the previously mentioned Website example... I tried with 'name', 'service-name', 'service_name', but same result... Do you know how to do that, please? I think it probably is supported (as it is in their Java API), but not documented (as many other features).

In advance, thanks a lot and cheers

0

In the office we found a workaround:

it looks like it's not yet supported to send the parameter, so, it has to be performed a posterior action to update the newly created service, using the new Service ID (the full service JSON is returned in the body of the previous request): E.g: if the new service instantiated has ID 85, it would be:

curl http://127.0.0.1:2474/service/85/action -u 'oneadmin:opennebula' -v -X POST --data '{
"action": {
  "perform": "rename",
  "params": {
    "name": "some-service-name"
  }
 }
}'

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.