-
Notifications
You must be signed in to change notification settings - Fork 159
Validate that existing mount point is compatible with volume and capabilities when it already exists for Stage and Publish #479
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
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: davidz627 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 |
49d5ced
to
6aecabb
Compare
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.
Is this unit testable?
pkg/gce-pd-csi-driver/node.go
Outdated
return nil, status.Error(codes.Internal, fmt.Sprintf("Error when getting device path: %v", err)) | ||
} | ||
|
||
if err := ns.volumeCompatible(stagingTargetPath, devicePath, volumeCapability); err != nil { |
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.
This assumes that targetPath
is bind mounted correctly to devicePath
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.
what do you mean by this? We are checking whether it is bind mounted correctly. If it is not it will throw an AlreadyExists error which is the expected behavior
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 mean that it is checking that devicePath
(/dev/blah) is mounted to stagingTargetPath
(NodeStage path), but not necessarily that stagingTargetPath
is bind mounted to targetPath
(NodePublish path).
Regardless, this is still a good check to have, it's just not actually verifying the Publish path.
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 see, I think in NodePublish we check that /dev/sdx
is mounted to publishTargetPath
. But you're right in that we never explicitly check that stagingTargetPath
is bindmounted to publishTargetPath
.
Edit: I just noted we check stagingTargetPath
in NodePublish
as well, it should actually be targetPath
to make my above statement true.
} | ||
}() | ||
|
||
// Assert: Stage Disk B to Disk A position and fail even both as 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.
Can we run each scenario as a separate test 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.
There's a lot of boilerplate setup for "later assertions" as asserting things for publish depends on doing a attach and stage. I actually think this is a lot cleaner especially since i've documented it quite thoroughly. In the passing case we're happy, in the failing case I'm not really concerned about "knock on errors" since a failure is a failure and you can debug based on the first error seen.
6aecabb
to
8ff3e9d
Compare
@msau42 resolved comments. This is going to be fairly difficult to unit test given its almost complete dependence on actual filesystem behavior. I will leave it as an exercise to the reader :) |
cd62ccd
to
e480300
Compare
…bilities when it already exists for Stage and Publish
e480300
to
eb512b7
Compare
// location of the mount we're looking for and printing out the backing | ||
// disk. the resulting output should be a path to a device such as | ||
// "/dev/sda" | ||
mountedPathDevBytes, err := ns.Mounter.Exec.Command("sh", "-c", fmt.Sprintf("df -P | awk '$6==\"%s\"{print $1}'", mountedPath)).CombinedOutput() |
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'm not sure if df works for bind mounts. Mounter I believe has GetMountRefs() which I think handles bind mounts
@davidz627: PR needs rebase. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/close |
@davidz627: Closed this PR. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/kind feature
/assign @msau42
Fixes #253