A volume can be associated to containers or storage pools.
* A container can have many volumes and containers are mapped to volumes the mount link on a container.
* A storage pool owns many volumes. The volume is only available to containers deployed on hosts that are part of the storage pool. When a volume is being created, you do not directly associate it to a storage pool. You will only need to specify a driver and during allocation, Rancher will resolve it to a storage pool.
Field | Type | Create | Update | Default | Notes |
---|---|---|---|---|---|
description | string | Optional | Yes | - | |
driver | string | Optional | - | - | |
driverOpts | map[string] | Optional | Yes | - | |
hostId | host | Optional | Yes | - | The unique identifier for the associated host |
name | string | Yes | - | - | |
sizeMb | int | Optional | - | - | |
stackId | stack | Optional | - | - | |
storageDriverId | storageDriver | Optional | - | - | |
volumeTemplateId | volumeTemplate | Optional | - | - |
Field | Type | Notes |
---|---|---|
accessMode | string | |
data | map[json] | |
externalId | string | |
id | int | The unique identifier for the volume |
imageId | image | |
instanceId | instance | The unique identifier for the associated instance |
isHostPath | boolean | |
mounts | array[mountEntry] | |
uri | string |
Please read more about the common resource fields. These fields are read only and applicable to almost every resource. We have segregated them from the list above.
/v2-beta/projects/${PROJECT_ID}/volumes/${ID}?action=restorefrombackup
curl -u "${RANCHER_ACCESS_KEY}:${RANCHER_SECRET_KEY}" \
-X POST \
-H 'Content-Type: application/json' \
-d '{
"backupId": "reference[backup]"
}' 'http://${RANCHER_URL}:8080/v2-beta/projects/${PROJECT_ID}/volumes/${ID}?action=restorefrombackup'
/v2-beta/projects/${PROJECT_ID}/volumes/${ID}?action=reverttosnapshot
curl -u "${RANCHER_ACCESS_KEY}:${RANCHER_SECRET_KEY}" \
-X POST \
-H 'Content-Type: application/json' \
-d '{
"snapshotId": "reference[snapshot]"
}' 'http://${RANCHER_URL}:8080/v2-beta/projects/${PROJECT_ID}/volumes/${ID}?action=reverttosnapshot'
/v2-beta/projects/${PROJECT_ID}/volumes/${ID}?action=snapshot
curl -u "${RANCHER_ACCESS_KEY}:${RANCHER_SECRET_KEY}" \
-X POST \
-H 'Content-Type: application/json' \
-d '{
"name": "string"
}' 'http://${RANCHER_URL}:8080/v2-beta/projects/${PROJECT_ID}/volumes/${ID}?action=snapshot'