Versions Compared

Key

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

...

  1. Get virtual machine UUID using the search feature in the /vm resource:

    Code Block
    languagebash
    titleRequest
    http -a $TK GET "https://vss-api.eis.utoronto.ca:8001/v2/vm?name=vm-testing&summary"
    Code Block
    languagepy
    titleResponse Body
    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/<vm_uuid>"
                },
                "name": "1606D-vm-testing",
                "uuid": "<vm_uuid>"
            }
        ],
        "meta": {
            "count": 1,
            "time": "10.13983s",
            "user": "josem"
        }
    }
  2. Since vSphere does not support disk "shrinking" (unless it's 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 -a $TK DELETE "https://vss-api.eis.utoronto.ca:8001/v2/vm/<vm_uuid>/disk/1"
     
    # HTTP POST to disk 1 resource will create a new 300GB disk as 
    # specified in the attribute value
    http -a $TK POST "https://vss-api.eis.utoronto.ca:8001/v2/vm/<vm_uuid>/disk/1" value=300
  3. Verifying Disk 1 settings:

    Code Block
    languagebash
    titleRequest
    http -a $TK GET "https://vss-api.eis.utoronto.ca:8001/v2/vm/<vm_uuid>/disk/1"
    Code Block
    languagepy
    titleResponse Body
    collapsetrue
    {
        "_links": {
            "self": "https://vss-api.eis.utoronto.ca:8001/v2/vm/<vm_uuid>/disk/1",
            "vm": "https://vss-api.eis.utoronto.ca:8001/v2/vm/<vm_uuid>"
        },
        "data": [
            {
                "capacityGB": 300,
                "controller": {
                    "type": "LSI Logic",
                    "virtualDeviceNode": "SCSI controller 0:1"
                },
                "description": "314,572,800 KB",
                "fileName": "[CL-NSTOR47-NFS-vol31] 1606D-vm-testing/1606D-vm-testing_1.vmdk",
                "label": "Hard disk 1",
                "provisioning": "Thin",
                "shares": {
                    "level": "normal",
                    "shares": 1000
                }
            }
        ],
        "meta": {
            "count": 1,
            "time": "0.04656s",
            "user": "jm"
        }
    }
  4. Adding Disk 3 is done making a POST request to /vm/<vm_uuid>/disk/3 resource:

    Code Block
    http -a $TK POST "https://vss-api.eis.utoronto.ca:8001/v2/vm/<vm_uuid>/disk/3" value=300
  5. Verifying new disk layout:

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

...