[lxc-devel] [lxd/master] storage pools: return useful error
brauner on Github
lxc-bot at linuxcontainers.org
Tue Feb 14 22:52:18 UTC 2017
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 364 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20170214/8c4698ef/attachment.bin>
-------------- next part --------------
From 30442c88580d18f2703862f414c3cfba713caf13 Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Tue, 14 Feb 2017 23:51:08 +0100
Subject: [PATCH] storage pools: return useful error
Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
lxd/storage_pools.go | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/lxd/storage_pools.go b/lxd/storage_pools.go
index 3d9db6b..f8f285e 100644
--- a/lxd/storage_pools.go
+++ b/lxd/storage_pools.go
@@ -82,10 +82,8 @@ func storagePoolsPost(d *Daemon, r *http.Request) Response {
// Check that the storage pool does not already exist.
_, err = dbStoragePoolGetID(d.db, req.Name)
- if err != nil {
- if err != NoSuchObjectError {
- return InternalError(err)
- }
+ if err == nil {
+ return BadRequest(fmt.Errorf("The storage pool already exists"))
}
// Make sure that we don't pass a nil to the next function.
More information about the lxc-devel
mailing list