...
Code Block | ||||
---|---|---|---|---|
| ||||
http -a $TK GET "https://vss-api.eis.utoronto.ca:8001/v2/vm/5012bd15-c20c-a971-aa68-af1a3cf3d0db/" |
HTTP response data would look something like:
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
{ "_links": { .... }, "data": { "config": { "bootDelayMs": 5000, "hotaddCpu": true, "hotaddMem": true, "hotremoveCpu": false }, "folder": { "name": "jm", "parent": "Sandbox", "path": "Public > Sandbox > jm" }, "guest": { "guestFullName": "Ubuntu Linux (64-bit)", "guestId": "ubuntu64Guest", "hostName": null, "ipAddress": null, "toolsStatus": "guestToolsNotInstalled", "toolsVersion": null }, "hardware": { "coresPerSocket": 1, "cpuCount": 2, "devices": { "cds": [], "controllers": [ "IDE 0;IDE 0", "IDE 1;IDE 1", "SCSI controller 0;LSI Logic" ], "disks": [ "Hard disk 1;Thin;4GB", "Hard disk 2;Thin;2GB", "Hard disk 3;Thin;1GB" ], "nics": [ "Network adapter 1;Unused_Or_Quarantine_Veth;00:50:56:92:2b:bd", "Network adapter 2;VL-1102-UTCS;00:50:56:92:11:38" ] }, "memoryMB": 2048, "numEthernetCards": 2, "numVirtualDisks": 3, "version": "vmx-10" }, "name": "1604Q-VMTest_1", "networks": [ "Unused_Or_Quarantine_Veth", "VL-1102-UTCS" ], "snapshot": false, "status": { "alarms": false, "bootTime": "", "overallStatus": "green", "powerState": "poweredOff" }, "storage": { "committedGB": 0, "provisionedGB": 9, "uncommittedGB": 9, "unsharedGB": 0 }, "uuid": "5012bd15-c20c-a971-aa68-af1a3cf3d0db", "vss": { "admin": "JM Lopez:416-123-123:jm@eis.utoronto.ca", "client": "EIS", "inform": "jm@eis.utoronto.ca", "requested": "2016-04-01 10:38:07" } }, "meta": { "count": 11, "time": "0.48864s", "user": "jm" } } |
Note |
---|
Links list have been removed from the VM info section due to its size, however, in the next section we'll describe every single sub resource. |
Create Virtual Machine
To create a new Virtual Machine, send a POST request to /v2/vm/. The attribute values that must be set to successfully create a Virtual Machine are marked with a in the following table:
Attribute | Description | Type | Ref URI | Options | Default | Required |
---|---|---|---|---|---|---|
admin_email | Administrator's email | string | - | - | User's email number submitting the request | |
admin_name | Administrator's name | string | - | - | User's name number submitting the request | |
admin_phone | Administrator's phone number | string | - | - | User's phone number submitting the request | |
bill_dept | Billing Department | string | - | - | - | |
built_from | Build process. If you are installing OS from scratch use os_install. Clone when deploying a VM from a running or powered off virtual Machine. Template gives the ability to deploy multiple VMs at the same time. | string | - | os_install clone template | - | |
cpu | CPU count | integer | - | - | 1 | |
description | Short description of the service or application. This will be part of the annotations field. | string | - | - | - | |
disks | Disks in GigaBytes. | array | - | - | [40] | |
high_io | If set to true,VM will be created with a VMware Paravirtual SCSIController. PVSCSI controllers are best suited for environments, especially SAN environments, running I/O-intensive applications. | boolean | - | True False | False | |
domain | Fault domain moId (Managed Object Identifier) | string | /v2/domain/ | - | Fualt Domain 3 | |
folder | Folder moId (Managed Object Identifier) | string | /v2/folder/ | - | - | |
inform | Informational comma separated emails | string | - | - | User's email number submitting the request | |
iso | ISO image path to be mounted after creation | string | /v2/isos/ | - | None | |
memory | Memory in GB | integer | - | - | 1 | |
name | Human readable name without the VSS Prefix. This prefix will be added before creation. | string | - | - | Randomly generated | |
networks | Network Managed Object Identifier (moId) array. Each network will be attached to a Network Adapter VMXNET3, the most recent virtual network device from VMware, and was designed from scratch for high performance and to support new features. | array | - | - | Unaccessible VLAN | |
os | Supported guest operating system identifier. | string | /v2/os/ | - | - | |
usage | Virtual Machine usage. Prod for Production, Test for testing, QA for Quality Assurance, and Dev for Development. | string | - | Prod Test QA Dev | Test | |
source_vm | Template or Source Virtual Machine Uuid. | string | /v2/vm/
| - | - | only with clone |
source_template | Source Virtual Machine Template Uuid. | string | /v2/template/ | - | - | only with template/clone |
A new virtual machine can be created with as few as the following attributes in JSON format:
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
{"usage": "Prod", "os": "ubuntu64Guest", "built_from": "os_install", "bill_dept": "EIS", "description": "Java web application.", "folder": "group-v4122", "networks": ["dvportgroup-95", "dvportgroup-92"], "disks": [40, 100] } |
Example HTTPie POST request:
Code Block | ||
---|---|---|
| ||
http -a $TK POST https://vss-api.eis.utoronto.ca:8001/v2/vm/ usage='Prod' os='ubuntu64Guest' built_from='os_install' bill_dept='EIS' description='Java web application.' folder='group-v4122' networks:='["dvportgroup-95", "dvportgroup-92"]' disks:='[40, 20]' |
Example CURL POST request
Code Block | ||
---|---|---|
| ||
curl -u $TK -X POST "https://vss-api.eis.utoronto.ca:8001/v2/vm/" -d '{"usage": "Prod", "os": "ubuntu64Guest", "built_from": "os_install", "bill_dept": "EIS", "description": "Java web application.", "folder": "group-v4122", "networks": ["dvportgroup-95", "dvportgroup-92"], "disks": [40, 100]}' |
If the request was successfully submitted and all parameters were accepted, the following Response Status, Headers and body will be received:
Code Block | ||||
---|---|---|---|---|
| ||||
HTTP/1.0 202 ACCEPTED Allow: HEAD, POST, OPTIONS, GET Content-Length: 364 Content-Type: application/json Date: Tue, 26 Apr 2016 18:24:23 GMT Location: https://vss-api.eis.utoronto.ca:8001/v2/request/task/fa276e28-a876-477a-ab40-0d2d84df9234 X-RateLimit-Limit: 7200 X-RateLimit-Remaining: 7190 X-RateLimit-Reset: 1461697200 |
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
{ "data": { "_links": { "request": "https://vss-api.eis.utoronto.ca:8001/v2/request/new/8", "task": "https://vss-api.eis.utoronto.ca:8001/v2/request/task/fa276e28-a876-477a-ab40-0d2d84df9234" }, "message": "New VM Request has been accepted for processing", "name": "Accepted", "status": 202 }, "meta": { "time": "0.08575s", "user": "jm" } } |
Note |
---|
Note that you will receive as well additional Hypermedia links contained in the _links attribute. Request object is the new virtual machine creation request which stores all parameters previously submitted and Task, is the unique task in charged of processing your request. Request and Task are both related, in terms of status, errors and warnings. Request will store any status or errores caught by the task, also it will pass the recently created VM Uuid. |
Task
Request processing is almost instantaneous, however you could check the task progress by making a HTTP GET request to any given /v2/request/task/<task_id> endpoint.
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
{ "_links": { "request": "https://vss-api.eis.utoronto.ca:8001/v2/request/", "self": "https://vss-api.eis.utoronto.ca:8001/v2/request/task/a57a3d4a-9e94-4822-a1d3-f99db1005dbd" }, "data": { "result": { "current": 100, "result": { "errors": [], "warnings": [ "Fault Domain: FD3 ", "Created in: VSS > Sandbox > jm", "Network adapter 1: 00:50:56:92:50:6d: VL-1102-UTCS", "Network adapter 2: 00:50:56:92:3f:91: VL-1072-VSGAN" ] }, "status": "1604P-desperate_thompson Processed", "total": 100 }, "status": "SUCCESS" }, "meta": { "count": 2, "time": "0.00028s", "user": "jm" } } |
Request
Checking the overall status of the request and also the resulting Uuid can be done by making a HTTP GET request to /v2/request/new/8 endpoint:
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
{ "_link": { "request": "https://vss-api.eis.utoronto.ca:8001/v2/request/new/", "self": "https://vss-api.eis.utoronto.ca:8001/v2/request/new/8" }, "data": { "_links": { "task": "https://vss-api.eis.utoronto.ca:8001/v2/request/task/fa276e28-a876-477a-ab40-0d2d84df9234", "vm": "https://vss-api.eis.utoronto.ca:8001/v2/vm/50122032-96b8-ac69-f584-89c43aee7fef/" }, "annotation": [ "VM Name: 1604P-cranky_euclid", "UTvssAdmin: JM Lopez Lujan:123-123-1234:jm.lopez@utoronto.ca", "UTvssClient: EIS", "UTvssPurpose: Prod", "UTvssRequested: 2016-04-26 14:24:22 ", "UTvssInform: jm.lopez@utoronto.ca", "Description: Java web application.", "" ], "built_from": "os_install", "cpu": "1", "created_on": "2016-04-26 14:24:22 EDT", "disks": [ 40, 20 ], "domain": "domain-c5877", "dvd_cd": "", "folder": "group-v4122", "guest_os": "ubuntu64Guest", "high_io": false, "id": 8, "memory": "1", "message": { "errors": [], "warnings": [ "Fault Domain: FD3 ", "Created in: VSS > Sandbox > jm", "Network adapter 1: 00:50:56:92:58:56: VL-1102-UTCS", "Network adapter 2: 00:50:56:92:65:2b: VL-1072-VSGAN" ] }, "networks": [ "dvportgroup-95", "dvportgroup-92" ], "source_template": null, "source_vm": null, "status": "Processed", "task_id": "fa276e28-a876-477a-ab40-0d2d84df9234", "updated_on": "2016-04-26 14:27:29 EDT", "user": { "_links": { "self": "https://vss-api.eis.utoronto.ca:8001/v2/user/" }, "id": 1, "username": "jm" }, "vm_name": "1604P-cranky_euclid", "vm_uuid": "50122032-96b8-ac69-f584-89c43aee7fef" }, "meta": { "count": 23, "time": "0.00563s", "user": "jm" } } |