[lxc-devel] [lxd/master] Storage: Don't remove empty LVM thinpool and volume group if lvm.vg.force_reuse enabled

tomponline on Github lxc-bot at linuxcontainers.org
Mon Oct 12 16:45:48 UTC 2020


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 361 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20201012/9b1070bd/attachment.bin>
-------------- next part --------------
From 54922c2dd5ef61454df93b4535f6c6d4be0f42ce Mon Sep 17 00:00:00 2001
From: Thomas Parrott <thomas.parrott at canonical.com>
Date: Mon, 12 Oct 2020 17:43:48 +0100
Subject: [PATCH] lxd/storage/drivers/driver/lvm: Don't remove empty thinpool
 and volume group if lvm.vg.force_reuse enabled

Signed-off-by: Thomas Parrott <thomas.parrott at canonical.com>
---
 lxd/storage/drivers/driver_lvm.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lxd/storage/drivers/driver_lvm.go b/lxd/storage/drivers/driver_lvm.go
index f68d537cd8..cda510284f 100644
--- a/lxd/storage/drivers/driver_lvm.go
+++ b/lxd/storage/drivers/driver_lvm.go
@@ -333,7 +333,7 @@ func (d *lvm) Delete(op *operations.Operation) error {
 	}
 
 	removeVg := false
-	if vgExists {
+	if vgExists && !shared.IsTrue(d.config["lvm.vg.force_reuse"]) {
 		// Count normal and thin volumes.
 		lvCount, err := d.countLogicalVolumes(d.config["lvm.vg_name"])
 		if err != nil && err != errLVMNotFound {


More information about the lxc-devel mailing list