[lxc-devel] [lxd/master] lxd/storage/drovers/driver/lvm/utils: Dont format block volumes with filesystem

tomponline on Github lxc-bot at linuxcontainers.org
Thu Feb 27 13:19:42 UTC 2020


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 363 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20200227/64032bae/attachment.bin>
-------------- next part --------------
From 8ebc4d2c2dc3f746716c31f370014707e54734da Mon Sep 17 00:00:00 2001
From: Thomas Parrott <thomas.parrott at canonical.com>
Date: Thu, 27 Feb 2020 13:18:43 +0000
Subject: [PATCH] lxd/storage/drovers/driver/lvm/utils: Dont format block
 volumes with filesystem

Signed-off-by: Thomas Parrott <thomas.parrott at canonical.com>
---
 lxd/storage/drivers/driver_lvm_utils.go | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/lxd/storage/drivers/driver_lvm_utils.go b/lxd/storage/drivers/driver_lvm_utils.go
index ea1999c18a..9bb00730c7 100644
--- a/lxd/storage/drivers/driver_lvm_utils.go
+++ b/lxd/storage/drivers/driver_lvm_utils.go
@@ -381,9 +381,12 @@ func (d *lvm) createLogicalVolume(vgName, thinPoolName string, vol Volume, makeT
 	}
 
 	volDevPath := d.lvmDevPath(vgName, vol.volType, vol.contentType, vol.name)
-	_, err = makeFSType(volDevPath, d.volumeFilesystem(vol), nil)
-	if err != nil {
-		return errors.Wrapf(err, "Error making filesystem on LVM logical volume")
+
+	if vol.contentType == ContentTypeFS {
+		_, err = makeFSType(volDevPath, d.volumeFilesystem(vol), nil)
+		if err != nil {
+			return errors.Wrapf(err, "Error making filesystem on LVM logical volume")
+		}
 	}
 
 	d.logger.Debug("Logical volume created", log.Ctx{"vg_name": vgName, "lv_name": lvFullName, "size": fmt.Sprintf("%db", lvSizeBytes), "fs": d.volumeFilesystem(vol)})


More information about the lxc-devel mailing list