Versions Compared

Key

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

Table of Contents
outlinetrue

Introduction

By sending requests to the Virtual Machine endpoint https://vss-api.eis.utoronto.ca:8001/v2/vm/ you can list, create, update or delete VMs.

...

The Virtual Machine endpoint has the following methods available:

ResourceURIDescriptionGETPOSTPUTDELETEOPTIONS*
Virtual Machine/vm/Virtual Machine management resource. Read, update, delete, create virtual machines.(tick)(tick)(tick)(tick)(tick)
Note

Remember, you can also show what methods are allowed and method description, parameters, etc. by making a GET HTTP request to https://vss-api.eis.utoronto.ca:8001/v2/vm/.

Code Block
http OPTIONS "https://vss-api.eis.utoronto.ca:8001/v2/vm/"
curl -X OPTIONS "https://vss-api.eis.utoronto.ca:8001/v2/vm/" 

 

 

 

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 examples use HTTPie and CURL to request all ALL Virtual Machine managed by given user without filters:

:8001/v2/vm/
Code Block
languagepybash
themeDJangotitle
http -a $TK GET "https://vss-api.eis.utoronto.ca:8001/v2/vm/"
curl -u $TK -X GET "https://vss-api.eis.utoronto.ca
:8001/v2/vm/"

HTTP response data would look something like:

Code Block
languagepy
themeDJango
titleResponse
collapsetrue
{
    "_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/50125944-d5e0-248d-0f3c-c499acbeb1ce/"
            }, 
            "cpuCount": 2, 
            "folder": {
                "_links": {
                    "self": "https://vss-api.eis.utoronto.ca:8001/v2/folder/group-v6557"
                }, 
                "moref": "group-v12342", 
                "name": "Swarm", 
                "parent": "Sandbox"
            }, 
            "guestFullName": "Other 3.x Linux (64-bit)", 
            "ipAddress": "128.100.72.1", 
            "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"
    }
}

...

Code Block
languagebash
themeDJango
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:

DJangov2/vm/?name=Test&summary
Code Block
languagebash
theme
title
http -a $TK GET "https://vss-api.eis.utoronto.ca:8001/
v2/vm/?name=Test&summary"

HTTP response data would look something like:

Code Block
languagebash
themeDJango
titleHTTP Response
collapsetrue
{
    "_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 either the uuid attribute or in the "_links" section, to get further information about it and eventually to modify propertiesits configuration.

 

List specific virtual machine info

...

 The following example, requests information about a particular VM using its base resource /vm/ and appending the UUID to get the URI /vm/5012bd15-c20c-a971-aa68-af1a3cf3d0db/

 

Code Block
languagepybash
themeDJangotitle
 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
languagepy
themeDJango
titleResponse
collapsetrue
{
    "_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.