Hardware policy API

Hardware policy API

Configure CPU locality, memory backing, placement requirements, and exclusive devices.

Hardware policies define a droplet's placement and virtual hardware requirements. Updates preserve the resource identity and are checked against its current execution state.

PATCH/organizations/{organization_id}/projects/{project_id}/droplets/{droplet_id}/hardware-policy
Scope
droplets:write
Auth
Bearer API key

Updates the droplet's hardware and placement requirements.

Requires the current droplet If-Match. Omitted top-level sections remain unchanged. Supplied CPU, memory, and placement objects replace their complete section; explicit null is rejected.

To require dedicated CPU and huge pages in one NUMA domain, send:

JSON
{
  "cpu": { "profile_id": "cpu_baseline_v2", "allocation": "dedicated" },
  "memory": { "backing": "huge_pages", "page_size_kib": 2048 },
  "placement": {
    "numa": "single_domain",
    "node_selector": { "workload.class": "latency-sensitive" },
    "tolerations": [
      {
        "key": "workload.class",
        "operator": "Equal",
        "value": "latency-sensitive",
        "effect": "NoSchedule"
      }
    ]
  }
}

CPU allocation defaults to shared and accepts dedicated. Memory backing defaults to standard; huge_pages requires a supported positive integer page_size_kib. Supplying that field with standard backing is rejected. NUMA placement defaults to default and also accepts preferred or single_domain.

CPU profile, allocation, memory backing, and NUMA changes require a stopped guest. Selectors and tolerations can change while running but do not evict the guest. Invalid combinations return 422 invalid_hardware_policy; an unsupported running change returns 409 droplet_must_be_stopped. Accepted realization returns 202 with the operation.

Scratch disks are configured through the policy's scratch_disks array, whose entries have a name and positive integer size_gib. The array defaults to empty and replaces the complete set when supplied. Editing it requires a stopped guest and can discard previous scratch contents as shown in the impact review.

Inspect effective requirements

GET/organizations/{organization_id}/projects/{project_id}/droplets/{droplet_id}/hardware-policy
Scope
droplets:read
Auth
Bearer API key

Returns requested policy, inherited pool constraints, effective reservations, and observed hardware. Requires droplets:read. An unmet desired selector is reported separately from the current execution node.

Changing a requested backing mode does not expand the node's huge-page pool. Admission still requires physical page capacity and supported guest capabilities.

Devices and scratch storage

POST/organizations/{organization_id}/projects/{project_id}/droplets/{droplet_id}/devices
Scope
droplets:write
Auth
Bearer API key

Creates an exclusive device assignment for a stopped guest.

Accepts exactly one device_id or device_class_id. It requires a stopped guest, its ETag, and permission to use that device pool. Returns 202 with the exclusive assignment and operation. Occupied or quarantined devices reject admission.

See NUMA and memory, node taints, passthrough devices, and ephemeral disks before planning migration or recovery.

Remove a device assignment

DELETE/organizations/{organization_id}/projects/{project_id}/droplets/{droplet_id}/devices/{assignment_id}
Scope
droplets:write
Auth
Bearer API key

Removes an exclusive device assignment from a stopped guest. Requires the current droplet ETag in If-Match. A running guest returns 409 droplet_must_be_stopped.

Accepted work returns 202 with a reset-and-cleanup operation. A device remains reserved until reset and ownership cleanup succeed. A failed reset leaves the device quarantined; an unreachable owner requires fencing before the reservation can be cleared.