!28 Account for pmspare grow when adjusting thinpool metadata size

From: @yanan-rock
Reviewed-by: @t_feng
Signed-off-by: @t_feng
This commit is contained in:
openeuler-ci-bot 2021-05-25 21:17:13 +08:00 committed by Gitee
commit 693ce3d331
2 changed files with 44 additions and 2 deletions

View File

@ -0,0 +1,36 @@
From 0004c2b86f5587aa4d159b2f99c66d0eba141b4f Mon Sep 17 00:00:00 2001
From: Vojtech Trefny <vtrefny@redhat.com>
Date: Wed, 19 Aug 2020 13:08:00 +0200
Subject: [PATCH] Account for pmspare grow when adjusting thinpool metadata
size
When making space for the bigger metadata we also need to make
extra space for pmspare because its size depends on the metadata
size.
Resolves: rhbz#1868623
---
blivet/devices/lvm.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/blivet/devices/lvm.py b/blivet/devices/lvm.py
index 38d050321..b003b7b46 100644
--- a/blivet/devices/lvm.py
+++ b/blivet/devices/lvm.py
@@ -1631,6 +1631,7 @@ def autoset_md_size(self, enforced=False):
log.debug("Using default chunk size: %s", self._chunk_size)
old_md_size = self._metadata_size
+ old_pmspare_size = self.vg.pmspare_size
self._metadata_size = Size(blockdev.lvm.get_thpool_meta_size(self._size,
self._chunk_size,
100)) # snapshots
@@ -1642,7 +1643,7 @@ def autoset_md_size(self, enforced=False):
if self._metadata_size == old_md_size:
log.debug("Rounded metadata size unchanged")
else:
- new_size = self.size - (self._metadata_size - old_md_size)
+ new_size = self.size - (self._metadata_size - old_md_size) - (self.vg.pmspare_size - old_pmspare_size)
log.debug("Adjusting size from %s MiB to %s MiB",
self.size.convert_to("MiB"), new_size.convert_to("MiB"))
self.size = new_size

View File

@ -3,7 +3,7 @@
Name: python-blivet
Version: 3.2.2
Release: 3
Release: 4
Epoch: 1
Summary: A python module for system storage configuration
License: LGPLv2+
@ -20,7 +20,7 @@ BuildRequires: python2-devel python2-setuptools
Patch0: 0001-force-lvm-plugin.patch
Patch1: Fix-name-resolution-for-MD-devices-and-partitions-on.patch
Patch9000: fix-the-long-hostname.patch
Patch6000: backport-Account-for-pmspare-grow-when-adjusting-thinpool-metadata.patch
%description
The python-blivet package is a python module for examining and modifying
@ -121,6 +121,12 @@ make PYTHON=%{__python2} DESTDIR=%{buildroot} install
%doc README
%changelog
* Tue May 25 2021 yanan <yanan@huawei.com> - 3.2.2-4
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:Account for pmspare grow when adjusting thinpool metadata
* Wed Nov 18 2020 gaihuiying <gaihuiying1@huawei.com> - 3.2.2-3
- Type:bugfix
- ID:NA