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

Properly detect dm devices #301

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

avishayt
Copy link
Contributor

Fixes: #298

@avishayt avishayt closed this Feb 17, 2022
@jaypipes
Copy link
Owner

@avishayt I apologize for the delay in getting to these reviews, sir. Is there a reason you closed out your PRs?

@avishayt
Copy link
Contributor Author

Wasn't sure the project was still active :)
Reopening

@avishayt avishayt reopened this Feb 22, 2022
Copy link
Collaborator

@ffromani ffromani left a comment

Choose a reason for hiding this comment

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

thanks for the change! the code per se looks good! It would be real nice to have some tests to cover this change, in order to avoid future breakage.
It would be also real nice to have an example of the sysfs directory tree involved here.
Perhaps ghw-snapshot can help to capture that?

Fixes: jaypipes#298
Signed-off-by: Avishay Traeger <avishay@redhat.com>
@avishayt
Copy link
Contributor Author

Added unit tests

@@ -166,6 +169,7 @@ type Disk struct {
SerialNumber string `json:"serial_number"`
WWN string `json:"wwn"`
Partitions []*Partition `json:"partitions"`
Members []string `json:"members"`
Copy link
Collaborator

Choose a reason for hiding this comment

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

LGTM but let's hear from @jaypipes because of the API-level change

Copy link
Collaborator

@ffromani ffromani left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for the updates.

@@ -271,7 +284,7 @@ func disks(ctx *context.Context, paths *linuxpath.Paths) []*Disk {
driveType, storageController := diskTypes(dname)
// TODO(jaypipes): Move this into diskTypes() once abstracting
// diskIsRotational for ease of unit testing
if !diskIsRotational(ctx, paths, dname) {
if driveType != DRIVE_TYPE_MAPPER && !diskIsRotational(ctx, paths, dname) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

we will probably need to review this flow more deeply, but that's totally material for another PR. This change LGTM for this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Properly detect dm devices
3 participants