From a2930d4519aefd2d24cb71a406a576d696991283 Mon Sep 17 00:00:00 2001 From: Ravi Kumar M <100195459+mravi-na@users.noreply.github.com> Date: Thu, 8 Feb 2024 14:39:47 +0530 Subject: [PATCH] Skip frequent multipath and iscsiadm utils used only for logging. --- utils/devices.go | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/utils/devices.go b/utils/devices.go index bb0fd6238..18da697b5 100644 --- a/utils/devices.go +++ b/utils/devices.go @@ -13,7 +13,6 @@ import ( "time" "github.com/cenkalti/backoff/v4" - log "github.com/sirupsen/logrus" "golang.org/x/net/context" . "github.com/netapp/trident/logging" @@ -321,11 +320,6 @@ func GetDeviceNameFromMount(ctx context.Context, mountpath string) (string, int, // In the case of a iscsi trace debug, log info about session and what devices are present func listAllISCSIDevices(ctx context.Context) { - if !IsLevelEnabled(log.TraceLevel) { - // Don't even run the commands if trace logging is not enabled - return - } - Logc(ctx).Trace(">>>> devices.listAllISCSIDevices") defer Logc(ctx).Trace("<<<< devices.listAllISCSIDevices") // Log information about all the devices @@ -346,14 +340,16 @@ func listAllISCSIDevices(ctx context.Context) { for _, entry := range entries { sysLog = append(sysLog, entry.Name()) } - out1, _ := command.ExecuteWithTimeout(ctx, "multipath", deviceOperationsTimeout, true, "-ll") - out2, _ := execIscsiadmCommand(ctx, "-m", "session") + + // TODO: Call this only when verbose logging requires beyond debug level. + // out1, _ := command.ExecuteWithTimeout(ctx, "multipath", deviceOperationsTimeout, true, "-ll") + // out2, _ := execIscsiadmCommand(ctx, "-m", "session") Logc(ctx).WithFields(LogFields{ - "/dev/dm-*": dmLog, - "/dev/sd*": sdLog, - "/sys/block/*": sysLog, - "multipath -ll output": string(out1), - "iscsiadm -m session output": string(out2), + "/dev/dm-*": dmLog, + "/dev/sd*": sdLog, + "/sys/block/*": sysLog, + // "multipath -ll output": string(out1), + // "iscsiadm -m session output": string(out2), }).Trace("Listing all iSCSI Devices.") }