Update vmpooler README and API documentation

This commit is contained in:
kirby@puppetlabs.com 2020-05-11 21:25:53 -07:00
parent 8459e2ec21
commit 141e972526
2 changed files with 80 additions and 4 deletions

View file

@ -7,8 +7,7 @@ vmpooler provides configurable 'pools' of instantly-available (running) virtual
## Usage
At [Puppet, Inc.](http://puppet.com) we run acceptance tests on thousands of disposable VMs every day. Dynamic cloning of VM templates initially worked fine for this, but added several seconds to each test run and was unable to account for failed clone tasks. By pushing these operations to a backend service, we were able to both speed up tests and eliminate test failures due to underlying infrastructure failures.
At [Puppet, Inc.](http://puppet.com) we run acceptance tests on thousands of disposable VMs every day. Vmpooler manages the lifecycle of these VMs from request through deletion, with options available to pool ready instances, and provision on demand.
## Installation
@ -85,7 +84,7 @@ docker run -it vmpooler manager
### docker-compose
A docker-compose file is provided to support running vmpooler easily via docker-compose.
A docker-compose file is provided to support running vmpooler easily via docker-compose. This is useful for development because your local code is used to build the gem used in the docker-compose environment.
```
docker-compose -f docker/docker-compose.yml up
@ -113,7 +112,6 @@ A dashboard is provided to offer real-time statistics and historical graphs. It
## Command-line Utility
- The [vmpooler_client.py](https://github.com/puppetlabs/vmpooler-client) CLI utility provides easy access to the vmpooler service. The tool is cross-platform and written in Python.
- [vmfloaty](https://github.com/briancain/vmfloaty) is a ruby based CLI tool and scripting library written in ruby.
## Vagrant plugin

View file

@ -6,6 +6,7 @@
5. [VM snapshots](#vmsnapshots)
6. [Status and metrics](#statusmetrics)
7. [Pool configuration](#poolconfig)
8. [Ondemand VM provisioning](#ondemandvm)
### API <a name="API"></a>
@ -799,3 +800,80 @@ $ curl -X POST -H "Content-Type: application/json" -d '{"debian-7-i386":"1"}' --
"ok": true
}
```
#### Ondemand VM operations <a name="ondemandvm"></a>
Ondemand VM operations offer a user an option to directly request instances to be allocated for use. This can be very useful when supporting a wide range of images because idle instances can be eliminated.
##### POST /ondemandvm
All instance types requested must match a pool name or alias in the running application configuration, or a 404 code will be returned
When a provisioning request is accepted the API will return an indication that the request is successful. You may then poll /ondemandvm to monitor request status.
An authentication token is required in order to request instances on demand when authentication is configured.
Responses:
* 201 - Provisioning request accepted
* 403 - Request exceeds the configured per pool maximum
* 404 - A pool was requested, which is not available in the running configuration, or an unknown error occurred.
* 409 - A request of the matching ID has already been created
```
$ curl -X POST -H "Content-Type: application/json" -d '{"debian-7-i386":"4"}' --url https://vmpooler.example.com/api/v1/ondemandvm
```
```json
{
"ok": true,
"request_id": "e3ff6271-d201-4f31-a315-d17f4e15863a"
}
```
##### GET /ondemandvm
Get the status of an ondemandvm request that has already been posted.
When the request is ready the ready status will change to 'true'.
The number of instances pending vs ready will be reflected in the API response.
Responses:
* 200 - The API request was successful and the status is ok
* 202 - The request is not ready yet
* 404 - The request can not be found, or an unknown error occurred
```
$ curl https://vmpooler.example.com/api/v1/ondemandvm/e3ff6271-d201-4f31-a315-d17f4e15863a
```
```json
{
"ok": true,
"request_id": "e3ff6271-d201-4f31-a315-d17f4e15863a",
"ready": false,
"debian-7-i386": {
"ready": "3",
"pending": "1"
}
}
```
```json
{
"ok": true,
"request_id": "e3ff6271-d201-4f31-a315-d17f4e15863a",
"ready": true,
"debian-7-i386": {
"hostname": [
"vm1",
"vm2",
"vm3",
"vm4"
]
}
}
```
##### DELETE /ondemandvm
Delete a ondemand request that is completed
Deleting a ondemand request will delete any instances created for the request and mark the backend data for expiration in two weeks