[master 24/30] Cache result returned by getFSInfo in _current_info attribute.

mulkieran installerbot-noreply at redhat.com
Wed Mar 25 22:48:02 UTC 2015


From: mulhern <amulhern at redhat.com>

Signed-off-by: mulhern <amulhern at redhat.com>
---
 blivet/formats/fs.py | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/blivet/formats/fs.py b/blivet/formats/fs.py
index 03cce99..7fc93ae 100644
--- a/blivet/formats/fs.py
+++ b/blivet/formats/fs.py
@@ -110,6 +110,8 @@ def getTaskObject(klass):
         self._sync = getTaskObject(self._syncClass)
         self._writelabel = getTaskObject(self._writelabelClass)
 
+        self._current_info = None # info obtained by _info task
+
         self.mountpoint = kwargs.get("mountpoint")
         self.mountopts = kwargs.get("mountopts")
         self.label = kwargs.get("label")
@@ -243,8 +245,8 @@ def updateSizeInfo(self):
             errors = False
         finally:
             # try to gather current size info anyway
-            info = self._getFSInfo()
-            self._size = self._getExistingSize(info=info)
+            self._current_info = self._getFSInfo()
+            self._size = self._getExistingSize(info=self._current_info)
             self._minSize = self._size # default to current size
             # We absolutely need a current size to enable resize. To shrink the
             # filesystem we need a real minimum size provided by the resize
@@ -253,7 +255,7 @@ def updateSizeInfo(self):
             if errors or self._size == Size(0):
                 self._resizable = False
 
-        self._getMinSize(info=info)   # force calculation of minimum size
+        self._getMinSize(info=self._current_info)   # force calculation of minimum size
 
     def _getMinSize(self, info=None):
         pass


-- 
To view this commit on github, visit https://github.com/rhinstaller/blivet/commit/dd4aee643b5d02958d2f9032f8556aa245c91d17


More information about the anaconda-patches mailing list