Calculating reservations and workload placement

Turbonomic includes the capability to reserve resources for VMs you plan to deploy in the future. Turbonomic calculates optimal placement for these VMs and then reserves the host and storage resources that they need.

To reserve VMs, you will choose a VM template, specify any placement constraints, set how many instances to reserve, and then indicate whether to reserve now or in the future. Because reserved VMs do not yet exist, they do not participate in the real-time market. VM templates specify the resource requirements for each reserved VM, including:

  • Compute and storage resources allocated to each VM

  • Consumed factor. This is the percentage of allocated CPU, memory, or storage that the reserved VM will utilize.

Note that before using the API to work with reservations, you should understand how reservations work from the user interface.

With the API, you can perform the following:

  • Get list of reservations

  • See the current placement for the reservation workloads

  • Create reservations

  • Delete a current reservation

Getting reservation information

To get a list of current reservations, execute /rest/reservations. This returns a list of all active reservations. If you know the UUID of the reservation you want, you can pass it to get data for just that reservation.

Each reservation object includes:

  • Display name

  • Status — can be:

    • DEPLOYINGTurbonomic is deploying the workload

    • DEPLOY_SUCCEEDED — The workload was successfully deployed

    • IN_PROGRESS — Placement calculation is in progress

    • PLACEMENT_SUCCEEDED — For a new reservation, the environment has sufficient resources to place the workload; if you specified a reserve date, this will be an active reservation

    • PLACEMENT_FAILED — For a newly created reservation, the environment doesn’t have resources to place the workload; if you specified a reserve date, this will be an unfulfilled reservation

    • RETRYINGTurbonomic is trying to place the workload of an unfulfilled reservation

  • Time the reservation was created, time to deploy, and time it will expire

  • A description of the reserved workload

  • The deployment profile that identifies the physical files that will be copied to deploy the workload, as well as optional placement limitations.

  • Statistics for the compute and storage resources the reservation sets aside

For example, this listing shows a reservation for one VM:

{
  "uuid": "_kWZHIDDmEeePgeXuo0RRbw",
  "displayName": "MyReservation",
  "count": 1,
  "status": "PLACEMENT_SUCCEEDED",
  "reserveDateTime": "Thu May 04 16:27:29 UTC 2017",
  "expireDateTime": "Thu Aug 31 16:27:29 UTC 2017",
  "deployDateTime": "Thu Aug 31 16:27:29 UTC 2017",
  "reserveCount": 1,
  "demandEntities": [
    {
      "uuid": "_kWgb7TDmEeePgeXuo0RRbw",
      "displayName": "MyReservation_C0",
      "className": "VirtualMachine",
      "template": {
        "uuid": "T423f548d-cadc-e525-6df4-1f90724cf696",
        "displayName": "vsphere-dc3.dev.mycorp.com::TMP-SUSE64",
        "className": "VirtualMachineProfile"
      },
      "deploymentProfile": {
        "uuid": "_gHJ0ICXxEeePgeXuo0RRbw",
        "displayName": "DEP-SUSE64",
        "className": "ServiceCatalogItem"
      },
      "placements": {
        "computeResources": [
          {
            "stats": [
              {
                "name": "numOfCpu",
                "value": 1
              },
              {
                "name": "cpuSpeed",
                "value": 2603
              },
              {
                "name": "cpuConsumedFactor",
                "value": 0.5
              },
              {
                "name": "memorySize",
                "value": 2097152
              },
              {
                "name": "memoryConsumedFactor",
                "value": 0.75
              },
              {
                "name": "ioThroughput",
                "value": 0
              },
              {
                "name": "networkThroughput",
                "value": 0
              }
            ],
            "provider": {
              "uuid": "Virtual_ESX_42381da5-12fa-1e82-2f1c-887419380d43",
              "displayName": "hp-esx21.corp.vmturbo.com",
              "className": "PhysicalMachine"
            }
          }
        ],
        "storageResources": [
          {
            "stats": [
              {
                "name": "diskSize",
                "value": 18432.363
              },
              {
                "name": "diskIops",
                "value": 0
              }
            ],
            "provider": {
              "uuid": "10545c15-7687ef26",
              "displayName": "QS2:ESXDC3DS1",
              "className": "Storage"
            }
          }
        ]
      }
    }
  ]
}

Creating a reservation

To create a reservation, you POST an input DTO that defines the reservation's:

  • action: The action type: RESERVATION

  • demandName: The display name of the reservation — If you do not specify names for the added workloads, this will be the root name for new VMs

  • placementParameters:

    • constraintIDs: An array of UUIDs for placement policies that will affect the calculated placement

    • count: The number of workloads to place

    • entityNames: An array of names for the placed VMs — The array length should equal count

    • geographicRedundancy: If true place the workloads on unique hosts, otherwise Turbonomic can place multiple workloads on the same host

    • templateID: The UUID of the template that you will use to place this workload — Note that the template must include a reference to the deployment profile that you specify in deploymantParameters

  • expireDateTime: When to cancel a reservation if Turbonomic cannot place all the workloads by that date — for a RESERVATION action, Turbonomic automatically sets the deploy time to equal this time

  • reserveDateTime: The time to calculate the workload placement and create the reservation — This time cannot be earlier than the time that you POST the reservation to the API

The following listing shows an input DTO that creates a reservation. It will place four workloads, and it gives specific names ot each one.

{
  "action": "RESERVATION",
  "demandName": "MyReservation",
  "expireDateTime": "2017-10-10T12:38:17+00:00",
  "parameters": [
    {
      "deploymentParameters": {
        "deploymentProfileID": "_c9CJMDDAEeePgeXuo0RRbw"
      },
      "placementParameters": {
        "geographicRedundancy": false,
        "count": 4,
        "entityNames": [
          "foo","bar","baz","bonk"
        ],
        "templateID": "_UKsnkJkSEeCHcOXEhzJExA"
      }
    }
  ],
  "reserveDateTime": "2017-05-04T18:22:12+00:00"
}

Async placement calculation

When you POST a reservation, Turbonomic runs a plan to calculate the optimal placement of the workloads. Depending on the size of the reservation, this can take a significant amount of time. The API calculates the placement asynchronously. If your script relies on the reservation, you should verify that the reservation has completed before moving on.

When you execute a reservation, the response to your POST shows that the calculation is in progress:

{
    "uuid": "_0dPrYTDlEeePgeXuo0RRbw",
    "displayName": "MyReservation",
    "count": 4,
    "status": "IN_PROGRESS",
    "reserveDateTime": "Thu May 04 18:22:12 UTC 2017",
    "expireDateTime": "Tue Oct 10 12:38:17 UTC 2017"
}

To examine the placement results, GET the reservation using the UUID that the API gives in the response.

Using templates

To create a reservation you specify a template that contains workload requirements. VM Templates specify the resources that will be available to the VM, including:

  • VCPUs

  • Virtual Memory

  • Storage

  • Network Throughput

  • IOPS

  • IO Throughput

Note that templates can be created by users, and Turbonomic also discovers templates that are created by the management services in your environment. For example, a hypervisor or a cloud service provider typically manages a number of its own templates — Turbonomic discovers these. You should never edit a discovered template.

To see whether a template is discovered, GET the template you're interested in and look for the discovered property. This will be true or false.