Skip to content

Commit

Permalink
runc update: skip devices
Browse files Browse the repository at this point in the history
The runc update CLI is not able to modify devices, so let's set SkipDevices
(so that a cgroup controller won't try to update devices cgroup).

This helps use cases when some other device management (NVIDIA GPUs)
applies its configuration on top of what runc does.

Make sure we do not save SkipDevices into state.json.

Signed-off-by: Kir Kolyshkin <[email protected]>
  • Loading branch information
kolyshkin committed Jun 3, 2021
1 parent c8653a2 commit bf7492e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions libcontainer/configs/cgroup_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ type Resources struct {

// SkipDevices allows to skip configuring device permissions.
// Used by e.g. kubelet while creating a parent cgroup (kubepods)
// common for many containers.
// common for many containers, and by runc update.
//
// NOTE it is impossible to start a container which has this flag set.
SkipDevices bool `json:"skip_devices"`
SkipDevices bool `json:"-"`
}
7 changes: 7 additions & 0 deletions update.go
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,13 @@ other options are ignored.
config.IntelRdt.MemBwSchema = memBwSchema
}

// XXX(kolyshkin@): currently "runc update" is unable to change
// device configuration, so add this to skip device update.
// This helps in case an extra plugin (nvidia GPU) applies some
// configuration on top of what runc does.
// Note this field is not saved into container's state.json.
config.Cgroups.SkipDevices = true

return container.Set(config)
},
}

0 comments on commit bf7492e

Please sign in to comment.