[blivet:master 07/11] Simplify FS.free().

mulhern amulhern at redhat.com
Tue Nov 25 23:22:43 UTC 2014


The 'exists' check is not necessary because currentSize itself checks 'exists'.
We believe that minSize will always be a Size during execution, so there's
no reason to make sure that it is with a guard.

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

diff --git a/blivet/formats/fs.py b/blivet/formats/fs.py
index 9b67838..aa6adf3 100644
--- a/blivet/formats/fs.py
+++ b/blivet/formats/fs.py
@@ -362,12 +362,10 @@ class FS(DeviceFormat):
 
     @property
     def free(self):
-        free = Size(0)
-        if self.exists:
-            if self.currentSize and self.minSize:
-                free = max(Size(0), self.currentSize - self.minSize)
-
-        return free
+        """ The amount of space that can be gained by resizing this
+            filesystem to its minimum size.
+        """
+        return max(Size(0), self.currentSize - self.minSize)
 
     def _getFormatOptions(self, options=None, do_labeling=False):
         """Get a list of format options to be used when creating the
-- 
1.9.3



More information about the anaconda-patches mailing list