Skip to content

Feature/extend lvset matcher - add filtering by serial to deviceInclusionSpec in LocalVolumeSet#638

Open
ssato wants to merge 2 commits into
openshift:mainfrom
ssato:feature/extend-lvset-matcher
Open

Feature/extend lvset matcher - add filtering by serial to deviceInclusionSpec in LocalVolumeSet#638
ssato wants to merge 2 commits into
openshift:mainfrom
ssato:feature/extend-lvset-matcher

Conversation

@ssato

@ssato ssato commented Jun 27, 2026

Copy link
Copy Markdown

Hello,

I couldn't find the specific guidelines for submitting feature extensions as a PR, so I'm not entirely sure if this meets your standards. Please let me know if there's anything missing or if any changes are needed.

Currently, it seems that deviceInclusionSpec in LocalVolumeSet doesn't allow selecting a specific disk when there are multiple disks with the same vendor, model, and capacity. This PR extends its capability to allow users to do so by specifying the serial number.

Summary by CodeRabbit

  • New Features
    • Added an optional serial-number filter for device inclusion, supporting multiple values with case-insensitive matching.
  • Bug Fixes
    • Enhanced device listing to capture and report disk serial details when available.
  • Tests
    • Added unit tests for serial-based device matching and updated fixtures to validate serial parsing from device listing output.

Signed-off-by: Satoru SATOH <satoru.satoh@gmail.com>
@coderabbitai

coderabbitai Bot commented Jun 27, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 0a80e250-d5a5-440d-a281-f7f06683b76f

📥 Commits

Reviewing files that changed from the base of the PR and between e574b46 and 0c6697d.

📒 Files selected for processing (3)
  • api/v1alpha1/localvolumeset_types.go
  • pkg/diskmaker/controllers/lvset/matcher.go
  • pkg/diskmaker/controllers/lvset/matcher_test.go
🚧 Files skipped from review as they are similar to previous changes (3)
  • pkg/diskmaker/controllers/lvset/matcher_test.go
  • pkg/diskmaker/controllers/lvset/matcher.go
  • api/v1alpha1/localvolumeset_types.go

Walkthrough

Adds a Serials filter to DeviceInclusionSpec, wires an inSerialList matcher against dev.Serial, and extends parsing and unit tests to cover serial extraction from lsblk output.

Changes

Serial filter support

Layer / File(s) Summary
Serial contract and matcher
api/v1alpha1/localvolumeset_types.go, pkg/diskmaker/controllers/lvset/matcher.go
DeviceInclusionSpec gains an optional Serials field, and inSerialList accepts nil or empty specs, trims blank entries, and matches device serials case-insensitively.
Serial parsing tests
pkg/internal/diskutil_test.go, pkg/diskmaker/controllers/lvset/matcher_test.go
Adds an lsblk fixture with SERIAL, verifies parsed serial output, and covers matching, whitespace-only, and mismatch cases for the new matcher.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 14 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (14 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly reflects the main change: adding serial-based filtering to LocalVolumeSet device inclusion matching.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Stable And Deterministic Test Names ✅ Passed Changed tests use static names only; no Ginkgo titles or dynamic t.Run labels were added, and the new labels are deterministic.
Test Structure And Quality ✅ Passed PASS: The added tests are simple table-driven unit tests, not Ginkgo/cluster tests; no setup/cleanup or timeout issues, and they follow existing repo patterns.
Microshift Test Compatibility ✅ Passed No new Ginkgo e2e tests were added; changed tests use standard testing/t.Run and no MicroShift-unsupported APIs.
Single Node Openshift (Sno) Test Compatibility ✅ Passed PASS: The PR adds only unit tests and API/matcher code; no Ginkgo e2e tests or SNO-sensitive multi-node assumptions were introduced.
Topology-Aware Scheduling Compatibility ✅ Passed Only device serial filtering and tests were added; no replicas, affinities, nodeSelectors, tolerations, or topology logic changed.
Ote Binary Stdout Contract ✅ Passed No touched process-level code writes to stdout; the only init is scheme registration, and the PR changes are API/matcher/tests only.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed PASS: The PR adds only Go unit tests and matcher logic; no Ginkgo It/Describe/Context/When blocks or external-network/IP-family assumptions were introduced.
No-Weak-Crypto ✅ Passed Touched files only add serial filtering/tests; no MD5/SHA1/DES/RC4/3DES/Blowfish/ECB or crypto package usage found.
Container-Privileges ✅ Passed PASS: The PR only changes Go API/matcher/test files; no container/K8s manifests were modified, so no privileged settings were introduced.
No-Sensitive-Data-In-Logs ✅ Passed No new logging/print statements or sensitive-data emissions were added; the patch only adds serial-based matching and tests.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@openshift-ci openshift-ci Bot requested review from RomanBednar and tsmetana June 27, 2026 18:26
@openshift-ci

openshift-ci Bot commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: ssato
Once this PR has been reviewed and has the lgtm label, please assign gnufied for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details 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

@openshift-ci openshift-ci Bot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Jun 27, 2026
@openshift-ci

openshift-ci Bot commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

Hi @ssato. Thanks for your PR.

I'm waiting for a openshift member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

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-sigs/prow repository.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@pkg/diskmaker/controllers/lvset/matcher.go`:
- Around line 204-219: Update inSerialList in matcher.go to use exact serial
matching instead of substring matching: trim whitespace and compare
case-insensitively with equality against dev.Serial, and keep the existing
nil/empty spec behavior unchanged. Make sure matchesDeviceSpec only accepts true
serial matches, and add a TestInSerialList case that proves a prefix/suffix
collision like "1234" no longer matches a longer serial.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 22e81c32-01f8-4357-8474-0f4ef80f2ea0

📥 Commits

Reviewing files that changed from the base of the PR and between 154fc34 and ded1f52.

📒 Files selected for processing (4)
  • api/v1alpha1/localvolumeset_types.go
  • pkg/diskmaker/controllers/lvset/matcher.go
  • pkg/diskmaker/controllers/lvset/matcher_test.go
  • pkg/internal/diskutil_test.go

Comment thread pkg/diskmaker/controllers/lvset/matcher.go
@ssato ssato force-pushed the feature/extend-lvset-matcher branch from ded1f52 to e574b46 Compare June 28, 2026 16:01
Comment thread pkg/diskmaker/controllers/lvset/matcher.go

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@pkg/diskmaker/controllers/lvset/matcher.go`:
- Around line 204-222: The serial matcher in `inSerialList` no longer matches
the documented contract for `DeviceInclusionSpec.Serials`, since it now uses
exact case-insensitive equality instead of substring containment. Update the
controller logic in `matcher.go` to follow the intended “contains” behavior, or
adjust the `DeviceInclusionSpec.Serials` documentation and CRD description in
`localvolumeset_types.go` so both the API contract and `inSerialList` behavior
are consistent.
- Around line 204-221: In the inSerialList matcher, blank-only serial filters
should be treated the same as an empty filter. Update the logic in matcher.go so
that after trimming spec.Serials entries, if no non-blank serials remain the
function returns true, nil instead of falling through to false. Keep the
existing pass-through behavior for nil spec and an explicitly empty Serials
list, and apply the fix within inSerialList using the existing strings.TrimSpace
and strings.EqualFold flow.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 47a06de9-05b2-4779-8297-c2aa3172cd97

📥 Commits

Reviewing files that changed from the base of the PR and between ded1f52 and e574b46.

📒 Files selected for processing (3)
  • api/v1alpha1/localvolumeset_types.go
  • pkg/diskmaker/controllers/lvset/matcher.go
  • pkg/diskmaker/controllers/lvset/matcher_test.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • api/v1alpha1/localvolumeset_types.go

Comment thread pkg/diskmaker/controllers/lvset/matcher.go
Comment thread pkg/diskmaker/controllers/lvset/matcher.go
@ssato ssato force-pushed the feature/extend-lvset-matcher branch from e574b46 to 93ab267 Compare July 4, 2026 16:00
Signed-off-by: Satoru SATOH <satoru.satoh@gmail.com>
@ssato ssato force-pushed the feature/extend-lvset-matcher branch from 93ab267 to 0c6697d Compare July 4, 2026 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant