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

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) ===
Signed-off-by: Stéphane Graber <stgra...@ubuntu.com>
From 83cbe4880b3578be47e7c29da2b4ca0b1039136d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgra...@ubuntu.com>
Date: Thu, 25 Jun 2020 15:35:02 -0400
Subject: [PATCH] lxd/storage: Better handle broken volumes
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Stéphane Graber <stgra...@ubuntu.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 2a2cb7873d..037648d86d 100644
--- a/lxd/storage/backend_lxd.go
+++ b/lxd/storage/backend_lxd.go
@@ -2071,7 +2071,14 @@ func (b *lxdBackend) EnsureImage(fingerprint string, op 
*operations.Operation) e
 
        // Check if we already have a suitable volume on storage device.
        if b.driver.HasVolume(imgVol) {
-               return nil
+               if imgDBVol != nil {
+                       // We already have a valid volume, just return.
+                       return nil
+               }
+
+               // We somehow have an unrecorded on-disk volume, assume it's a 
partial unpack and delete it.
+               logger.Warn("Deleting leftover/partially unpacked image volume")
+               b.driver.DeleteVolume(imgVol, op)
        }
 
        volFiller := drivers.VolumeFiller{
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to