-
Notifications
You must be signed in to change notification settings - Fork 33
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
Finding drive vid in lsblk vendor #1094
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -161,11 +161,6 @@ func (l *LSBLK) GetBlockDevices(device string) ([]BlockDevice, error) { | |
// Receives an instance of drivecrd.Drive struct | ||
// Returns drive's path based on provided drivecrd.Drive or error if something went wrong | ||
func (l *LSBLK) SearchDrivePath(drive *api.Drive) (string, error) { | ||
// device path might be already set by hwmgr | ||
device := drive.Path | ||
if device != "" { | ||
return device, nil | ||
} | ||
|
||
// try to find it with lsblk | ||
lsblkOut, err := l.GetBlockDevices("") | ||
|
@@ -178,7 +173,7 @@ func (l *LSBLK) SearchDrivePath(drive *api.Drive) (string, error) { | |
vid := drive.VID | ||
pid := drive.PID | ||
for _, l := range lsblkOut { | ||
if strings.EqualFold(l.Serial, sn) && strings.EqualFold(l.Vendor, vid) && | ||
if strings.EqualFold(l.Serial, sn) && strings.Contains(l.Vendor, vid) && | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. how about the pid handling ? lsblk returned "HGST HUS728T8TALE6L0", but the drive CR value is from drivemgr, which is "HGST HUS728T8TAL". There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We are observing failure only for the Vendo ID. Since the serial number reported by both HAL and lsblk are found the same, we should be good with the existing implementation. We need a quick resolution due to the time constraint, however I agree that we need to have a relook at this area of code in the next release cycle There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do you mean for the pid I mentioned above, for different length strings, strings.EqualFold will return true in the case ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should only ignore the trailing space in this JIRA. It is not safe to use "string.contains(A, B)" as it will also return TRUE for many other cases. For example: A = "testing " B="ing" |
||
strings.EqualFold(l.Model, pid) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Need code change here to handle the PID. l.Vendor is "ATA " while vid (drive.VID) is “ATA” There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agree! |
||
device = l.Name | ||
break | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one general comments is to create an issue first and link the issue to the PR. and put [ISSUE-xxx] in PR title.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed