Skip to content
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

fix(provisioning): make volumes with fsType=zfs datasets of type filesystem #144

Merged

Conversation

cruwe
Copy link
Contributor

@cruwe cruwe commented Jun 1, 2020

Why is this PR required? What issue does it fix?:

fixes #143 -> inconsistent naming of fsType with fallback to ext4 and all datasets created as volumes

What this PR does?:
Reformulating the getter allows volumes to be created with zfs-type, which will result in a "filesystem" dataset.

Does this PR require any upgrade changes?:

I do not think so.

If the changes in this PR are manually verified, list down the scenarios covered::

Without this fix, a dataset as described in #143 is created as a volume. With the fix, it is created as a dataset of type filesystem. Conersly, with type xfs, it is still created as a dataset of type volume. I imagine my testing could have been more thorough, this is what I managed to do to with the time at hand.

Checklist:

@cruwe cruwe force-pushed the cjr/#143/fix-inconsistency-with-fsType branch from 83df860 to 8279592 Compare June 1, 2020 12:35
@pawanpraka1
Copy link
Contributor

pawanpraka1 commented Jun 1, 2020

@cruwe thanks for this PR, but this is a breaking change and if customers are already using fstype in the storageclass. After this change, that will stop working and it will create ZVOL instead of dataset.

The right way to handle this is make fstype case insensitive. The way kubernetes does this.

@cruwe
Copy link
Contributor Author

cruwe commented Jun 1, 2020

Ok, I understand. So that I read correctly, you propose to make the controller accept both, fstype and fsType?

The change will, I fear, still be breaking, because customers who thought they'd get a filesystem-type dataset actually got a zvol with ext4, I believe. I only noticed because zfs share told me that it is not possible to share a zvol via NFS. I'd imagine the breakage to be smaller, but it is a change of behaviour. How would you deal witht that situation?

In any case, thank you very much for your input, I'll mark that WIP for the time being.

@cruwe cruwe changed the title fix(provisioning): make volumes with fsType=zfs datasets of type filesystem [WIP] fix(provisioning): make volumes with fsType=zfs datasets of type filesystem Jun 1, 2020
@cruwe cruwe marked this pull request as draft June 1, 2020 14:52
@pawanpraka1
Copy link
Contributor

pawanpraka1 commented Jun 1, 2020

Ok, I understand. So that I read correctly, you propose to make the controller accept both, fstype and fsType?

The change will, I fear, still be breaking, because customers who thought they'd get a filesystem-type dataset actually got a zvol with ext4, I believe.

I am suggesting something like this : fetch the fstype from req.GetParameters()["fstype"] if not available then from req.GetParameters()["fsType"] or req.GetParameters()["FStype"] or req.GetParameters()["FSTYPE"]. So it will not break as old storageclass will have fstype. The intention is to make it case insensitive and user can use anything.

But I would not worry about making this in-sync with ZFSVolume CRD as it is there just for the display purpose. It serves no purpose other than that.

I would want the controller to understand all possible fstype string. But this is fine since as of now it only supports fstype string.

@cruwe
Copy link
Contributor Author

cruwe commented Jun 2, 2020

I implemented looking up what is meant to be the fstype parameter (semantically) based on your suggestion of precedence.

I have an idea on how to solve GetInsensitiveToCase (should I rename it yo GetInsensitivelyToCase?), I do not know, however, how to deal with UTF-8 when the keys are not in the ASCII-equivalent subset. I'd rather leave that part out. How do you feel about that?

@codecov-commenter
Copy link

codecov-commenter commented Jun 2, 2020

Codecov Report

Merging #144 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #144   +/-   ##
=======================================
  Coverage   22.90%   22.90%           
=======================================
  Files          14       14           
  Lines         489      489           
=======================================
  Hits          112      112           
  Misses        376      376           
  Partials        1        1           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3078612...b4f4b99. Read the comment docs.

@pawanpraka1
Copy link
Contributor

pawanpraka1 commented Jun 2, 2020

Nice!! I like the idea of GetInsensitiveToCase. Can we rename it to GetInsensitiveParameters. Let us use this to convert all the parameters into a map of lower case keys and then use lower case keys for the lookup?

@cruwe cruwe force-pushed the cjr/#143/fix-inconsistency-with-fsType branch 2 times, most recently from 3e6368a to 0e5e610 Compare June 3, 2020 09:23
@cruwe
Copy link
Contributor Author

cruwe commented Jun 3, 2020

Sure, changed the name. You're right, it increases readability. At worst, it might bring a smile to the inner child of some telenovela watcher, who might imagine a passionate argument btw someone and a parameter who is "just sooo insensitive". As long as we do not have a func GetInsensitiveCharacter(). As we see again, there are only two hard things in computer science: Naming and cache invalidation.

Ok, joking aside, when we want do be insensitive (no pun intended, seriously!) with all parameters, I'd suggest to create a map with case-insensitive keys and do lookups on this map to avoid getting & copying the original map the umpteenth time. I have not yet tried that out and I still need to look at the tests to see if is necessary to adapt some code there.

@pawanpraka1
Copy link
Contributor

@cruwe sounds good.

@cruwe
Copy link
Contributor Author

cruwe commented Jun 3, 2020

In this case, I will run a set of superficial tests this evening and upon successful completion, remove draft status and WIP.

@cruwe cruwe force-pushed the cjr/#143/fix-inconsistency-with-fsType branch from 0e5e610 to 6a26dab Compare June 3, 2020 16:11
@cruwe
Copy link
Contributor Author

cruwe commented Jun 3, 2020

Hi, I've tested with some common and some perhaps not so common spelling variations, for instance, 'comPREssion', 'Dedup', 'POOLNAME' or even 'fStYpE'.

PVCs derived from this storageclass are created correctly. It is not possible to rectify this sort of creative spelling afterwards due to the storageclass parameters being immutable. That cannot be helped, I fear.

I added some additional comments to explain the reasoning to the casual reader and then squash-rebased to reduce history clutter.

Thank you very much your comments and generally, helping with developing the code. I'll now remove the WIP and draft status. Looking forward to hearing from you with the sharenfs part. Cheers!

@cruwe cruwe marked this pull request as ready for review June 3, 2020 16:26
@cruwe cruwe changed the title [WIP] fix(provisioning): make volumes with fsType=zfs datasets of type filesystem fix(provisioning): make volumes with fsType=zfs datasets of type filesystem Jun 3, 2020
pkg/common/helpers/helpers.go Outdated Show resolved Hide resolved
@cruwe cruwe force-pushed the cjr/#143/fix-inconsistency-with-fsType branch from 6a26dab to c704b4a Compare June 4, 2020 07:52
@cruwe
Copy link
Contributor Author

cruwe commented Jun 4, 2020

@kmova: Done. Thanks for spotting that.
@pawanpraka1: Done. Thanks for pointing out how to do it.

…nebs#143

More specifically,
- introduce helper function to get maps with all keys set to lowercase,
- introduce lookup helper based on such maps and
- change lookups for CreateVolumeRequest()s and CreateVolume()s so that
  parameter keys are processed as lowercase irrespective of actual
  spelling.

Signed-off-by: Christopher J. Ruwe <cjr@cruwe.de>
@cruwe cruwe force-pushed the cjr/#143/fix-inconsistency-with-fsType branch from c704b4a to b4f4b99 Compare June 4, 2020 12:12
Copy link
Contributor

@pawanpraka1 pawanpraka1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good.

@pawanpraka1 pawanpraka1 merged commit 377b881 into openebs:master Jun 4, 2020
@pawanpraka1 pawanpraka1 added the Need community involvement Needs community involvement on some action item. label Jun 4, 2020
@pawanpraka1 pawanpraka1 added the enhancement Add new functionality to existing feature label Jun 4, 2020
@pawanpraka1 pawanpraka1 added this to the v0.8.0 milestone Jun 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Add new functionality to existing feature Need community involvement Needs community involvement on some action item.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CreateZFSVolume does not respect fsType=zfs -> dataset
4 participants