-
Notifications
You must be signed in to change notification settings - Fork 148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Introduce minimum PVC allocation sizing by creating minimum allocation settings #851
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, I am probably just misunderstanding things, and a small naming suggestion
b772f96
to
c37d331
Compare
IMO, this kind of problem should be handled in the filesystem layer. Since this problem seems not to happen in the latest mkfs.xfs, I'd like to keep the current code as simple as possibile than applying this PR. @llamerada-jp How do you think? |
Just to make clear that this will happen in the latest versions of mkfs with 300 MiB. Before it would happen with 16 MiB and the Filesystem would be almost unusable. I can also introduce an E2E case to confirm this |
Also could you kindly tell what you mean with the "filesystem layer"? AFAIK the only alternative to the rounding would be to resize the volume during the mount procedure. A Pod using a PVC with the StorageClass is completely unaware of this limitation. |
Originally, the minimum allocation size was 1 GiB. Therefore, I do not object to setting a new minimum allocation. However, we may avoid hard-coding these numbers. Some sites may not like to be allocated without their permission, and other file systems may have similar limitations. I do not want to make similar changes every time that happens. Therefore, how about specifying this number in the argument of the program or storage class? Is this an excessive function? |
@llamerada-jp I am not opposed to that idea, I think this is a good point. My only question would be is how we should set this up. From what I understand the only way to give dynamic sizing configuration would be either through a new set of flags/env variables, or through a new custom configuration in lvmd (in which case however we wouldn't work through the CSI spec). We are currently missing detailed ways to configure sizing limitations in the gRPC controller logic. I am open to ideas here. I would like to keep the configuration ability to configure not only flat limits, but also per VolumeMode/Type for specific Filesystems. I am also open to discuss a Design Doc and am willing to take the implementation, just need to know what preferences we have here. EDIT: We could start introducing a set of fields here: with a pattern like we could set
|
It seems to be better to set it to storage class. Since fstype has already been set in the storage class, I think it is enough to add the storage class parameter as follows.
|
Good point. Let me accomodate this change so that we can use it dynamically. |
I found a little problem when using the StorageClass to set new configurations: we cannot edit the existing SC. we have to recreate the SC with the same name for adding the configuration. I believe it is only a small limitation since we can continuously use existing PV/PVC. |
I think this tradeoff needs to be made clear in the docs for downstreams like OpenShift, but for TopoLVM simply documenting this should be fine. |
I have a patch incoming for this PR but I don't have the E2E test yet, will take a bit more time |
Oops, sorry. I meant filesystem "tool" layer, in this case, I agree with adding a new parameter to SC as Yuji said.
I'll review the updated version, thanks. |
b02cb17
to
bb6bf8c
Compare
topolvm.io/minimum-allocated-size
StorageClass parameter
Note to reviewers: Added the limitation generically since users might also want minimum sizes for block volumes |
bb6bf8c
to
4337e0a
Compare
4337e0a
to
0b6fbfa
Compare
topolvm.io/minimum-allocated-size
StorageClass parametertopolvm.io/minimum-allocated-size
StorageClass parameter
@llamerada-jp @satoru-takeuchi I have switched to using |
9ef2e07
to
d5540b2
Compare
I think you are referring to the fact that xfs configuration would be global. And that is true for one node. However if we have 2 deviceClasses for 2 different nodes or nodeSets, then this changes. If Node A has a different fs default than node B then I would have to use 2 different controller configurations. However I did notice that I did not consider that most users who want custom formatting could just use block devices and format the devices themselves. A common way to optimize formatting of ext4 for example is through disabling certain options that are not necessary on multi-gig devices:
Yes that is correct. But since TopoLVM cannot do this right now the workaround for users is to create block devices and do fs mount/unmount themselves
The ConfigMap (at least in my opinion) is a much better way to configure an application than using CLI flags for everything. This is why almost every major solution at some point starts offering filebased configuration instead of args, because args are hard to document and control/audit. But I see that we have trouble arguing for the value add here as well so let me push that to a separate PR so as not to block this effort here further. With the above said:
|
024159c
to
0dd1cf2
Compare
I was focusing on only avoiding errors in mkfs by adding a minimum allocation size on this PR. Therefore, I did not consider extensions about other options for mkfs. There may have been a misunderstanding there.
I agree with this suggestion. Since the design of mkfs options other than minimum allocation size will be complicated by referring to your examples, it would be better to make a proposal in a separate PR and discuss it once. I believe that the default values we are adding in this PR and the new options we are going to consider in the proposal are not in conflict. @satoru-takeuchi How do you think? |
Sorry for the late reply. I was on paid leave yesterday and the day before yesterday. @llamerada-jp I agree with you. @jakobmoellerdev Please update this PR in accordance with the following description.
FYI, in general, I agree with the following your opinion.
We afraid to introduce ConfigMap just for edge cases. I'm glad if the design proposal of "ConfigMap-based custom fs options+minimum sizes" is also beneficial for non-edge users. |
adfea09
to
f513745
Compare
Adjusted as discussed, PTAL again before I squash the commits. Thanks for the feedback! |
I'll finish reviewing this PR tomorro or the next to tomorror. |
@jakobmoellerdev @satoru-takeuchi
man vgcreate
/etc/lvm/lvm.conf (ubuntu 22.04)
|
@llamerada-jp IMO, 4MiB is enough. |
I believe we are not taking into consideration the usual default value of pv_min_size:
This would lead to a minimum of at least 512KiB, but effectively 2MiB for most environments. Also together with what @llamerada-jp said, we need at least a full extent size of 4MiB to cover most default lvm installations. Additionally when trying with a device of exactly 4MiBs we will receive
Even if we increase it, ext4 will use up quite a bit of space for metadata:
As you can see, for a 8MiB lv formatted on ext4 with default settings on Fedora 39, we only have a size of 2.9M with a usable size of 2.6M (due to FS metadata). Thus I recommend at least a minimum of 16-32MiB to have actually the amount available for use that was requested. Going any lower than that will not expose the requested size as available storage, but a smaller percentage. |
@jakobmoellerdev Thank you for your detailed explanation.
OK. Then let's make it 32 MiB for now. |
62d2b84
to
f406903
Compare
@llamerada-jp @satoru-takeuchi Have now the following limits:
|
@jakobmoellerdev It's reasonable. I'll finish to review soon. |
@jakobmoellerdev Please update PR title to reflect the latest changes. It no longer uses ConfigMap. |
Signed-off-by: Jakob Möller <jmoller@redhat.com>
d856bf9
to
a967c95
Compare
This PR introduces a minimum size allocation for any PVCs that are requested. It also refactors the test cases to be table driven so that its easier to modify and see whats wrong.
The limits introduced are the following:
Why?
Since we removed the 1Gi Allocation we should set sensible defaults that allow users to still make use of our rounding but that do not go so low as to break the Mounting procedure.
What was changed?
The following new controller flags were introduced with the above defaults:
minimum-allocation-block
minimum-allocation-xfs
minimum-allocation-ext4
If not set, they use the defaults so the HELM chart does not need adjusting.
Note that setting 0 or negative values in these configurations disables the allocation sizing for that configuration.
How to reproduce?
Create a PVC with something like
One will notice the following error during mounting
Additionally if one then increases that block amount to lets say 16 MiB one will eventually face (with a recent enough version of mkfs):
due to the change here: https://www.spinics.net/lists/linux-xfs/msg63099.html & https://www.spinics.net/lists/linux-xfs/msg63831.html