|
| 1 | +# Provisioning and mounting CephFS snapshot-backed volumes |
| 2 | + |
| 3 | +Snapshot-backed volumes allow CephFS subvolume snapshots to be exposed as |
| 4 | +regular read-only PVCs. No data cloning is performed and provisioning such |
| 5 | +volumes is done in constant time. |
| 6 | + |
| 7 | +For more details please refer to [Snapshots as shallow read-only volumes](./design/proposals/cephfs-snapshot-shallow-ro-vol.md) |
| 8 | +design document. |
| 9 | + |
| 10 | +## Prerequisites |
| 11 | + |
| 12 | +Prerequisites for this feature are the same as for creating PVCs with snapshot |
| 13 | +volume source. See [Create snapshot and Clone Volume](./snap-clone.md) for more |
| 14 | +information. |
| 15 | + |
| 16 | +## Usage |
| 17 | + |
| 18 | +### Provisioning a snapshot-backed volume from a volume snapshot |
| 19 | + |
| 20 | +For provisioning new snapshot-backed volumes, following configuration must be |
| 21 | +set for storage class(es) and their PVCs respectively: |
| 22 | + |
| 23 | +* StorageClass: |
| 24 | + * Specify `backingSnapshot: "true"` parameter. |
| 25 | +* PersistentVolumeClaim: |
| 26 | + * Set `storageClassName` to point to your storage class with backing |
| 27 | + snapshots enabled. |
| 28 | + * Define `spec.dataSource` for your desired source volume snapshot. |
| 29 | + * Set `spec.accessModes` to `ReadOnlyMany`. This is the only access mode that |
| 30 | + is supported by this feature. |
| 31 | + |
| 32 | +### Mounting snapshots from pre-provisioned volumes |
| 33 | + |
| 34 | +Steps for defining a PersistentVolume and PersistentVolumeClaim for |
| 35 | +pre-provisioned CephFS subvolumes are identical to those described in |
| 36 | +[Static PVC with ceph-csi](./static-pvc.md), except one additional parameter |
| 37 | +must be specified: `backingSnapshotID`. CephFS-CSI driver will retrieve the |
| 38 | +snapshot identified by the given ID from within the specified subvolume, and |
| 39 | +expose it to workloads in read-only mode. Volume access mode must be set to |
| 40 | +`ReadOnlyMany`. |
| 41 | + |
| 42 | +Note that the snapshot retrieval is done by traversing `<rootPath>/.snap` and |
| 43 | +searching for a directory that contains `backingSnapshotID` value in its name. |
| 44 | +The specified snapshot ID does not necessarily need to be the complete directory |
| 45 | +name inside `<rootPath>/.snap`, however it must be complete enough to uniquely |
| 46 | +identify that directory. |
| 47 | + |
| 48 | +Example: |
| 49 | + |
| 50 | +``` |
| 51 | +$ ls .snap |
| 52 | +_f279df14-6729-4342-b82f-166f45204233_1099511628283 |
| 53 | +_a364870e-6729-4342-b82f-166f45204233_1099635085072 |
| 54 | +``` |
| 55 | + |
| 56 | +`f279df14-6729-4342-b82f-166f45204233` would be considered a valid value for |
| 57 | +`backingSnapshotID` volume parameter, whereas `6729-4342-b82f-166f45204233` |
| 58 | +would not, as it would be ambiguous. |
| 59 | + |
| 60 | +If the given snapshot ID is ambiguous, or no such snapshot is found, mounting |
| 61 | +the PVC will fail with INVALID_ARGUMENT error code. |
0 commit comments