[blivet:master 08/17] Add simple _sizeOption() method to TmpFS class.
mulhern
amulhern at redhat.com
Tue Jan 6 20:38:10 UTC 2015
Use where appropriate.
Signed-off-by: mulhern <amulhern at redhat.com>
---
blivet/formats/fs.py | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/blivet/formats/fs.py b/blivet/formats/fs.py
index 6112b4e..c34df53 100644
--- a/blivet/formats/fs.py
+++ b/blivet/formats/fs.py
@@ -1585,7 +1585,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(spec="MiB")
+ self._size_option = self._sizeOption(self._size)
else:
# if no size option is specified, the tmpfs mount size will be 50%
# of system RAM by default
@@ -1605,6 +1605,15 @@ class TmpFS(NoDevFS):
def mountable(self):
return True
+ def _sizeOption(self, size):
+ """ Returns a size option string appropriate for mounting tmpfs.
+
+ :param Size size: any size
+ :returns: size option
+ :rtype: str
+ """
+ return "size=%dm" % size.convertTo(spec="MiB")
+
def _getOptions(self):
# if the size option string is defined,
# append it to options
@@ -1660,7 +1669,9 @@ class TmpFS(NoDevFS):
# the mount command
# add the remount flag, size and any options
- remount_options = 'remount,size=%dm' % self.targetSize.convertTo(spec="MiB")
+ size_option = self._sizeOption(self.targetSize)
+ remount_options = "%s,%s" % ("remount", size_option)
+
# if any mount options are defined, append them
if self._options:
remount_options = "%s,%s" % (remount_options, self._options)
@@ -1680,7 +1691,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(spec="MiB")
+ self._size_option = self._sizeOption(self._size)
register_device_format(TmpFS)
--
1.9.3
More information about the anaconda-patches
mailing list