[lxc-devel] [lxd/master] Storage: Gives clear error message when trying to create duplicate storage pool in single node

tomponline on Github lxc-bot at linuxcontainers.org
Wed Oct 7 15:49:08 UTC 2020


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 497 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20201007/fc785570/attachment.bin>
-------------- next part --------------
From 2983af787e86c2e8d42d9f55ae0b9d5ae198f55f Mon Sep 17 00:00:00 2001
From: Thomas Parrott <thomas.parrott at canonical.com>
Date: Wed, 7 Oct 2020 16:47:24 +0100
Subject: [PATCH] lxd/storage/pools: Gives clear error message when trying to
 create duplicate storage pool in single node

Previously it errored with: `Error: Pool not defined on nodes: none`

As was falling through into cluster storage pool setup mode.

Signed-off-by: Thomas Parrott <thomas.parrott at canonical.com>
---
 lxd/storage_pools.go | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lxd/storage_pools.go b/lxd/storage_pools.go
index b24443404b..01ce07e034 100644
--- a/lxd/storage_pools.go
+++ b/lxd/storage_pools.go
@@ -159,6 +159,8 @@ func storagePoolsPost(d *Daemon, r *http.Request) response.Response {
 				}
 				return resp
 			}
+
+			return response.BadRequest(fmt.Errorf("The storage pool already exists"))
 		}
 
 		// No targetNode was specified and we're clustered, so finalize the


More information about the lxc-devel mailing list