From 2d2b4ccae45338a341fd191bdad21f8bab7f880a Mon Sep 17 00:00:00 2001 From: dave Date: Wed, 28 Dec 2016 16:30:37 -0800 Subject: [PATCH] Update readme & docs --- README.md | 63 +++++++++++++++++++++++++-- example/banutoo2.json | 34 --------------- example/{banutoo.json => ubuntu.json} | 2 +- 3 files changed, 61 insertions(+), 38 deletions(-) delete mode 100644 example/banutoo2.json rename example/{banutoo.json => ubuntu.json} (94%) diff --git a/README.md b/README.md index 1851893..0eb4858 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,62 @@ -zhypervisor -=========== +Z Hypervisor +============ -A minimal hypervisor API based on QEMU. +A minimal hypervisor based on QEMU, with HTTP API + + +Requirements +============ + +- kvm kernel module +- Qemu (Specifically, qemu-system-x86_64) +- brctl (part of bridge-utils on Ubuntu) +- an ethernet bridge named br0 +- it must run as root + + +Install +======= + +- Check out this repo, install using pip3 +- Create a config (see example/zd.json) +- Run `zd -c|--config /path/to/zd.json` + + +HTTP API +======== + +*GET /api/v1/create_disk* + + Create a storate disk to use with machines. Params: + - datastore: datastore name such as 'default' + - name: arbitrary disk name like 'ubuntu-root.bin' + - size: size in megabytes + - fmt: format, raw or qcow2 + +*GET /api/v1/machine/:id/start* + + Start a machine given its id + +*GET /api/v1/machine/:id/stop* + + Stop a machine given its id + +*GET /api/v1/machine/:id/restart* + + Stop a machine given its id + +*GET /api/v1/machine/:id* + + Get the description of a machine or all machines if no id passed + +*PUT /api/v1/machine/:id* + + Create a new machine or update an existing machine. Params: + - machine_id: alphanumeric name for the name + - machine_type: type of virtualization to run the machine with + - machine_spec: serialized json object describing the machine. See the 'spec' key of example/ubuntu.json + +*DELETE /api/v1/machine/:id* + + Delete a machine give its id diff --git a/example/banutoo2.json b/example/banutoo2.json deleted file mode 100644 index a4b53da..0000000 --- a/example/banutoo2.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "machine_id": "banutoo2", - "machine_type": "q", - "spec": { - "options": { - "autostart": true, - "respawn": true - }, - "properties": { - "cores": 2, - "mem": 1024, - "drives": [ - { - "file": "banutoo2.bin", - "datastore": "realm", - "index": 0, - "if": "virtio" - } - ], - "netifaces": [ - { - "type": "nic", - "vlan": 0, - "model": "e1000", - "macaddr": "82:25:60:41:D5:98" - }, - { - "type": "tap" - } - ], - "vnc": 6 - } - } -} diff --git a/example/banutoo.json b/example/ubuntu.json similarity index 94% rename from example/banutoo.json rename to example/ubuntu.json index a6f6c8a..6affcec 100644 --- a/example/banutoo.json +++ b/example/ubuntu.json @@ -11,7 +11,7 @@ "mem": 1024, "drives": [ { - "file": "banutoo.bin", + "file": "ubuntu-root.bin", "datastore": "realm", "index": 0, "if": "virtio"