Merge pull request #819 from devopsext/disk-fix_2.19.11

Fix for track disk stats when running in container
pull/826/head
shirou 5 years ago committed by GitHub
commit dce23de000
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -301,7 +301,7 @@ func PartitionsWithContext(ctx context.Context, all bool) ([]PartitionStat, erro
}
if strings.HasPrefix(d.Device, "/dev/mapper/") {
devpath, err := filepath.EvalSymlinks(d.Device)
devpath, err := filepath.EvalSymlinks(common.HostDev(strings.Replace(d.Device, "/dev", "", -1)))
if err == nil {
d.Device = devpath
}

@ -338,6 +338,10 @@ func HostRun(combineWith ...string) string {
return GetEnv("HOST_RUN", "/run", combineWith...)
}
func HostDev(combineWith ...string) string {
return GetEnv("HOST_DEV", "/dev", combineWith...)
}
// getSysctrlEnv sets LC_ALL=C in a list of env vars for use when running
// sysctl commands (see DoSysctrl).
func getSysctrlEnv(env []string) []string {

Loading…
Cancel
Save