python-blivet/0002-Do-not-try-to-normaliz...

34 lines
1.2 KiB
Diff

From 8b76e2d72cca787747a2c639edbdfa0af28f9878 Mon Sep 17 00:00:00 2001
From: Vojtech Trefny <vtrefny@redhat.com>
Date: Fri, 23 Aug 2019 09:47:32 +0200
Subject: [PATCH] Do not try to normalize size for zero size device factories
Factories with zero size are special cases for adjusting container
size after removing a device for it. We don't want to change size
of the factory in this case.
The recent change of filesystem minimal size to 2 MiB resulted
in changing of size of these factories from 0 to 2 MiB which
caused the "adjusting factory" to create a new LV after removing
one from the container.
Resolves: rhbz#1743753
---
blivet/devicefactory.py | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/blivet/devicefactory.py b/blivet/devicefactory.py
index e910c5bd..0eb548c7 100644
--- a/blivet/devicefactory.py
+++ b/blivet/devicefactory.py
@@ -462,6 +462,10 @@ def _get_free_disk_space(self):
def _normalize_size(self):
if self.size is None:
self._handle_no_size()
+ elif self.size == Size(0):
+ # zero size means we're adjusting the container after removing
+ # a device from it so we don't want to change the size here
+ return
size = self.size
fmt = get_format(self.fstype)