The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/5123
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) ===
From 56d417c185ce9bbe0716cd0a74084e8ef3c4bd4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgra...@ubuntu.com> Date: Tue, 9 Oct 2018 15:03:23 -0400 Subject: [PATCH 1/2] devices: Fix bad disk limits --- lxd/devices.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lxd/devices.go b/lxd/devices.go index 73f774b000..c0ae53dc4e 100644 --- a/lxd/devices.go +++ b/lxd/devices.go @@ -1310,7 +1310,7 @@ func deviceParseDiskLimit(readSpeed string, writeSpeed string) (int64, int64, in bps := int64(0) iops := int64(0) - if readSpeed == "" { + if value == "" { return bps, iops, nil } From c4f02c3fd5666fac122ed2de2b0f499917627b2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgra...@ubuntu.com> Date: Tue, 9 Oct 2018 15:03:31 -0400 Subject: [PATCH 2/2] Fix root disk limits on container startup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #5115 Signed-off-by: Stéphane Graber <stgra...@ubuntu.com> --- lxd/container_lxc.go | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/lxd/container_lxc.go b/lxd/container_lxc.go index f70f4497af..26e3193fc7 100644 --- a/lxd/container_lxc.go +++ b/lxd/container_lxc.go @@ -1395,6 +1395,7 @@ func (c *containerLXC) initLXC(config bool) error { } hasDiskLimits := false + hasRootLimit := false for _, name := range c.expandedDevices.DeviceNames() { m := c.expandedDevices[name] if m["type"] != "disk" { @@ -1402,17 +1403,36 @@ func (c *containerLXC) initLXC(config bool) error { } if m["limits.read"] != "" || m["limits.write"] != "" || m["limits.max"] != "" { + if m["path"] == "/" { + hasRootLimit = true + } + hasDiskLimits = true - break } } if hasDiskLimits { + ourStart := false + + if hasRootLimit { + ourStart, err = c.StorageStart() + if err != nil { + return err + } + } + diskLimits, err := c.getDiskLimits() if err != nil { return err } + if hasRootLimit && ourStart { + _, err = c.StorageStop() + if err != nil { + return err + } + } + for block, limit := range diskLimits { if limit.readBps > 0 { err = lxcSetConfigItem(cc, "lxc.cgroup.blkio.throttle.read_bps_device", fmt.Sprintf("%s %d", block, limit.readBps))
_______________________________________________ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel