[lxc-devel] [lxd/master] container_lxc: fix optional property for disk devs

brauner on Github lxc-bot at linuxcontainers.org
Tue May 8 10:04:11 UTC 2018


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 381 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20180508/3eac2984/attachment.bin>
-------------- next part --------------
From cea6cf4a14e41a171ff4e92c86aa85024438a826 Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Tue, 8 May 2018 11:58:45 +0200
Subject: [PATCH] container_lxc: fix optional property for disk devs

Closes #4538.

Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
 lxd/container_lxc.go | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lxd/container_lxc.go b/lxd/container_lxc.go
index 26376e62e..7b49ca2ec 100644
--- a/lxd/container_lxc.go
+++ b/lxd/container_lxc.go
@@ -7527,6 +7527,10 @@ func (c *containerLXC) insertDiskDevice(name string, m types.Device) error {
 		return fmt.Errorf("Failed to setup device: %s", err)
 	}
 
+	if devPath == "" && shared.IsTrue(m["optional"]) {
+		return nil
+	}
+
 	flags := syscall.MS_BIND
 	if isRecursive {
 		flags |= syscall.MS_REC


More information about the lxc-devel mailing list