From 529d7dbdab3ae86ba17613944757314d3c600b89 Mon Sep 17 00:00:00 2001 From: "jiajian.chi" Date: Thu, 12 Sep 2024 09:44:34 +0800 Subject: [PATCH 1/3] fix some fc-hba are missing the statistics/* Signed-off-by: jiajian.chi --- sysfs/class_fibrechannel.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sysfs/class_fibrechannel.go b/sysfs/class_fibrechannel.go index 4b583f71..9aac783d 100644 --- a/sysfs/class_fibrechannel.go +++ b/sysfs/class_fibrechannel.go @@ -153,6 +153,12 @@ func parseFibreChannelStatistics(hostPath string) (*FibreChannelCounters, error) var counters FibreChannelCounters path := filepath.Join(hostPath, "statistics") + + if _, err := os.Stat(path); os.IsNotExist(err) { + fmt.Printf("Directory %s does not exist, skipping.\n", path) + return &counters, nil + } + files, err := os.ReadDir(path) if err != nil { return nil, err From e4deace9a4ffda9e9653720a385b235ac89fbdae Mon Sep 17 00:00:00 2001 From: "jiajian.chi" Date: Thu, 12 Sep 2024 09:52:27 +0800 Subject: [PATCH 2/3] Signed-off-by: jiajian.chi On branch fixFibrechannel Changes to be committed: modified: sysfs/class_fibrechannel.go Signed-off-by: jiajian.chi --- sysfs/class_fibrechannel.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/sysfs/class_fibrechannel.go b/sysfs/class_fibrechannel.go index 9aac783d..7b571a45 100644 --- a/sysfs/class_fibrechannel.go +++ b/sysfs/class_fibrechannel.go @@ -153,12 +153,10 @@ func parseFibreChannelStatistics(hostPath string) (*FibreChannelCounters, error) var counters FibreChannelCounters path := filepath.Join(hostPath, "statistics") - if _, err := os.Stat(path); os.IsNotExist(err) { fmt.Printf("Directory %s does not exist, skipping.\n", path) return &counters, nil } - files, err := os.ReadDir(path) if err != nil { return nil, err From a8024a8d363729f3f7d9a476483d1f7873417121 Mon Sep 17 00:00:00 2001 From: chijiajian <33536362+chijiajian@users.noreply.github.com> Date: Tue, 24 Sep 2024 14:25:21 +0800 Subject: [PATCH 3/3] Update class_fibrechannel.go delete Printf Signed-off-by: chijiajian <33536362+chijiajian@users.noreply.github.com> --- sysfs/class_fibrechannel.go | 1 - 1 file changed, 1 deletion(-) diff --git a/sysfs/class_fibrechannel.go b/sysfs/class_fibrechannel.go index 7b571a45..6d0edfbf 100644 --- a/sysfs/class_fibrechannel.go +++ b/sysfs/class_fibrechannel.go @@ -154,7 +154,6 @@ func parseFibreChannelStatistics(hostPath string) (*FibreChannelCounters, error) path := filepath.Join(hostPath, "statistics") if _, err := os.Stat(path); os.IsNotExist(err) { - fmt.Printf("Directory %s does not exist, skipping.\n", path) return &counters, nil } files, err := os.ReadDir(path)