The daemon responds to commands issued by the host machine sent to it over the internet encrypted. Certain tasks are performed on the machine running the daemon, and then information must be returned to the host machine. To do this, the JSON specification was chosen to encapsulate data being sent back and forth between the machines. To minimize any damage that can be done by malacious users, the daemon responds to a certain API written in JSON form. These specific forms are outlined below, with their effect on the machine running the daemon process, along with the content the machines return upon execution.
A request has four name/value pairs as JSON, which are
- The id is a unique positive integer. The response must contain the same id.
- The action specifies the vzctl command to execute.
- The args are the positional arguments passed to the action, usually the VEID.
- The kwargs are the keyword arguments passed to the action.
For example, the usage for
`vzctl create` is,
To create a VE with VEID 100, the Django template, 10.0.0.1 as the ip address, and the hostname foo,
The response is similar.
The id is the same id as the request.
The code is always 0 for a successful execution of the command. A non-zero code indicates failure.
The response is an optional element for the return value(s) from the command.
NOTE: If the execution fails, returned is always an array of string representing the STDERR.