diff options
author | Hironori Shiina <shiina.hironori@jp.fujitsu.com> | 2021-11-15 16:54:50 -0500 |
---|---|---|
committer | Hironori Shiina <shiina.hironori@jp.fujitsu.com> | 2021-11-30 09:21:28 -0500 |
commit | 5a56f4094800d1ad07b89d08365b70fcd613569a (patch) | |
tree | 17fdc49a0ff68e227c3e4867cb5676c2321a1f52 /pkg/specgen | |
parent | 8de68b170716dd1293c5a044f3e9cfd962fdbfb1 (diff) | |
download | podman-5a56f4094800d1ad07b89d08365b70fcd613569a.tar.gz podman-5a56f4094800d1ad07b89d08365b70fcd613569a.tar.bz2 podman-5a56f4094800d1ad07b89d08365b70fcd613569a.zip |
Implement 'podman run --blkio-weight-device'
`--blkio-weight-device` is not fully implemented and this causes an
unexpected panic when specified because an entry is put into an
uninitialized map at parsing.
This fix implements the `--blkio-weight-device` and adds a system test.
When creating a spec generator on a client, a major number and a minor
number of a device cannot be set. So, these numbers are inspected on a
server and set to a runtime spec.
Signed-off-by: Hironori Shiina <shiina.hironori@jp.fujitsu.com>
Diffstat (limited to 'pkg/specgen')
-rw-r--r-- | pkg/specgen/generate/oci.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/pkg/specgen/generate/oci.go b/pkg/specgen/generate/oci.go index 1b022b912..df5788099 100644 --- a/pkg/specgen/generate/oci.go +++ b/pkg/specgen/generate/oci.go @@ -329,6 +329,14 @@ func SpecGenToOCI(ctx context.Context, s *specgen.SpecGenerator, rt *libpod.Runt g.AddLinuxResourcesDevice(true, dev.Type, dev.Major, dev.Minor, dev.Access) } + for k, v := range s.WeightDevice { + statT := unix.Stat_t{} + if err := unix.Stat(k, &statT); err != nil { + return nil, errors.Wrapf(err, "failed to inspect '%s' in --blkio-weight-device", k) + } + g.AddLinuxResourcesBlockIOWeightDevice((int64(unix.Major(uint64(statT.Rdev)))), (int64(unix.Minor(uint64(statT.Rdev)))), *v.Weight) + } + BlockAccessToKernelFilesystems(s.Privileged, s.PidNS.IsHost(), s.Mask, s.Unmask, &g) g.ClearProcessEnv() |