The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/6288
This e-mail was sent by the LXC bot, direct replies will not reach the author unless they happen to be subscribed to this list. === Description (from pull-request) === Closes #6277 Signed-off-by: Stéphane Graber <stgra...@ubuntu.com>
From e2f18530b7bd634386ca7b039d4b083bec15edd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgra...@ubuntu.com> Date: Mon, 7 Oct 2019 16:57:26 -0400 Subject: [PATCH] lxd/device/disk: Apply limits through post hook MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #6277 Signed-off-by: Stéphane Graber <stgra...@ubuntu.com> --- lxd/device/disk.go | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/lxd/device/disk.go b/lxd/device/disk.go index eec1bed125..54157504cd 100644 --- a/lxd/device/disk.go +++ b/lxd/device/disk.go @@ -191,13 +191,25 @@ func (d *disk) Start() (*RunConfig, error) { runConf := RunConfig{} - err = d.generateLimits(&runConf) - if err != nil { - return nil, err - } - isReadOnly := shared.IsTrue(d.config["readonly"]) + // Apply cgroups only after all the mounts have been processed + runConf.PostHooks = append(runConf.PostHooks, func() error { + runConf := RunConfig{} + + err := d.generateLimits(&runConf) + if err != nil { + return err + } + + err = d.instance.DeviceEventHandler(&runConf) + if err != nil { + return err + } + + return nil + }) + // Deal with a rootfs. if shared.IsRootDiskDevice(d.config) { // Set the rootfs path. @@ -701,8 +713,8 @@ func (d *disk) getDiskLimits() (map[string]diskBlockLimit, error) { } // Set the source path - source := shared.HostPath(dev["source"]) - if source == "" { + source := d.getDevicePath() + if dev["source"] == "" { source = d.instance.RootfsPath() }
_______________________________________________ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel