rbd: add maxsnapshotsonimage flag

Added maxsnapshotsonimage flag to flatten
the older rbd images on the chain to avoid
issue in krbd.The limit is in krbd since it
only allocate 1 4KiB page to handle all the
snapshot ids for an image.

The max limit is 510 as per
https://github.com/torvalds/linux/blob/
aaa2faab4ed8e5fe0111e04d6e168c028fe2987f/drivers/block/rbd.c#L98
in cephcsi we arekeeping the default to 450 to reserve 10%
to avoid issues.
Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
Madhu Rajanna
2020-07-01 10:57:11 +05:30
committed by mergify[bot]
parent c04b903eca
commit 8ef7143e6c
6 changed files with 24 additions and 3 deletions

View File

@ -58,8 +58,8 @@ var (
// rbdSoftMaxCloneDepth is the soft limit for maximum number of nested volume clones that are taken before a flatten occurs
rbdSoftMaxCloneDepth uint
skipForceFlatten bool
maxSnapshotsOnImage uint
skipForceFlatten bool
)
// NewDriver returns new rbd driver
@ -114,6 +114,7 @@ func (r *Driver) Run(conf *util.Config, cachePersister util.CachePersister) {
rbdHardMaxCloneDepth = conf.RbdHardMaxCloneDepth
rbdSoftMaxCloneDepth = conf.RbdSoftMaxCloneDepth
skipForceFlatten = conf.SkipForceFlatten
maxSnapshotsOnImage = conf.MaxSnapshotsOnImage
// Create instances of the volume and snapshot journal
volJournal = journal.NewCSIVolumeJournal(CSIInstanceID)
snapJournal = journal.NewCSISnapshotJournal(CSIInstanceID)

View File

@ -108,6 +108,11 @@ type Config struct {
// RbdSoftMaxCloneDepth is the soft limit for maximum number of nested volume clones that are taken before a flatten occurs
RbdSoftMaxCloneDepth uint
// MaxSnapshotsOnImage represents the maximum number of snapshots allowed
// on rbd image without flattening, once the limit is reached cephcsi will
// start flattening the older rbd images to allow more snapshots
MaxSnapshotsOnImage uint
}
// CreatePersistanceStorage creates storage path and initializes new cache