[lxc-devel] [lxd/master] lxd/patches: Fix LVM VG name

stgraber on Github lxc-bot at linuxcontainers.org
Mon Apr 8 20:02:23 UTC 2019


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 370 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20190408/5a3b4e8c/attachment.bin>
-------------- next part --------------
From d8cbd48d66040ad97dd9646898c7071c6784e2ef Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Mon, 8 Apr 2019 16:01:55 -0400
Subject: [PATCH] lxd/patches: Fix LVM VG name
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Closes #5643

Signed-off-by: St├ęphane Graber <stgraber at ubuntu.com>
---
 lxd/patches.go | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/lxd/patches.go b/lxd/patches.go
index a1d5e932a7..d6cf113466 100644
--- a/lxd/patches.go
+++ b/lxd/patches.go
@@ -146,9 +146,14 @@ func patchRenameCustomVolumeLVs(name string, d *Daemon) error {
 			return err
 		}
 
+		vgName := poolName
+		if pool.Config["lvm.vg_name"] != "" {
+			vgName = pool.Config["lvm.vg_name"]
+		}
+
 		for _, volume := range volumes {
-			oldName := fmt.Sprintf("%s/custom_%s", poolName, volume)
-			newName := fmt.Sprintf("%s/custom_%s", poolName, containerNameToLVName(volume))
+			oldName := fmt.Sprintf("%s/custom_%s", vgName, volume)
+			newName := fmt.Sprintf("%s/custom_%s", vgName, containerNameToLVName(volume))
 
 			exists, err := storageLVExists(newName)
 			if err != nil {
@@ -159,7 +164,7 @@ func patchRenameCustomVolumeLVs(name string, d *Daemon) error {
 				continue
 			}
 
-			err = lvmLVRename(poolName, oldName, newName)
+			err = lvmLVRename(vgName, oldName, newName)
 			if err != nil {
 				return err
 			}


More information about the lxc-devel mailing list