Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

By sending requests to the Virtual Machine endpoint /vm/ you can list, create, update or delete VMs.

Note

HTTPie is highly recommended: CLI HTTP client, user-friendly curl replacement with intuitive UI, JSON support, syntax highlighting, wget-like downloads, extensions, etc. http://httpie.org

List all virtual machines

...

NameTypeDescription
uuidstring128-bit UUID of a virtual machine, represented as a hexademical string. This identifier is used by VirtualCenter to uniquely identify all virtual machine instances, including those that may share the same SMBIOS UUID.
namestringVirtual Machine name including VSS prefix.
guestFullNamestringThis is the full name of the guest operating system for the virtual machine. For example: Windows 2000 Professional.
ipAddressstringPrimary IP address assigned to the guest operating system, if known.

memoryMB

integerMemory size of the virtual machine, in megabytes.

cpuCount

integerNumber of processors in the virtual machine. 

overallStatus

stringOverall alarm status on this node.
powerStatestringThe current power state of the virtual machine.
provisionedGBintegerSum of Committed and Uncommitted storage.

...

The following example uses HTTPie to request all Virtual Machine managed by given user without filters:

Code Block
languagepy
themeEmacs
titlehttp -a $TK GET https://vss-api.eis.utoronto.ca:8001/v2/vm/
collapsetrue
HTTP/1.0 200 OK
Allow: HEAD, POST, OPTIONS, GET
Content-Length: 14498
Content-Type: application/json
Date: Mon, 25 Apr 2016 20:50:35 GMT
Server: Werkzeug/0.11.3 Python/2.7.10
X-RateLimit-Limit: 7200
X-RateLimit-Remaining: 7171
X-RateLimit-Reset: 1461618000
{
    "_links": {
        "api": "https://vss-api.eis.utoronto.ca:8001/v2/", 
        "self": "https://vss-api.eis.utoronto.ca:8001/v2/vm/"
    }, 
    "data": [
        {
            "_links": {
                "self": "http://localhost:5000/v2/vm/50125944-d5e0-248d-0f3c-c499acbeb1ce/"
            }, 
            "cpuCount": 2, 
            "folder": {
                "_links": {
                    "self": "http://localhost:5000/v2/folder/group-v6557"
                }, 
                "moref": "group-v6557", 
                "name": "Swarm", 
                "parent": "Sandbox"
            }, 
            "guestFullName": "Other 3.x Linux (64-bit)", 
            "ipAddress": "128.100.228.72", 
            "memoryMB": 2048, 
            "name": "1604P-docker-node2", 
            "overallStatus": "green", 
            "powerState": "poweredOn", 
            "provisionedGB": 22, 
            "uuid": "50125944-d5e0-248d-0f3c-c499acbeb1ce"
        }
    ], 
    "meta": {
        "count": 22, 
        "time": "1.04441s", 
        "user": "jm"
    }
}

Filters

Filtering VM results The main Virtual Machine resource has three main filters to reduce the number of VMs shown in the result or to locate a VM by hostname or ip address.

NameDescription
nameVirtual Machine name string to filter VMs
ipPrimary IP address assigned to the Guest operating system.
dnsHostname of the guest operating system.

Examples

...

summaryDisables VM summary in results.

The following examples show how to implement a GET request with the first three parameters shown below. The result is similar to the previous section.

Code Block
languagebash
themeEmacs
http -a $TK GET https://vss-api.eis.utoronto.ca:8001/v2/vm/?name=Test
http -a $TK GET https://vss-api.eis.utoronto.ca:8001/v2/vm/?ip=10.2.1.2
http -a $TK GET https://vss-api.eis.utoronto.ca:8001/v2/vm/?dns=wiki.eis.utoronto.ca

If you decide to add summary in the list of parameters, you'll disable the summary provided by the API about any given VM for this particular request. For example:

Code Block
languagebash
themeEmacs
titlehttp -a $TK GET https://vss-api.eis.utoronto.ca:8001/v2/vm/?name=Test&summary
collapsetrue
http -a $TK GET https://vss-api.eis.utoronto.ca:8001/v2/vm/?name=Test&summary

HTTP/1.0 200 OK
Allow: HEAD, POST, OPTIONS, GET
Content-Length: 414
Content-Type: application/json
Date: Tue, 26 Apr 2016 01:36:41 GMT
Server: Werkzeug/0.11.3 Python/2.7.10
X-RateLimit-Limit: 7200
X-RateLimit-Remaining: 7196
X-RateLimit-Reset: 1461636000
{
    "_links": {
        "api": "https://vss-api.eis.utoronto.ca:8001/v2/", 
        "self": "https://vss-api.eis.utoronto.ca:8001/v2/vm/"
    }, 
    "data": [
        {
            "_links": {
                "self": "https://vss-api.eis.utoronto.ca:8001/v2/vm/5012bd15-c20c-a971-aa68-af1a3cf3d0db/"
            }, 
            "name": "1604Q-VMTest_1", 
            "uuid": "5012bd15-c20c-a971-aa68-af1a3cf3d0db"
        }
    ], 
    "meta": {
        "count": 1, 
        "time": "1.86220s", 
        "user": "jm"
    }
}
Note

From now on, you will need the UUID of any virtual machine, provided by the "_links" section, to get further information about it and eventually to modify properties.

 

List specific virtual machine info

...