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

Added the device revision support for linux and fixed NUMANodeID read process #273

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

Conversation

leonardowitt
Copy link

I'm opening it as a draft since I didn't implement the device revision support to Windows.

Copy link
Owner

@jaypipes jaypipes left a comment

Choose a reason for hiding this comment

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

This looks great, Leonardo, thank you for the contribution!

There's no need to include Windows support in this particular PR, however one thing I would ask is that you actually submit two PRs, one for the fix to the disk's NUMA Node ID collection and the other PR containing the new disk Revision field. That way, if we need to revert one of the fixes/features, we don't need to revert everything.

Best,
-jay

if nodeContents, err := ioutil.ReadFile(filepath.Join(paths.SysBlock, partial, "numa_node")); err != nil {
if nodeInt, err := strconv.Atoi(string(nodeContents)); err != nil {
if nodeContents, err := ioutil.ReadFile(filepath.Join(paths.SysBlock, partial, "numa_node")); err == nil {
if nodeInt, err := strconv.Atoi(string(nodeContents)); err == nil {
Copy link
Owner

Choose a reason for hiding this comment

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

Nice catch, Leonardo!

Copy link
Collaborator

Choose a reason for hiding this comment

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

Indeed! but this would deserve a separate PR

if nodeContents, err := ioutil.ReadFile(filepath.Join(paths.SysBlock, partial, "numa_node")); err != nil {
if nodeInt, err := strconv.Atoi(string(nodeContents)); err != nil {
if nodeContents, err := ioutil.ReadFile(filepath.Join(paths.SysBlock, partial, "numa_node")); err == nil {
if nodeInt, err := strconv.Atoi(string(nodeContents)); err == nil {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Indeed! but this would deserve a separate PR

@@ -91,6 +91,17 @@ func diskVendor(paths *linuxpath.Paths, disk string) string {
return strings.TrimSpace(string(contents))
}

func diskRevision(paths *linuxpath.Paths, disk string) string {
Copy link
Collaborator

Choose a reason for hiding this comment

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

it's ok to add support for linux first and add a TODO for windows/mac

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.

None yet

4 participants