[lxc-devel] [lxd/stable-3.0] lxd: fix starting container with missing optional disk

eraserix on Github lxc-bot at linuxcontainers.org
Thu Nov 15 16:18:30 UTC 2018


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 368 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20181115/2ddb6f7e/attachment.bin>
-------------- next part --------------
From 18e36a6a5807cf64341f2f901ee04c739ada442e Mon Sep 17 00:00:00 2001
From: Christoph Mathys <christoph.mathys at komaxgroup.com>
Date: Thu, 15 Nov 2018 17:10:23 +0100
Subject: [PATCH] lxd: fix starting container with missing optional disk

---
 lxd/container_lxc.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lxd/container_lxc.go b/lxd/container_lxc.go
index ef66bb393a..2fb053ac3e 100644
--- a/lxd/container_lxc.go
+++ b/lxd/container_lxc.go
@@ -1862,7 +1862,7 @@ func (c *containerLXC) startCommon() (string, error) {
 			// the storage volume, not the path where it is mounted.
 			// So do only check for the existence of m["source"]
 			// when m["pool"] is empty.
-			if m["pool"] == "" && m["source"] != "" && !shared.PathExists(shared.HostPath(m["source"])) {
+			if m["pool"] == "" && m["source"] != "" && !shared.PathExists(shared.HostPath(m["source"])) && !shared.IsTrue(m["optional"]) {
 				return "", fmt.Errorf("Missing source '%s' for disk '%s'", m["source"], name)
 			}
 		case "nic":


More information about the lxc-devel mailing list