-
Notifications
You must be signed in to change notification settings - Fork 206
Validate the existence of filesystem before attempting to mount it (linux) #127
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
Conversation
Welcome @mvisonneau! |
/assign @jingxu97 |
a202493
to
b35269c
Compare
b35269c
to
e5e553c
Compare
I added a couple of tests and fixed some others 👌 |
/assign @jingxu97 |
/assign @jsafrane |
e5e553c
to
bc8b054
Compare
46d2a00
to
2bf726f
Compare
2bf726f
to
845310a
Compare
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: jsafrane, mvisonneau The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
klog.Infof("Disk successfully formatted (mkfs): %s - %s %s", fstype, source, target) | ||
} else if fstype != existingFormat { | ||
// Verify that the disk is formatted with filesystem type we are expecting | ||
klog.Warningf("Configured to mount disk %s as %s but current format is %s, things might break", source, existingFormat, fstype) |
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.
sorry to comment late. here if the required file system does not match the existing one, why not return error since the following mount should fail in this case?
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.
I think the first comment of @jsafrane explained the reason:
Previously, it was possible to mount ext3 volume even if its fsType was ext4. IMO it's a valid use case and we should not break it. Just try to mount it and throw stdout / stderr at the user, similarly to the previous code.
|
||
// Use 'ext4' as the default | ||
if len(fstype) == 0 { | ||
fstype = "ext4" |
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.
here we are saying if user does not specify a fstype, by default we set it "ext4". But why not we can set it as the current existing file system?
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.
fstype is the default value for all. means that if existing format is ext3, and fstype is empty, the device will be mounted as ext4, not ext3.
This is a reopen of kubernetes/kubernetes#77982, necessary for #126
What this PR does / why we need it:
The current workflow of the mount on linux tries to mount the disk before assessing if a FS actually
exists onto it. This commit review this implementation. Here is what would happen now:
This also ensures that the disk FS type is the one we are expecting before attempting to mount it.What would be nice is to also add some tests for the format and mount functions.
What type of PR is this?
/kind bug
Does this PR introduce a user-facing change?: