[lxc-devel] [lxd/master] Storage: LVM CreateVolumeFromCopy only set volume size when source is image
tomponline on Github
lxc-bot at linuxcontainers.org
Wed Apr 29 14:59:17 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/20200429/a80f2997/attachment.bin>
-------------- next part --------------
From 99e8ccd62f22fdc36f0f6535cd1f76cfe01f9aca Mon Sep 17 00:00:00 2001
From: Thomas Parrott <thomas.parrott at canonical.com>
Date: Wed, 29 Apr 2020 15:58:21 +0100
Subject: [PATCH] lxd/storage/drivers/driver/lvm/volumes: CreateVolumeFromCopy
only set volume size when source is image
Signed-off-by: Thomas Parrott <thomas.parrott at canonical.com>
---
lxd/storage/drivers/driver_lvm_utils.go | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/lxd/storage/drivers/driver_lvm_utils.go b/lxd/storage/drivers/driver_lvm_utils.go
index 22ddb710be..f749e1e980 100644
--- a/lxd/storage/drivers/driver_lvm_utils.go
+++ b/lxd/storage/drivers/driver_lvm_utils.go
@@ -650,10 +650,12 @@ func (d *lvm) copyThinpoolVolume(vol, srcVol Volume, srcSnapshots []Volume, refr
}
}
- // Resize the new volume and filesystem to the correct size.
- err = d.SetVolumeQuota(vol, d.volumeSize(vol), nil)
- if err != nil {
- return err
+ // Resize the new volume and filesystem to the correct size if the source was an image.
+ if srcVol.volType == VolumeTypeImage {
+ err = d.SetVolumeQuota(vol, d.volumeSize(vol), nil)
+ if err != nil {
+ return err
+ }
}
// Finally clean up original volumes left that were renamed with a tmpVolSuffix suffix.
More information about the lxc-devel
mailing list