[lxc-devel] [lxd/master] lxd/storage/drivers/ceph: Fix volume deletion

monstermunchkin on Github lxc-bot at linuxcontainers.org
Mon Aug 10 08:18:57 UTC 2020


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 472 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20200810/91b03db1/attachment-0001.bin>
-------------- next part --------------
From aa36d5e1b5ddb740635240504b8c562f637883c9 Mon Sep 17 00:00:00 2001
From: Thomas Hipp <thomas.hipp at canonical.com>
Date: Mon, 10 Aug 2020 10:13:48 +0200
Subject: [PATCH] lxd/storage/drivers/ceph: Fix volume deletion

This fixes a bug in which deleting a volume with snapshots would only
delete the snapshots, not the volume itself.

Signed-off-by: Thomas Hipp <thomas.hipp at canonical.com>
---
 lxd/storage/drivers/driver_ceph_utils.go | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/lxd/storage/drivers/driver_ceph_utils.go b/lxd/storage/drivers/driver_ceph_utils.go
index 6c399b48a2..f58a6b1ffd 100644
--- a/lxd/storage/drivers/driver_ceph_utils.go
+++ b/lxd/storage/drivers/driver_ceph_utils.go
@@ -621,6 +621,12 @@ func (d *ceph) deleteVolume(vol Volume) (int, error) {
 			}
 
 			return 1, nil
+		} else if zombies == 0 {
+			// Delete.
+			err = d.rbdDeleteVolume(vol)
+			if err != nil {
+				return -1, err
+			}
 		}
 	} else {
 		if err != db.ErrNoSuchObject {


More information about the lxc-devel mailing list