A stupid simple HTTP API on top of VirtualBox. The design goal for this is an API simple enough to use via Curl.
- No external dependencies aside from VBox
- Can clone from an existing VirtualBox VM
- Can start/stop/destroy VM
Make sure VirtualBox is installed and create a template image with bridged networking enabled and VBox Guest Additions.
In this example, We'll be using an Ubuntu 10.04 image.
Full API documentation at https://github.com/ejfinneran/cloudbox/wiki/API
bundle --without test
rackup
$ curl http://localhost:9292/vms
{
"vms": [
{
"ip_address": "",
"macaddress1": "0800274153F3",
"memory": "384",
"name": "lucid32",
"ostype": "Ubuntu",
"running?": false,
"uuid": "c880a82c-e02c-4dbd-99e1-3d1d5bc560ae"
}
]
}
$ curl -d '' http://localhost:9292/vms/lucid32/clone
{
"instance_id": "1c68b8"
}
$ curl http://localhost:9292/vms/1c68b8
{
"status": "Provisioning"
}
$ curl http://localhost:9292/vms/1c68b8
{
"status": "VM Ready",
"vm": {
"ip_address": "",
"macaddress1": "080027E0DDA4",
"memory": "384",
"name": "1c68b8",
"ostype": "Ubuntu",
"running?": false,
"uuid": "ecf59846-040b-426a-a10c-c065ee1e76f1"
}
}
$ curl -d '' http://localhost:9292/vms/1c68b8/start
{
"response": "VM Started"
}
Note that the IP address may take few moments to be populated. It also requires that VirtualBox Guest Additions are installed on the guest.
$ curl http://localhost:9292/vms/1c68b8
{
"status": "VM Running",
"vm": {
"ip_address": "10.0.1.35",
"macaddress1": "080027E0DDA4",
"memory": "384",
"name": "1c68b8",
"ostype": "Ubuntu",
"running?": true,
"uuid": "ecf59846-040b-426a-a10c-c065ee1e76f1"
}
}
- Ability to set a default "clone from" image
- Ability to clone/import Vagrant images
- In order to use CentOS, the base image needs some extra setup.
- More config options when cloning a VM (Memory etc)
- Fork it
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Added some feature') - Push to the branch (
git push origin my-new-feature) - Create new Pull Request