The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/7402
This e-mail was sent by the LXC bot, direct replies will not reach the author unless they happen to be subscribed to this list. === Description (from pull-request) === When a storage pool has image volumes in the database but the image record itself has been deleted, trying to delete the storage pool results in cryptic "not found" errors. This improves the context of the errors. Signed-off-by: Thomas Parrott <thomas.parr...@canonical.com>
From cf5900aec46790458d2631d0b711d74883a63faa Mon Sep 17 00:00:00 2001 From: Thomas Parrott <thomas.parr...@canonical.com> Date: Thu, 21 May 2020 09:00:33 +0100 Subject: [PATCH] lxd/storage/pools: Improves delete pool error info When a storage pool has image volumes in the database but the image record itself has been deleted, trying to delete the storage pool results in cryptic "not found" errors. This improves the context of the errors. Signed-off-by: Thomas Parrott <thomas.parr...@canonical.com> --- lxd/storage_pools.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lxd/storage_pools.go b/lxd/storage_pools.go index ca4a838e1a..6241441bbc 100644 --- a/lxd/storage_pools.go +++ b/lxd/storage_pools.go @@ -8,6 +8,7 @@ import ( "sync" "github.com/gorilla/mux" + "github.com/pkg/errors" lxd "github.com/lxc/lxd/client" "github.com/lxc/lxd/lxd/cluster" @@ -557,8 +558,7 @@ func storagePoolDelete(d *Daemon, r *http.Request) response.Response { } } - // Check if the pool is pending, if so we just need to delete it from - // the database. + // Check if the pool is pending, if so we just need to delete it from the database. _, dbPool, err := d.cluster.GetStoragePool(poolName) if err != nil { return response.SmartError(err) @@ -579,7 +579,7 @@ func storagePoolDelete(d *Daemon, r *http.Request) response.Response { pool, err := storagePools.GetPoolByName(d.State(), poolName) if err != nil { - return response.InternalError(err) + return response.InternalError(errors.Wrapf(err, "Error loading pool %q", poolName)) } // Only delete images if locally stored or running on initial member. @@ -587,12 +587,12 @@ func storagePoolDelete(d *Daemon, r *http.Request) response.Response { for _, volume := range volumeNames { _, imgInfo, err := d.cluster.GetImage(projectParam(r), volume, false, false) if err != nil { - return response.InternalError(err) + return response.InternalError(errors.Wrapf(err, "Failed getting image info for %q", volume)) } err = doDeleteImageFromPool(d.State(), imgInfo.Fingerprint, poolName) if err != nil { - return response.InternalError(err) + return response.InternalError(errors.Wrapf(err, "Error deleting image %q from pool", volume)) } } }
_______________________________________________ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel