Creating an API for XCP-ng tasks
I would like to hire a developer to help us create an interface for our customers to start/restart/shutdown their VMs running on XCP-ng.
We've had some discussions around approaching this, but I would like to hear from others what is the best way to create an API to talk to XCP-ng from a PHP based web application.
Happy to hear thoughts, input and advice.
XCP-ng's main API is the XenAPI.
However, have you looked at Xen Orchestra's ACLs?
Yes, I have installed and played with that and tried xo-cli, however it's just not a proper API that we can pass commands from an external application.
Why not using XO API then? What's not covered there for what you need?
I can't find any detailed documentation on how to access and use the API, i could only find the xo-cli command reference guide.
We want to create XEN functions (start/restart/shutdown) from our web application which is PHP.
Is there a set of docs somewhere ?
Each feature you can access with
xo-clican be called with XO API. It's JSON-RPC, so it will be easy to call it in PHP (for example).
Is there a definitive guide for the xo-cli commands ?
Where can I find an example of a JSON-RPC call that we can learn from ?
Pinging @julien-f to give you a good answer
xo-cliis an advanced tool, mainly for the developers of XO, but useful for advanced users well
There is no guide of commands, it uses introspection to get the available commands from
For more information, take a look at the documentation.
I have played with xo-cli and have an idea on it's workings, however that's not useful for creating scripts to utilise the API.
I want to understand how to form an API instruction to perform a task.
Is there a guide to creating JSON-RPC scripts that work with XO Server?
You can call the method
system.getMethodsInfoto see which methods are available.
You can use
We had a discussion with our developer on Friday and he was recommending we look at ovirt to achieve our goal here, but I am not yet convinced we need to start down that path.
We've run XEN/XCP in our environment since version 5, hence I am keen to continue with it as our core, however customer service is a growing issue for us as our customers are complaining about lack of self-service capability which is fair enough.
Thanks for your help.
oVirt is the same concept, the only diff is maybe a REST API, but otherwise it's really similar (but even a bit harder to setup).
Anyway, if you need assistance on API calls, let us know.