cephfs: efficient read-only snapshots as volumes #2142
Description
Describe the feature you'd like to have
CephFS exposes snapshots as special, read-only directories of a subvolume. cephfs-csi can already provision writable volumes with snapshots as their data source, where snapshot contents are cloned to the newly created volume. Cloning to snapshot to volume is very expensive in CephFS, as the data needs to be fully copied.
I propose creating read-only (shallow) volumes from snapshots is added to cephfs-csi, where the driver would take advantage of the fact that snapshot's data is already available in a directory, and that directory would be exposed to workloads as a volume. This would make it possible to avoid the expensive cloning process.
What is the value to the end user? (why is it a priority?)
What's the point of such read-only volumes?
-
Restore snapshots selectively: users may want to traverse snapshots, restoring data to a writable volume more selectively instead of restoring the whole snapshot.
-
Volume backup: users can't backup a live volume, they first need to snapshot it. Once a snapshot is take, it still can't be backed-up, as backup tools usually work with volumes (that are exposed as file-systems) and not snapshots (which might have backend-specific format). What this means is that currently with cephfs-csi we'd have to clone snapshot data twice:
- first time, when restoring the snapshot into a volume,
- and second time, when transferring that volume into some backup/archive storage (e.g. object store).
The backed-up volume will most likely be thrown away after the backup is finished. That's a lot of wasted work for what we originally wanted to do! Having the ability to create volumes from snapshots cheaply would be a big improvement for this use case.
How will we know we have a good solution? (acceptance criteria)
Creating/deleting and mounting/unmounting such read-only volumes should be O(1) regardless of snapshot size.
Alternatives
- User's could simply go to
.snap/<snapshot name>
by themselves.
.snap
is CephFS-specific detail of how snapshots are exposed. Users / tools may not be aware of this special directory, or it doesn't fit the workflow. The idiomatic way of accessing snapshot contents is by creating a new volume and populating it with snapshot.
Additional context
If you agree with the proposed feature, I can add a PR for a docs/proposals
document where we can discuss this in more detail. After that I can work on its implementation.
Activity