Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Mount flow should fail to mount if the mountpoint is already in-use. #212

Merged
merged 3 commits into from
May 28, 2018

Conversation

shay-berman
Copy link
Contributor

@shay-berman shay-berman commented May 27, 2018

This PR is for fixing a bug that @danare found in PR #196 (internal issue UB-1230).

Flex mount CLI must prevent mounting a device if the mountpoint is already in used by other device, in order to prevent double mounting on the same directory.

So this PR fix it and check during the mount flow if the given mountpoint is already in-used (already mounted by other device). If its already mounted to a different device, then error will be raised
"[%s] directory is already a mountpoint but to unexpected devices=%#v (expected mountpoint only on device=[%s])"

How to test:

  1. Create 2 PVCs (PVC1 & PVC2) and check what is the PV1 WWN (will be used in step 3)
  2. Manually create and map PV2 on node1.
  3. Manually discover the PV2 the device on the node1 and mkfs and mount it to a directory /ubiquity/ (create the directory in advance)
  4. Create Pod on node1 that uses PVC1, the creation of the pod should fail(Container creating) due to the error mentioned above.
  5. Now manually unmount PVC2 from node1, unmap and clean its device from node1. Then after after few minutes (k8s flex scheduling) should start the POD successfully.

This change is Reviewable

@shay-berman shay-berman self-assigned this May 27, 2018
@coveralls
Copy link

coveralls commented May 27, 2018

Coverage Status

Coverage increased (+0.6%) to 53.818% when pulling 170380d on fix/UB_1230_prevent_doublemounting into e742deb on dev.

@shay-berman shay-berman changed the title Mount flow should prevent mounting device if the mountpoint is already in-use. Mount flow should fail to mount if the mountpoint is already in-use. May 27, 2018
@olgashtivelman
Copy link
Collaborator

:lgtm:


Review status: 0 of 7 files reviewed at latest revision, all discussions resolved.


Comments from Reviewable

@olgashtivelman
Copy link
Collaborator

Review status: all files reviewed at latest revision, all discussions resolved.


Comments from Reviewable

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
idempotency Improve Flex API idempotency aspects
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants