Closed maran closed 4 years ago
So I'm pretty confused as to how limits would actually ever have worked since @tomponline's rework of devices.
The issue is that the Start()
function on the device is called prior to the container starting, this generates the list of needed mounts but doesn't mount anything yet. This in turn means that we don't know what device backs the source path yet and so can't ever compute the needed cgroup entries.
I suspect what we need to do is move the limit calculation to a PostHook, which then allows us to inspect the mounted disks. That PostHook should then return a RunConfig with the cgroup entries we expect and we can then have LXD apply them through LXC.
@tomponline does that sound right to you?
@stgraber the cgroup settings are returned as part of run config by Start() and if being called as part of container start then the cgroup rules are translated into liblxc settings so they are applied when the container actually starts. Here: https://github.com/lxc/lxd/blob/master/lxd/container_lxc.go#L2243-L2251 this is the same technique used for the actual mounts.
I'll take a look and check its working on other disk types to check its not specific to RBD.
@tomponline the problem is that those rules cannot be generated until a mount entry exists and that mount entry won't exist until RunConfig is applied.
That's why I'm now adding a PostRunConfig which can be filed through PostHooks and get applied after the container has started.
This then allows us to resolve the mounts to block devices and figure out the limits.
I've got a branch which does this now and that's fixed the limits for the root device here. There's still a problem resolving the mount for devices that are hotplugged though, so looking into those still.
Required information
Issue description
As discussed here when working with an rbd volumes it appears
limits.read/write
are not being translated into valid cgroup limits.Steps to reproduce
blkio.throttle.write_bps_device
orblkio.throttle.read_bps_device
have some data, but they are empty.Let me know how I can help with this.