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

disk: use xattr to check if the disk is managed by us #1028

Merged
merged 3 commits into from
Jul 17, 2024

Conversation

huww98
Copy link
Contributor

@huww98 huww98 commented Apr 19, 2024

What type of PR is this?

/kind bug

What this PR does / why we need it:

to fix the issue that when DISK_AD_CONTROLLER is enabled and disk is detaching, MaxVolumesPerNode may be smaller than expected

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?

fixed that when DISK_AD_CONTROLLER is enabled and disk is detaching, MaxVolumesPerNode may be smaller than expected

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:


@k8s-ci-robot k8s-ci-robot added kind/bug Categorizes issue or PR as related to a bug. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Apr 19, 2024
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 9, 2024
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels May 28, 2024
@huww98
Copy link
Contributor Author

huww98 commented May 28, 2024

/auto-cc

@huww98
Copy link
Contributor Author

huww98 commented May 29, 2024

torvalds/linux@b09e0fa

This tmpfs xattr support is added in Linux Kernel 3.0

@huww98 huww98 force-pushed the disk-xattr branch 2 times, most recently from 772829a to 4a896a4 Compare May 31, 2024 09:01
@huww98
Copy link
Contributor Author

huww98 commented May 31, 2024

I've made some changes to the design:

  • The xattr is now added at NodeUnstageVolume, because:
    • this also works for volumes attached before CSI upgraded
    • we may switch drivers for the disk for some use-case, and the xattr may be lost.
  • I now iterate all the /dev to find xattr, because some disk may lack of serial number, and cannot be found by link.
  • Detaching disks are now excluded from attachedDisks, because we can't know whether it's device in /dev is present. Even if it is really an unmanaged disk, it is going to be detached, so it does not matter.
  • To avoid race condition, the informations are now retrieved in the order of: xattr -> OpenAPI -> Node status. This is the only valid order from my analyses.

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 14, 2024
Make sure we don't ignore any unknown errors.  And make error injection in
unit-tests easier. If something went wrong, errors.Is(err, os.ErrNotExists)
should not be true. We may use this to determine if a device exists.
to fix the issue that when DISK_AD_CONTROLLER is enabled and disk is detaching,
MaxVolumesPerNode may be smaller than expected.

Xattr is added to device node in /dev when NodeUnstageVolume, this should also
work for volumes attached before upgrading CSI.
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 14, 2024
@mowangdk
Copy link
Contributor

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 17, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: huww98, mowangdk

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 17, 2024
@k8s-ci-robot k8s-ci-robot merged commit e2e2a3e into kubernetes-sigs:master Jul 17, 2024
7 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants