[lxc-devel] [lxd/master] containers_post: better error message

brauner on Github lxc-bot at linuxcontainers.org
Fri Mar 24 12:25:48 UTC 2017


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/20170324/8c08e18d/attachment.bin>
-------------- next part --------------
From 8cecb1a6b7c2b582b13476339c874b396e249c14 Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Fri, 24 Mar 2017 13:24:11 +0100
Subject: [PATCH] containers_post: better error message

Closes #3110.

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

diff --git a/lxd/containers_post.go b/lxd/containers_post.go
index 2db5f17..1fce235 100644
--- a/lxd/containers_post.go
+++ b/lxd/containers_post.go
@@ -223,10 +223,14 @@ func createFromMigration(d *Daemon, req *api.ContainersPost) Response {
 		}
 	}
 
+	shared.LogDebugf("No valid storage pool in the container's local root disk device and profiles found.")
 	// If there is just a single pool in the database, use that
 	if storagePool == "" {
 		pools, err := dbStoragePools(d.db)
 		if err != nil {
+			if err == NoSuchObjectError {
+				return BadRequest(fmt.Errorf("This LXD instance does not have any storage pools configured."))
+			}
 			return InternalError(err)
 		}
 


More information about the lxc-devel mailing list