Skip to content

Commit

Permalink
fix(template): block device queue stats path update + error checking
Browse files Browse the repository at this point in the history
The function will prepend the `/sys/block/` path in for us, so we don't
need to use the joined path here, just the regular device name returned
from the list function.

Also, somehow, I wrote this so that the error log would always log,
regardless of whether or not there was an error. It actually checks if
the function errored now. 🤦
  • Loading branch information
tjhop committed May 17, 2024
1 parent 6520654 commit b7e89d2
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions internal/manager/system_metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,15 +218,16 @@ func getStorageMetadata(ctx context.Context, logger *slog.Logger) storageMetadat
var disks []disk
for _, blockDev := range blockDevs {
blockDevPath := filepath.Join(blockDevDir, blockDev)

qStats, err := fs.SysBlockDeviceQueueStats(blockDevPath)
mdLogger.LogAttrs(
ctx,
slog.LevelError,
"Failed to get queue stats for block device",
slog.String("err", err.Error()),
slog.String("device", blockDev),
)
qStats, err := fs.SysBlockDeviceQueueStats(blockDev)
if err != nil {
mdLogger.LogAttrs(
ctx,
slog.LevelError,
"Failed to get queue stats for block device",
slog.String("err", err.Error()),
slog.String("device", blockDev),
)
}

ssd := false
if qStats.Rotational == 0 {
Expand Down

0 comments on commit b7e89d2

Please sign in to comment.