[lxc-devel] [lxd/master] Storage: Support non-default project in storagePoolDelete

tomponline on Github lxc-bot at linuxcontainers.org
Mon Jan 13 13:50:08 UTC 2020


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 573 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20200113/90c616ca/attachment.bin>
-------------- next part --------------
From 36ca886d7bb821ad1b2c6aa2a7fd7311fbd1d077 Mon Sep 17 00:00:00 2001
From: Thomas Parrott <thomas.parrott at canonical.com>
Date: Mon, 13 Jan 2020 13:47:15 +0000
Subject: [PATCH] lxd/storage/pools: Support non-default project in
 storagePoolDelete

This allows storage pools that have *all* volumes in a non-default project to be deleted.

Note: This still does not allow storage pools that have a mixture of volumes from different projects to be deleted.

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

diff --git a/lxd/storage_pools.go b/lxd/storage_pools.go
index 472746dc4c..5249d95ad8 100644
--- a/lxd/storage_pools.go
+++ b/lxd/storage_pools.go
@@ -574,12 +574,13 @@ func storagePoolDelete(d *Daemon, r *http.Request) response.Response {
 		// Only delete images if locally stored or running on initial member.
 		if !isClusterNotification(r) || !pool.Driver().Info().Remote {
 			for _, volume := range volumeNames {
-				_, imgInfo, err := d.cluster.ImageGet("default", volume, false, false)
+				_, imgInfo, err := d.cluster.ImageGet(projectParam(r), volume, false, false)
 				if err != nil {
 					return response.InternalError(err)
 				}
 
 				err = doDeleteImageFromPool(d.State(), imgInfo.Fingerprint, poolName)
+
 				if err != nil {
 					return response.InternalError(err)
 				}
@@ -613,7 +614,7 @@ func storagePoolDelete(d *Daemon, r *http.Request) response.Response {
 		}
 
 		for _, volume := range volumeNames {
-			_, imgInfo, err := d.cluster.ImageGet("default", volume, false, false)
+			_, imgInfo, err := d.cluster.ImageGet(projectParam(r), volume, false, false)
 			if err != nil {
 				return response.InternalError(err)
 			}


More information about the lxc-devel mailing list