/v1/volumes/{uid}/attachQueues attaching an available volume to a VM. The volume moves to attaching straight
away and to in-use when the operation succeeds. If attaching fails, the volume goes back
to available and last_failure explains why.
Requirements:
- The volume must be
available. - The VM must be in this workspace,
running, and in the same zone as the volume.
On its first attach, a volume that is not yet formatted is formatted with its
filesystem. Once the VM's guest agent reports the mounted filesystem, device_name,
mount_path and usage appear on the volume. Volumes are mounted under /mnt/rumpty/.
This is asynchronous. It returns 202 Accepted with an operation_id. See
Get an operation. The X-Idempotency header is
optional. A retry with the same key for the same volume returns the original operation with
200 OK, before the volume's state is checked. The same key with a different vm_uid
returns 409 with action: idempotency_key_reused.
Authentication
Send your API key as Authorization: Bearer <token>. The request is scoped to the workspace in X-Workspace-Slug.
Path parameters
uidstringRequiredThe volume's uid.
Headers
X-Workspace-SlugstringRequiredSlug of the workspace the request acts on. You can also pass it as the workspace_slug query parameter.
X-IdempotencystringOptional unique key for this request, such as a UUID. Leading and trailing spaces are
trimmed. If the key was already used for the same action (and the same volume, or for a
create the same name), the original operation is returned with 200 OK,
is_replay: true and the X-Idempotency-Replay header, and nothing new is queued. The
replay is checked before the volume's current state, so a retry after the first request
finished still gets the original result. If the key was used for any other operation in
the workspace, including VM, database or snapshot operations, the request is rejected with
409 and action: idempotency_key_reused.
Request body
vm_uidstringRequiredUID of the VM to attach the volume to. See List VMs.
Response
The attach operation was queued.
successbooleanRequiredtrue when the request succeeded.
messagestringRequiredHuman-readable status message.
dataobjectShow attributesHide attributes
operation_idstringRequiredUID of the queued (or replayed) operation. Pass it to Get an operation.
volumeobjectRequiredShow attributesHide attributes
uidstringRequiredUnique identifier of the volume.
namestringRequiredDisplay name of the volume.
slugstringRequiredURL-friendly form of the name. Not necessarily unique.
descriptionstringFree-text description. Omitted when empty.
statusstringRequiredLifecycle state. available volumes can be attached, in-use volumes are attached to
the VM in vm_uid. failed means creating or deleting the volume failed. See
last_failure. deleted only appears in an idempotent replay of a delete.
One ofcreatingavailableattachingin-usedetachingdeletingdeletedfailed
zone_slugstringRequiredZone the volume lives in.
size_gibintegerRequiredSize of the volume in GiB.
filesystemstringRequiredFilesystem the volume is formatted with.
One ofext4xfs
formattedbooleanRequiredtrue once the volume has been formatted, which happens on its first successful attach.
vm_uidstringUID of the VM the volume is attached to or being attached to. Omitted when detached.
vm_namestringName of that VM. Omitted when detached or when the VM cannot be found.
device_namestringBlock device inside the VM, as reported by the guest agent. Omitted until reported.
mount_pathstringWhere the volume is mounted inside the VM, under /mnt/rumpty/, as reported by the guest agent. Omitted until reported.
usageobjectFilesystem usage reported by the VM's guest agent. Omitted until the agent has reported a sample for the mounted volume. The last sample is kept after the volume is detached.
Show attributesHide attributes
total_bytesintegerRequiredFilesystem size in bytes.
used_bytesintegerRequiredBytes in use.
available_bytesintegerRequiredBytes still available.
used_percentnumberRequiredPercentage of the filesystem in use.
sampled_atstring (date-time)RequiredWhen the sample was taken.
stalebooleanRequiredtrue when the sample is older than the agent's normal reporting interval.
created_atstring (date-time)RequiredWhen the volume was created (RFC 3339).
attached_atstring (date-time)When the volume was last attached. Omitted if it has never been attached. Kept after the volume is detached.
detached_atstring (date-time)When the volume was last detached. Omitted if it has never been detached or was attached again since.
last_failurestringReason for the last failed operation on the volume. Omitted when there is none.
statusstringRequiredStatus of the operation. queued for a new request. On a replay, the original operation's current status.
One ofqueuedrunningsucceededfailed
events_urlstringRequiredPath of the server-sent events stream with the operation's progress.
is_replaybooleanRequiredtrue when an existing operation was returned for a reused X-Idempotency key.
is_completedbooleanPresent and true on a replay whose original operation has already finished.
Response
Replay. The X-Idempotency key was already used for this action, so the existing
operation is returned and nothing is queued. status is the operation's status and
volume is the volume as it is now (status: deleted once it is gone).
successbooleanRequiredtrue when the request succeeded.
messagestringRequiredHuman-readable status message.
dataobjectShow attributesHide attributes
operation_idstringRequiredUID of the queued (or replayed) operation. Pass it to Get an operation.
volumeobjectRequiredShow attributesHide attributes
uidstringRequiredUnique identifier of the volume.
namestringRequiredDisplay name of the volume.
slugstringRequiredURL-friendly form of the name. Not necessarily unique.
descriptionstringFree-text description. Omitted when empty.
statusstringRequiredLifecycle state. available volumes can be attached, in-use volumes are attached to
the VM in vm_uid. failed means creating or deleting the volume failed. See
last_failure. deleted only appears in an idempotent replay of a delete.
One ofcreatingavailableattachingin-usedetachingdeletingdeletedfailed
zone_slugstringRequiredZone the volume lives in.
size_gibintegerRequiredSize of the volume in GiB.
filesystemstringRequiredFilesystem the volume is formatted with.
One ofext4xfs
formattedbooleanRequiredtrue once the volume has been formatted, which happens on its first successful attach.
vm_uidstringUID of the VM the volume is attached to or being attached to. Omitted when detached.
vm_namestringName of that VM. Omitted when detached or when the VM cannot be found.
device_namestringBlock device inside the VM, as reported by the guest agent. Omitted until reported.
mount_pathstringWhere the volume is mounted inside the VM, under /mnt/rumpty/, as reported by the guest agent. Omitted until reported.
usageobjectFilesystem usage reported by the VM's guest agent. Omitted until the agent has reported a sample for the mounted volume. The last sample is kept after the volume is detached.
Show attributesHide attributes
total_bytesintegerRequiredFilesystem size in bytes.
used_bytesintegerRequiredBytes in use.
available_bytesintegerRequiredBytes still available.
used_percentnumberRequiredPercentage of the filesystem in use.
sampled_atstring (date-time)RequiredWhen the sample was taken.
stalebooleanRequiredtrue when the sample is older than the agent's normal reporting interval.
created_atstring (date-time)RequiredWhen the volume was created (RFC 3339).
attached_atstring (date-time)When the volume was last attached. Omitted if it has never been attached. Kept after the volume is detached.
detached_atstring (date-time)When the volume was last detached. Omitted if it has never been detached or was attached again since.
last_failurestringReason for the last failed operation on the volume. Omitted when there is none.
statusstringRequiredStatus of the operation. queued for a new request. On a replay, the original operation's current status.
One ofqueuedrunningsucceededfailed
events_urlstringRequiredPath of the server-sent events stream with the operation's progress.
is_replaybooleanRequiredtrue when an existing operation was returned for a reused X-Idempotency key.
is_completedbooleanPresent and true on a replay whose original operation has already finished.
Errors
| Status | Meaning |
|---|---|
400 | The request is invalid or the volume or VM is in the wrong state. Possible messages: invalid request (malformed JSON or missing vm_uid), vm_uid is required, volume is already attached; detach it first, volume is not available for attachment, vm must be running to attach a volume, or volume and vm must be in the same zone. |
401 | The API key is missing, invalid, expired or revoked. |
403 | You cannot access the workspace, your role does not allow this action, or the account is suspended. |
404 | The volume or the VM does not exist in this workspace. |
409 | An attach is already in progress for this volume, or the X-Idempotency key was used for a different operation (action: idempotency_key_reused). |
Errors use the standard error format.