Merge pull request #1508 from gdvalle/gtd.disk.serial-num-fix

fix IOCounters() SerialNumber enumeration
pull/1513/head
shirou 2 years ago committed by GitHub
commit 6084c1e2a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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

Loading…
Cancel
Save