Versions Compared

Key

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

...

Step-by-step guide

  1. Get virtual machine UUID ID, either moref or uuid using the search feature in the /vm resource:

    Code Block
    languagebash
    titleRequest
    http GET "https://vss-api.eis.utoronto.ca/v2/vm?name=vm-testing&summarylike,%Frontend2%&short=1" "Authorization: Bearer $TK"


    Code Block
    languagepy
    titleResponse Body
    collapsetrue
    {
        "_links": {
            "apiself": "https://vss-api-dev.eis.utoronto.ca/v2/vm?filter=name,like,%25Frontend2%25&short=1"
        },
        "data": [
         "self": "https://vss-api.eis.utoronto.ca/v2/vm"
        },   {
                "hostname": null,
                "ip_address": "",
                "moref": "vm-2183",
                "name": "2004T-Frontend2",
                "power_state": "poweredOff",
                "datauuid": [ "50309a8a-88ca-5291-2ad3-63f2522c3f8e"
            }
        ],
        "meta": {
            "count": 1,
            "_linksfilter": {"name,like,%Frontend2%",
            "pages": {
            "self    "first_url": "https://vss-api-dev.eis.utoronto.ca/v2/vm/<vm_uuid>"?filter=name%2Clike%2C%25Frontend2%25&page=1&per_page=100&expand=True",
                }"last_url": "https://vss-api-dev.eis.utoronto.ca/v2/vm?filter=name%2Clike%2C%25Frontend2%25&page=1&per_page=100&expand=True",
                "namenext_url": null,
             "1606D-vm-testing"   "page": 1,
                "uuidpages": "<vm_uuid>"1,
            }     ],"per_page": 100,
                "metaprev_url": {null,
                "counttotal": 1
            },
            "time": "100.13983s00804s",
            "user": "josemjm"
        }
    }


  2. Since vSphere does not support disk "shrinking" (unless it's the disk is cloned to a new target disk), we would need to remove Disk 1 and create a new Disk 1 of 300GB. This can be done as follows:

    Code Block
    languagebash
    # HTTP DELETE method to the right disk resource will remove the disk
    http DELETE "https://vss-api.eis.utoronto.ca/v2/vm/<vm_uuid>-id>/disk/1" "Authorization: Bearer $TK"
     
    # HTTP POST to disk 1 resource will create a new 300GB disk as 
    # specified in the attribute value
    http POST "https://vss-api.eis.utoronto.ca/v2/vm/<vm_uuid>-id>/disk/1" "Authorization: Bearer $TK" value:='[300]' 


  3. Verifying Disk 1 settings:

    Code Block
    languagebash
    titleRequest
    http GET "https://vss-api.eis.utoronto.ca/v2/vm/<vm_uuid>/disk/1" "Authorization: Bearer $TK"


    Code Block
    languagepy
    titleResponse Body
    collapsetrue
    {
        "_links": {
            "selfdisk": "https://vss-api-dev.eis.utoronto.ca/v2/vm/<vm_uuid>vm-2183/disk/1",
            "vmself": "https://vss-api-dev.eis.utoronto.ca/v2/vm/<vm_uuid>/vm-2183/disk/1"
        },
        "data": [
            {
                "capacityGBcapacity_gb": 300,
                "controller": {
                    "type": "LSI Logic",
                    "virtualDeviceNodevirtual_device_node": "SCSI controller 0:10"
                },
                "description": "314,572,800 KB",
                "fileNamekey": "[CL-NSTOR47-NFS-vol31] 1606D-vm-testing/1606D-vm-testing_1.vmdk"2000,
                "label": "Hard disk 1",
                "provisioningshares": "Thin",{
                    "shareslevel": {"normal",
                    "levelshares": "normal",1000
                 },
      "shares": 1000         "unit": 1
      }         }
        ],
        "meta": {
            "count": 1,
            "time": "0.04656s03733s",
            "user": "jm"
        }
    }


  4. Adding Disk 3 is done making a POST request to /vm/<vm_uuid>/disk /3 resource:

    Code Block
    http POST "https://vss-api.eis.utoronto.ca/v2/vm/<vm_uuid>-id>/disk" "Authorization: Bearer $TK"  value:='[300]' 


  5. Verifying new disk layout:

    Code Block
    http GET "https://vss-api.eis.utoronto.ca/v2/vm/<vm_uuid>-id>/disk" "Authorization: Bearer $TK"


    Code Block
    languagepy
    titleResponse Body
    collapsetrue
    {
        "_links": {
            "self": "https://vss-api.eis.utoronto.ca/v2/vm/<vm_uuid>-id>/disk",
            "vm": "https://vss-api.eis.utoronto.ca/v2/vm/<vm_uuid>-id>"
        },
        "data": [
            {
                "_links": {
                    "self": "https://vss-api.eis.utoronto.ca/v2/vm/<vm_uuid>-id>/disk/1"
                },
                "capacityGB": 300,
                "labelunit": "Hard disk 1"
            },
            {
                "_links": {
                    "self": "https://vss-api.eis.utoronto.ca/v2/vm/<vm_uuid>-id>/disk/2"
                },
                "capacityGB": 300,
                "labelunit": "Hard disk 2"
            },
            {
                "_links": {
                    "self": "https://vss-api.eis.utoronto.ca/v2/vm/<vm_uuid>-id>/disk/3"
                },
                "capacityGB": 300,
                "labelunit": "Hard disk 3"
            }
        ],
        "meta": {
            "count": 2,
            "time": "0.05709s",
            "user": "jm"
        }
    }


...