Skip to content

Commit

Permalink
Merge pull request #1508 from gdvalle/gtd.disk.serial-num-fix
Browse files Browse the repository at this point in the history
fix IOCounters() SerialNumber enumeration
  • Loading branch information
shirou committed Aug 20, 2023
2 parents 8bcde84 + 0a23dc6 commit 6084c1e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion disk/disk_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,11 @@ func IOCountersWithContext(ctx context.Context, names ...string) (map[string]IOC
}
d.Name = name

d.SerialNumber, _ = SerialNumberWithContext(ctx, name)
// Names passed in can be full paths (/dev/sda) or just device names (sda).
// Since `name` here is already a basename, re-add the /dev path.
// This is not ideal, but we may break the API by changing how SerialNumberWithContext
// works.
d.SerialNumber, _ = SerialNumberWithContext(ctx, common.HostDevWithContext(ctx, name))
d.Label, _ = LabelWithContext(ctx, name)

ret[name] = d
Expand Down

0 comments on commit 6084c1e

Please sign in to comment.