[lxc-devel] [lxd/master] Bugfixes

stgraber on Github lxc-bot at linuxcontainers.org
Thu Feb 23 22:42:00 UTC 2017


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/20170223/ae1fbd7c/attachment.bin>
-------------- next part --------------
From da387d5883b02fec56bc6067170577a6b3a200c7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Thu, 23 Feb 2017 02:32:41 -0500
Subject: [PATCH 1/2] tests: Define the base LVM volume as 25MB too
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>
---
 test/backends/lvm.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/backends/lvm.sh b/test/backends/lvm.sh
index 3799acd..d51d60a 100644
--- a/test/backends/lvm.sh
+++ b/test/backends/lvm.sh
@@ -31,7 +31,7 @@ lvm_configure() {
 
   echo "==> Configuring lvm backend in ${LXD_DIR}"
 
-  lxc storage create "lxdtest-$(basename "${LXD_DIR}")" lvm source="$(cat "${TEST_DIR}/$(basename "${LXD_DIR}").lvm.vg")" volume.size=10MB
+  lxc storage create "lxdtest-$(basename "${LXD_DIR}")" lvm source="$(cat "${TEST_DIR}/$(basename "${LXD_DIR}").lvm.vg")" volume.size=25MB
   lxc profile device add default root disk path="/" pool="lxdtest-$(basename "${LXD_DIR}")"
 }
 

From c9f2da84c7683de1bd16cf2b2f3fa9f43f2f48a8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Thu, 23 Feb 2017 17:30:06 -0500
Subject: [PATCH 2/2] Add extra validation for unix-block/unix-char
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Closes #2941

Signed-off-by: St├ęphane Graber <stgraber at ubuntu.com>
---
 lxd/container.go | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/lxd/container.go b/lxd/container.go
index 0cc4e51..9b402da 100644
--- a/lxd/container.go
+++ b/lxd/container.go
@@ -326,6 +326,25 @@ func containerValidDevices(devices types.Devices, profile bool, expanded bool) e
 			if m["path"] == "" {
 				return fmt.Errorf("Unix device entry is missing the required \"path\" property.")
 			}
+
+			if m["major"] == "" || m["minor"] == "" {
+				if !shared.PathExists(m["path"]) {
+					return fmt.Errorf("The device path doesn't exist on the host and major/minor wasn't specified.")
+				}
+
+				dType, _, _, err := deviceGetAttributes(m["path"])
+				if err != nil {
+					return err
+				}
+
+				if m["type"] == "unix-char" && dType != "c" {
+					return fmt.Errorf("Path specified for unix-char device is a block device.")
+				}
+
+				if m["type"] == "unix-block" && dType != "b" {
+					return fmt.Errorf("Path specified for unix-block device is a character device.")
+				}
+			}
 		} else if m["type"] == "usb" {
 			if m["vendorid"] == "" {
 				return fmt.Errorf("Missing vendorid for USB device.")


More information about the lxc-devel mailing list