stratis-storage / stratisd

Easy to use local storage management for Linux.
https://stratis-storage.github.io
Mozilla Public License 2.0
793 stars 56 forks source link

Support issuing an instruction for Stratis filesystem merge and storing the instruction in filesystem metadata #3621

Open mulkieran opened 3 months ago

mulkieran commented 3 months ago

Related https://github.com/stratis-storage/project/issues/597

We do not plan to do merges into anything other than a snapshot's origin. Given this the tasks are:

  1. Augment the filesystem metadata with a new field, merge, indicating that the filesystem is to be merged. The field makes no sense if there is no origin set.

    • So, we could make the field Option<bool>. If the filesystem has no origin, then the field is None. If the filesystem has an origin, the the field is Some(true) or Some(false). If the filesystem has the concept of origin, but no merge field then it might have a None value for merge anyway. Treat None as Some(false) in the case where the the origin field is present. Ensure that next time the field is written it is written as Some(false).

    • The alternative is to make it a non-optional field. But that will not work anyway until 4.0. We could leave a Note to make it non-optional. But otherwise, the first option will always be consistent.

  2. Augment the D-Bus API with a new command RequestMerge on a pool. It can take the pool object path and the UUID or name of the filesystem. Since it can not merge into anything but the origin, that is all the information it needs. It should error on (a) no origin for the filesystem for which the request is made, (b) other filesystem already scheduled to merge into same origin, (c) a difference between the designated filesystem's size limit and the origin size limit. Why? Why not make it an automatic adjustment when the merge occurs? We will have to work out a way to reconcile a number of the fields in the filesystem metadata. Assuming the request is acceptable, then the filesystem metadata must be updated with the merge field set to Some(true). NOTE: we have decided that different filesystem size limit is not a reason to reject the merge request. That value will be updated from the snapshot's value.

mulkieran commented 3 months ago

Note that we already report the origin of any snapshot on the D-Bus and we maintain this origin when filesystems are deleted, etc. If a merge is scheduled, the snapshot will maintain a to-be-merged status. This should be observable in the filesystem information via a D-Bus property.

mulkieran commented 4 weeks ago

We will first add a debug option to get filesystem metadata