fix some fc-hba are missing the statistics/*#664
Conversation
Signed-off-by: jiajian.chi <jiajian.chi@zstack.io>
On branch fixFibrechannel Changes to be committed: modified: sysfs/class_fibrechannel.go Signed-off-by: jiajian.chi <jiajian.chi@zstack.io>
f187d47 to
e4deace
Compare
delete Printf Signed-off-by: chijiajian <33536362+chijiajian@users.noreply.github.com>
Refactor error handling for statistics directory check. Signed-off-by: chijiajian <33536362+chijiajian@users.noreply.github.com>
chijiajian
left a comment
There was a problem hiding this comment.
Fixed — now explicitly checking for fs.ErrNotExist and returning other errors.
chijiajian
left a comment
There was a problem hiding this comment.
fix: undefined: fs
chijiajian
left a comment
There was a problem hiding this comment.
Updated to check errors.Is(err, os.ErrNotExist). Thanks!
Signed-off-by: chijiajian <33536362+chijiajian@users.noreply.github.com> Signed-off-by: jiajian.chi <jiajian.chi@zstack.io>
feed16a to
7ac0df5
Compare
|
Fixed the code formatting issues via gofmt locally. Please take a look. Thanks! |
|
Thanks! Removed the redundant |
ReadDir already returns os.ErrNotExist when the directory does not exist, so no need to run Stat before ReadDir. Signed-off-by: chijiajian <33536362+chijiajian@users.noreply.github.com>
6cb7ab0 to
a3c8569
Compare
|
Hi @SuperQ @discordianfish, I addressed the last review comment in a3c8569 by removing the redundant os.Stat call and handling os.ErrNotExist directly from os.ReadDir. The review threads are now resolved/outdated. Could you please re-run CI for the latest commit and take another look when you have a chance? Thanks! |
Co-authored-by: Ben Kochie <superq@gmail.com> Signed-off-by: Ben Kochie <superq@gmail.com>
Some FC-HBA cards are missing the /sys/class/fc_host//statistics/* directory and files, for example, the Huawei Technologies Co., Ltd. Hi1822 Family (2*16G FC) (rev 45) card with ID 3e:00.0. However, there are corresponding port_name, port_state, etc., under /sys/class/fc_host//. It is recommended to add a check in the parseFibreChannelStatistics function in the class_fibrechannel.