[blivet:master 18/20] Add _resizefsUnit to TmpFS and use in appropriate places.

mulhern amulhern at redhat.com
Tue Dec 23 23:42:31 UTC 2014


Does not change behavior, just replaces a literal with an already defined
constant.

TmpFS has no method for obtaining the minimum size, so in blivet's current
state it is not resizable.

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

diff --git a/blivet/formats/fs.py b/blivet/formats/fs.py
index 6de4f6f..908364f 100644
--- a/blivet/formats/fs.py
+++ b/blivet/formats/fs.py
@@ -1556,6 +1556,7 @@ class TmpFS(NoDevFS):
     # remounting can be used to change
     # the size of a live tmpfs mount
     _resizefs = "mount"
+    _resizefsUnit = MiB
     # as tmpfs is part of the Linux kernel,
     # it is Linux-native
     _linuxNative = True
@@ -1593,7 +1594,7 @@ class TmpFS(NoDevFS):
             self._options = fsoptions
         if self._size:
             # absolute size for the tmpfs mount has been specified
-            self._size_option = "size=%dm" % self._size.convertTo(MiB)
+            self._size_option = "size=%dm" % self._size.convertTo(self._resizefsUnit)
         else:
             # if no size option is specified, the tmpfs mount size will be 50%
             # of system RAM by default
@@ -1675,7 +1676,7 @@ class TmpFS(NoDevFS):
         # the mount command
 
         # add the remount flag, size and any options
-        remount_options = 'remount,size=%dm' % self.targetSize.convertTo(MiB)
+        remount_options = 'remount,size=%dm' % self.targetSize.convertTo(self._resizefsUnit)
         # if any mount options are defined, append them
         if self._options:
             remount_options = "%s,%s" % (remount_options, self._options)
@@ -1695,7 +1696,7 @@ class TmpFS(NoDevFS):
             # update the size option string
             # -> please note that resizing always sets the
             # size of this tmpfs mount to an absolute value
-            self._size_option = "size=%dm" % self._size.convertTo(MiB)
+            self._size_option = "size=%dm" % self._size.convertTo(self._resizefsUnit)
 
 register_device_format(TmpFS)
 
-- 
1.9.3



More information about the anaconda-patches mailing list