[lxc-devel] [lxd/master] Don't block resolution on non-existing paths

stgraber on Github lxc-bot at linuxcontainers.org
Thu Jan 26 18:26:45 UTC 2017


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 354 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20170126/05ad2169/attachment.bin>
-------------- next part --------------
From 3fa389d0dcfb5ccad088bbbdd9d1e1eedc662acc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Thu, 26 Jan 2017 13:25:54 -0500
Subject: [PATCH] Don't block resolution on non-existing paths
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 | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lxd/container_lxc.go b/lxd/container_lxc.go
index 1108e00..631ebfd 100644
--- a/lxd/container_lxc.go
+++ b/lxd/container_lxc.go
@@ -5925,6 +5925,11 @@ func (c *containerLXC) getDiskLimits() (map[string]deviceBlockLimit, error) {
 			source = c.RootfsPath()
 		}
 
+		// Don't try to resolve the block device behind a non-existing path
+		if !shared.PathExists(source) {
+			continue
+		}
+
 		// Get the backing block devices (major:minor)
 		blocks, err := deviceGetParentBlocks(source)
 		if err != nil {


More information about the lxc-devel mailing list