[lxc-devel] [lxd/master] Fix container creation with disk limits
stgraber on Github
lxc-bot at linuxcontainers.org
Mon Feb 4 19:02:38 UTC 2019
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 301 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20190204/3a77dbc2/attachment.bin>
-------------- next part --------------
From 51974ad68d22f6788c84dbc55841794687723376 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Mon, 4 Feb 2019 17:41:22 +0100
Subject: [PATCH 1/2] lxd/containers: Always delete container on create error
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
lxd/container_lxc.go | 1 +
1 file changed, 1 insertion(+)
diff --git a/lxd/container_lxc.go b/lxd/container_lxc.go
index 67b9510317..fb9809eff8 100644
--- a/lxd/container_lxc.go
+++ b/lxd/container_lxc.go
@@ -378,6 +378,7 @@ func containerLXCCreate(s *state.State, args db.ContainerArgs) (container, error
volumeConfig := map[string]string{}
err = storageVolumeFillDefault(storagePool, volumeConfig, pool)
if err != nil {
+ c.Delete()
return nil, err
}
From fef911ce4f2c405a04345c32040a1341b5e091a1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Mon, 4 Feb 2019 17:41:29 +0100
Subject: [PATCH 2/2] lxd/containers: Fix disk limits at creation
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Closes #5429
Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
lxd/container_lxc.go | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/lxd/container_lxc.go b/lxd/container_lxc.go
index fb9809eff8..d9e6174146 100644
--- a/lxd/container_lxc.go
+++ b/lxd/container_lxc.go
@@ -1449,6 +1449,11 @@ func (c *containerLXC) initLXC(config bool) error {
}
}
+ // Detect initial creation where the rootfs doesn't exist yet (can't mount it)
+ if !shared.PathExists(c.RootfsPath()) {
+ hasRootLimit = false
+ }
+
if hasDiskLimits {
ourStart := false
More information about the lxc-devel
mailing list