fix(inputs.diskio): Honor host path environment variables on Linux#18682
fix(inputs.diskio): Honor host path environment variables on Linux#18682skartikey merged 1 commit intoinfluxdata:masterfrom
Conversation
c9ebb0e to
cad1114
Compare
cad1114 to
88fcfbc
Compare
517fda1 to
3c65601
Compare
|
Thanks for the detailed review, I updated the patch accordingly:
This keeps the test inputs explicit/reproducible and aligns with your requested style. |
3c65601 to
e8da02b
Compare
e8da02b to
f15edce
Compare
Thanks @srebhan , addressed. I replaced setupEnv callbacks with env map[string]string and apply them in the test loop via t.Setenv, removed the redundant createDev indirection by joining paths at the caller side, and dropped the unix.Stat/mtime-dependent setup in favor of direct fixture-based assertions. |
| hostRoot := filepath.Join("testdata", "hostfs") | ||
| t.Setenv("HOST_DEV", filepath.Join(hostRoot, "dev")) |
There was a problem hiding this comment.
I think this is easier to read the actual path
| hostRoot := filepath.Join("testdata", "hostfs") | |
| t.Setenv("HOST_DEV", filepath.Join(hostRoot, "dev")) | |
| t.Setenv("HOST_DEV", filepath.Join("testdata", "hostfs", "dev")) |
| hostSys := filepath.Join("testdata", "hostfs", "sys") | ||
| t.Setenv("HOST_SYS", hostSys) |
There was a problem hiding this comment.
| hostSys := filepath.Join("testdata", "hostfs", "sys") | |
| t.Setenv("HOST_SYS", hostSys) | |
| t.Setenv("HOST_SYS", filepath.Join("testdata", "hostfs", "sys")) |
e11389a to
c2b173c
Compare
c2b173c to
ed21ecf
Compare
|
Download PR build artifacts for linux_amd64.tar.gz, darwin_arm64.tar.gz, and windows_amd64.zip. 📦 Click here to get additional PR build artifactsArtifact URLs |
Summary
This PR updates
inputs.diskioon Linux to honor host path environment variables instead of relying on hard-coded/dev,/run, and/syspaths, addressing issue #18671.Added support for resolving host paths with the following fallback order:
HOST_DEV/HOST_RUN/HOST_SYSHOST_ROOTHOST_MOUNT_PREFIX/dev,/run,/sysThis PR also fixes the
infoCachewriteback to storesysBlockPathcorrectly, updates the/devfallback inresolveName()to use the resolved host device path, and updatesgetDeviceWWID()to read from the resolved host sysfs path.Tests added in this PR cover:
HOST_DEV+HOST_RUNHOST_ROOTfallbackHOST_MOUNT_PREFIXfallbackHOST_SYShandling for WWID lookupChecklist
Related issues
resolves #18671