You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
qubes-installer-qubes-os/blivet/0002-Do-not-run-FS-check-as...

85 lines
3.5 KiB

From 32ba44edfa5cd4424154396b877cd5ad75e8c999 Mon Sep 17 00:00:00 2001
From: Vratislav Podzimek <vpodzime@redhat.com>
Date: Tue, 22 Nov 2016 08:52:34 +0100
Subject: [PATCH 2/2] Do not run FS check as part of updating (re)size info
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
If the FS tools tell us the minimum size of the file system we are supposed to
(see rhbz#1170803) consider that an evidence of the file system being in a good
enough shape to be resized.
Resolves: rhbz#1170803
---
blivet/formats/fs.py | 44 ++++++++++++++++++--------------------------
1 file changed, 18 insertions(+), 26 deletions(-)
diff --git a/blivet/formats/fs.py b/blivet/formats/fs.py
index 203926e..100bfce 100644
--- a/blivet/formats/fs.py
+++ b/blivet/formats/fs.py
@@ -296,8 +296,6 @@ class FS(DeviceFormat):
""" Update this filesystem's current and minimum size (for resize). """
# This method ensures:
- # * If there are fsck errors, self._resizable is False.
- # Note that if there is no fsck program, no errors are possible.
# * If it is not possible to obtain the current size of the
# filesystem by interrogating the filesystem, self._resizable
# is False (and self._size is 0).
@@ -317,32 +315,26 @@ class FS(DeviceFormat):
self._min_instance_size = Size(0)
self._resizable = self.__class__._resizable
- # We can't allow resize if the filesystem has errors.
+ # try to gather current size info
+ self._size = Size(0)
try:
- self.do_check()
- except FSError:
+ if self._info.available:
+ self._current_info = self._info.do_task()
+ except FSError as e:
+ log.info("Failed to obtain info for device %s: %s", self.device, e)
+ try:
+ self._size = self._size_info.do_task()
+ except (FSError, NotImplementedError) as e:
+ log.warning("Failed to obtain current size for device %s: %s", self.device, e)
+ else:
+ self._min_instance_size = self._size
+
+ # We absolutely need a current size to enable resize. To shrink the
+ # filesystem we need a real minimum size provided by the resize
+ # tool. Failing that, we can default to the current size,
+ # effectively disabling shrink.
+ if self._size == Size(0):
self._resizable = False
- raise
- finally:
- # try to gather current size info anyway
- self._size = Size(0)
- try:
- if self._info.available:
- self._current_info = self._info.do_task()
- except FSError as e:
- log.info("Failed to obtain info for device %s: %s", self.device, e)
- try:
- self._size = self._size_info.do_task()
- self._min_instance_size = self._size
- except (FSError, NotImplementedError) as e:
- log.warning("Failed to obtain current size for device %s: %s", self.device, e)
-
- # We absolutely need a current size to enable resize. To shrink the
- # filesystem we need a real minimum size provided by the resize
- # tool. Failing that, we can default to the current size,
- # effectively disabling shrink.
- if self._size == Size(0):
- self._resizable = False
try:
result = self._minsize.do_task()
--
2.7.5