[blivet:master 18/21] Add TmpFS._resizefsUnit and use appropriately.

mulhern amulhern at redhat.com
Thu Jan 15 18:39:45 UTC 2015


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

diff --git a/blivet/formats/fs.py b/blivet/formats/fs.py
index b1172d1..9effed6 100644
--- a/blivet/formats/fs.py
+++ b/blivet/formats/fs.py
@@ -1526,6 +1526,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
@@ -1600,7 +1601,8 @@ class TmpFS(NoDevFS):
             :returns: size option
             :rtype: str
         """
-        return "size=%dm" % size.convertTo(MiB)
+        FMT = {KiB: "%dk", MiB: "%dm", GiB: "%dg"}[self._resizefsUnit]
+        return "size=%s" % (FMT % size.convertTo(self._resizefsUnit))
 
     def _getOptions(self):
         # if the size option string is defined,
-- 
1.9.3



More information about the anaconda-patches mailing list