Skip to main content

volumes

Creates, updates, deletes, gets or lists a volumes resource.

Overview​

Namevolumes
TypeResource
Idovh.cloud_storage.volumes

Fields​

The following fields are returned by SELECT queries:

successful operation

NameDatatypeDescription
idstringVolume id
namestringVolume name
attached_toarrayVolume attached to instances id (wire: attachedTo)
availability_zonestringAvailability zone of the volume (wire: availabilityZone)
bootablebooleanVolume bootable
creation_datestring (date-time)Volume creation date (wire: creationDate)
descriptionstringVolume description
plan_codestringOrder plan code (wire: planCode)
regionstringVolume region
sizeintegerVolume size (in GB)
statusstringVolume status (attaching, available, awaiting-transfer, backing-up, creating, deleted, deleting, detaching, downloading, error, error_backing-up, error_deleting, error_extending, error_restoring, extending, in-use, maintenance, reserved, restoring-backup, retyping, snapshotting, uploading)
typestringVolume type (classic, classic-luks, classic-multiattach, high-speed, high-speed-gen2, high-speed-gen2-luks, high-speed-luks)

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectvolume_id, service_nameGet volume details
listselectservice_nameregionGet volumes
createinsertservice_name, region, size, typeCreate a volume
updateupdatevolume_id, service_nameUpdate a volume
deletedeletevolume_id, service_nameDelete a volume
attachexecvolumeId, service_name, instanceIdAttach a volume on an instance
detachexecvolumeId, service_name, instanceIdDetach a volume from an instance
snapshotexecvolumeId, service_nameSnapshot a volume
upsizeexecvolumeId, service_name, sizeExtend a volume

Parameters​

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
api_hoststringThe OVHcloud API host. Selected by OVH_ENDPOINT (ovh-eu, ovh-ca or ovh-us; default ovh-eu). (default: api.eu.ovhcloud.com, x-stackQL-envVarSelector: {"envVar":"OVH_ENDPOINT","default":"ovh-eu","values":{"ovh-eu":"api.eu.ovhcloud.com","ovh-ca":"api.ca.ovhcloud.com","ovh-us":"api.us.ovhcloud.com"}})
service_namestringThe Public Cloud project ID. Resolved from OVH_CLOUD_PROJECT_SERVICE when set.
volumeIdstringVolume ID
volume_idstringVolume ID (wire: volumeId)
regionstringVolume region

SELECT examples​

Get volume details

SELECT
id,
name,
attached_to,
availability_zone,
bootable,
creation_date,
description,
plan_code,
region,
size,
status,
type
FROM ovh.cloud_storage.volumes
WHERE volume_id = '{{ volume_id }}' -- required
AND service_name = '{{ service_name }}' -- required unless OVH_CLOUD_PROJECT_SERVICE is set
;

INSERT examples​

Create a volume

INSERT INTO ovh.cloud_storage.volumes (
availability_zone,
description,
image_id,
name,
region,
size,
snapshot_id,
type,
service_name
)
SELECT
'{{ availability_zone }}',
'{{ description }}',
'{{ image_id }}',
'{{ name }}',
'{{ region }}' /* required */,
{{ size }} /* required */,
'{{ snapshot_id }}',
'{{ type }}' /* required */,
'{{ service_name }}'
RETURNING
id,
name,
attached_to,
availability_zone,
bootable,
creation_date,
description,
plan_code,
region,
size,
status,
type
;

UPDATE examples​

Update a volume

UPDATE ovh.cloud_storage.volumes
SET
description = '{{ description }}',
name = '{{ name }}'
WHERE
volume_id = '{{ volume_id }}' --required
AND service_name = '{{ service_name }}' --required unless OVH_CLOUD_PROJECT_SERVICE is set
RETURNING
id,
name,
attached_to,
availability_zone,
bootable,
creation_date,
description,
plan_code,
region,
size,
status,
type;

DELETE examples​

Delete a volume

DELETE FROM ovh.cloud_storage.volumes
WHERE volume_id = '{{ volume_id }}' --required
AND service_name = '{{ service_name }}' --required unless OVH_CLOUD_PROJECT_SERVICE is set
;

Lifecycle Methods​

EXEC variables use wire (API) names.

Attach a volume on an instance

EXEC ovh.cloud_storage.volumes.attach
@volumeId='{{ volumeId }}' --required,
@service_name='{{ service_name }}' --required unless OVH_CLOUD_PROJECT_SERVICE is set
@@json=
'{
"instanceId": "{{ instanceId }}"
}'
;