From d1a7f517d32f7bef339bcf94b6bb824a7709123b Mon Sep 17 00:00:00 2001 From: Ritwik Ranjan Date: Mon, 6 Jan 2025 13:01:12 +0000 Subject: [PATCH 1/2] fix: remove empty error wrapping --- pkg/plugin/hnsstats/vfp_counters_windows.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/pkg/plugin/hnsstats/vfp_counters_windows.go b/pkg/plugin/hnsstats/vfp_counters_windows.go index 63ac69eac8..77ea29f2ec 100644 --- a/pkg/plugin/hnsstats/vfp_counters_windows.go +++ b/pkg/plugin/hnsstats/vfp_counters_windows.go @@ -153,14 +153,21 @@ func getVfpPortCountersRaw(portGUID string) (string, error) { cmd := exec.Command("cmd", "/c", vfpCmd) out, err := cmd.Output() - return string(out), errors.Wrap(err, "errored while running vfpctrl /get-port-counter") + if err != nil { + return "", errors.Wrap(err, "errored while running vfpctrl /get-port-counter") + } + + return string(out), nil } // TODO: Remove this once Resources.Allocators.EndpointPortGuid gets added to hcsshim Endpoint struct // Lists all vSwitch ports func listvPorts() ([]byte, error) { out, err := exec.Command("cmd", "/c", "vfpctrl /list-vmswitch-port").CombinedOutput() - return out, errors.Wrap(err, "errored while running vfpctrl /list-vmswitch-port") + if err != nil { + return out, errors.Wrap(err, "errored while running vfpctrl /list-vmswitch-port") + } + return out, nil } // TODO: Remove this once Resources.Allocators.EndpointPortGuid gets added to hcsshim Endpoint struct From 9a0c2796de1de5bf218715b48916f26c02bc75c5 Mon Sep 17 00:00:00 2001 From: Ritwik Ranjan Date: Tue, 7 Jan 2025 11:29:27 +0000 Subject: [PATCH 2/2] Update pkg/plugin/hnsstats/vfp_counters_windows.go Co-authored-by: Evan Baker Signed-off-by: Ritwik Ranjan --- pkg/plugin/hnsstats/vfp_counters_windows.go | 1 - 1 file changed, 1 deletion(-) diff --git a/pkg/plugin/hnsstats/vfp_counters_windows.go b/pkg/plugin/hnsstats/vfp_counters_windows.go index 77ea29f2ec..8bdcfefecb 100644 --- a/pkg/plugin/hnsstats/vfp_counters_windows.go +++ b/pkg/plugin/hnsstats/vfp_counters_windows.go @@ -156,7 +156,6 @@ func getVfpPortCountersRaw(portGUID string) (string, error) { if err != nil { return "", errors.Wrap(err, "errored while running vfpctrl /get-port-counter") } - return string(out), nil }