The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/6794

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 deleting images, some drivers need to know the config in order to
handle zombie volumes properly.

Signed-off-by: Thomas Hipp <thomas.h...@canonical.com>
From 056d48b6aaee68405ad916291406b285f3fa738e Mon Sep 17 00:00:00 2001
From: Thomas Hipp <thomas.h...@canonical.com>
Date: Tue, 28 Jan 2020 14:25:50 +0100
Subject: [PATCH] lxd/storage: Pass config when deleting images

When deleting images, some drivers need to know the config in order to
handle zombie volumes properly.

Signed-off-by: Thomas Hipp <thomas.h...@canonical.com>
---
 lxd/storage/backend_lxd.go | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/lxd/storage/backend_lxd.go b/lxd/storage/backend_lxd.go
index 82180a3b88..0ef9fb0c49 100644
--- a/lxd/storage/backend_lxd.go
+++ b/lxd/storage/backend_lxd.go
@@ -1997,7 +1997,14 @@ func (b *lxdBackend) DeleteImage(fingerprint string, op 
*operations.Operation) e
                contentType = drivers.ContentTypeBlock
        }
 
-       vol := b.newVolume(drivers.VolumeTypeImage, contentType, fingerprint, 
nil)
+       // Load the storage volume in order to get the volume config which is 
needed
+       // for some drivers.
+       _, storageVol, err := 
b.state.Cluster.StoragePoolNodeVolumeGetType(fingerprint, 
db.StoragePoolVolumeTypeImage, b.ID())
+       if err != nil {
+               return err
+       }
+
+       vol := b.newVolume(drivers.VolumeTypeImage, contentType, fingerprint, 
storageVol.Config)
 
        err = b.driver.DeleteVolume(vol, op)
        if err != nil {
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to