Skip to content

Commit

Permalink
Skip frequent multipath and iscsiadm utils used only for logging.
Browse files Browse the repository at this point in the history
  • Loading branch information
mravi-na authored Feb 7, 2024
1 parent 3a956cf commit 70a28fc
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions utils/devices.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand All @@ -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.")
}

Expand Down

0 comments on commit 70a28fc

Please sign in to comment.