[master 14/19] Change private name _resize to private name _resizeTask.
mulkieran
installerbot-noreply at redhat.com
Thu Jun 18 21:04:15 UTC 2015
From: mulhern <amulhern at redhat.com>
Related: #56
Preparatory to using _resize name for an internal resizing method.
Signed-off-by: mulhern <amulhern at redhat.com>
---
blivet/formats/fs.py | 20 ++++++++++----------
tests/formats_test/fs_test.py | 2 +-
tests/formats_test/fstesting.py | 8 ++++----
3 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/blivet/formats/fs.py b/blivet/formats/fs.py
index fb24243..c63f1f4 100644
--- a/blivet/formats/fs.py
+++ b/blivet/formats/fs.py
@@ -106,7 +106,7 @@ def __init__(self, **kwargs):
self._mkfs = self._mkfsClass(self)
self._mount = self._mountClass(self)
self._readlabel = self._readlabelClass(self)
- self._resize = self._resizeClass(self)
+ self._resizeTask = self._resizeClass(self)
self._sync = self._syncClass(self)
self._writelabel = self._writelabelClass(self)
@@ -127,7 +127,7 @@ def __init__(self, **kwargs):
# Resize operations are limited to error-free filesystems whose current
# size is known.
self._resizable = False
- if flags.installer_mode and self._resize.available:
+ if flags.installer_mode and self._resizeTask.available:
# if you want current/min size you have to call updateSizeInfo
try:
self.updateSizeInfo()
@@ -282,7 +282,7 @@ def _padSize(self, size):
# make sure the padded and rounded min size is not larger than
# the current size
- padded = min(padded.roundToNearest(self._resize.unit, rounding=ROUND_UP), self.currentSize)
+ padded = min(padded.roundToNearest(self._resizeTask.unit, rounding=ROUND_UP), self.currentSize)
return padded
@@ -341,7 +341,7 @@ def doResize(self):
if self.targetSize == self.currentSize:
return
- if not self._resize.available:
+ if not self._resizeTask.available:
return
# tmpfs mounts don't need an existing device node
@@ -367,7 +367,7 @@ def doResize(self):
# We always round down because the fs has to fit on whatever device
# contains it. To round up would risk quietly setting a target size too
# large for the device to hold.
- rounded = self.targetSize.roundToNearest(self._resize.unit,
+ rounded = self.targetSize.roundToNearest(self._resizeTask.unit,
rounding=ROUND_DOWN)
# 1. target size was between the min size and max size values prior to
@@ -388,13 +388,13 @@ def doResize(self):
# early.
if self.targetSize > self.currentSize and rounded < self.currentSize:
log.info("rounding target size down to next %s obviated resize of "
- "filesystem on %s", unitStr(self._resize.unit), self.device)
+ "filesystem on %s", unitStr(self._resizeTask.unit), self.device)
return
else:
self.targetSize = rounded
try:
- self._resize.doTask()
+ self._resizeTask.doTask()
except FSError as e:
raise FSResizeError(e, self.device)
@@ -639,7 +639,7 @@ def writeLabel(self):
@property
def utilsAvailable(self):
# we aren't checking for fsck because we shouldn't need it
- tasks = (self._mkfs, self._resize, self._writelabel, self._info)
+ tasks = (self._mkfs, self._resizeTask, self._writelabel, self._info)
return all(not t.implemented or t.available for t in tasks)
@property
@@ -662,7 +662,7 @@ def formattable(self):
@property
def resizable(self):
""" Can formats of this filesystem type be resized? """
- return super(FS, self).resizable and self._resize.available
+ return super(FS, self).resizable and self._resizeTask.available
def _getOptions(self):
return self.mountopts or ",".join(self._mount.options)
@@ -1178,7 +1178,7 @@ def _sizeOption(self, size):
This is not impossible, since a special option for mounting
is size=<percentage>%.
"""
- return "size=%s" % (self._resize.size_fmt % size.convertTo(self._resize.unit))
+ return "size=%s" % (self._resizeTask.size_fmt % size.convertTo(self._resizeTask.unit))
def _getOptions(self):
# Returns the regular mount options with the special size option,
diff --git a/tests/formats_test/fs_test.py b/tests/formats_test/fs_test.py
index 70216d3..e981408 100644
--- a/tests/formats_test/fs_test.py
+++ b/tests/formats_test/fs_test.py
@@ -122,7 +122,7 @@ def testResize(self):
newsize = self.an_fs.currentSize * 2
self.an_fs.targetSize = newsize
self.assertIsNone(self.an_fs.doResize())
- self.assertEqual(self.an_fs.size, newsize.roundToNearest(self.an_fs._resize.unit, rounding=ROUND_DOWN))
+ self.assertEqual(self.an_fs.size, newsize.roundToNearest(self.an_fs._resizeTask.unit, rounding=ROUND_DOWN))
def testShrink(self):
# Can not shrink tmpfs, because its minimum size is its current size
diff --git a/tests/formats_test/fstesting.py b/tests/formats_test/fstesting.py
index fd205f2..bf654f8 100644
--- a/tests/formats_test/fstesting.py
+++ b/tests/formats_test/fstesting.py
@@ -16,7 +16,7 @@ def can_resize(an_fs):
:param an_fs: a filesystem object
"""
- resize_tasks = (an_fs._resize, an_fs._sizeinfo, an_fs._minsize)
+ resize_tasks = (an_fs._resizeTask, an_fs._sizeinfo, an_fs._minsize)
return not any(t.availabilityErrors for t in resize_tasks)
@add_metaclass(abc.ABCMeta)
@@ -209,7 +209,7 @@ def testResize(self):
self.assertEqual(an_fs.targetSize, TARGET_SIZE)
self.assertNotEqual(an_fs._size, TARGET_SIZE)
self.assertIsNone(an_fs.doResize())
- ACTUAL_SIZE = TARGET_SIZE.roundToNearest(an_fs._resize.unit, rounding=ROUND_DOWN)
+ ACTUAL_SIZE = TARGET_SIZE.roundToNearest(an_fs._resizeTask.unit, rounding=ROUND_DOWN)
self.assertEqual(an_fs.size, ACTUAL_SIZE)
self.assertEqual(an_fs._size, ACTUAL_SIZE)
self._test_sizes(an_fs)
@@ -294,7 +294,7 @@ def testShrink(self):
if isinstance(an_fs, fs.NTFS):
return
self.assertIsNone(an_fs.doResize())
- ACTUAL_SIZE = TARGET_SIZE.roundToNearest(an_fs._resize.unit, rounding=ROUND_DOWN)
+ ACTUAL_SIZE = TARGET_SIZE.roundToNearest(an_fs._resizeTask.unit, rounding=ROUND_DOWN)
self.assertEqual(an_fs._size, ACTUAL_SIZE)
self._test_sizes(an_fs)
@@ -357,7 +357,7 @@ def testTooBig2(self):
# CHECKME: size and target size will be adjusted attempted values
# while currentSize will be actual value
- TARGET_SIZE = BIG_SIZE.roundToNearest(an_fs._resize.unit, rounding=ROUND_DOWN)
+ TARGET_SIZE = BIG_SIZE.roundToNearest(an_fs._resizeTask.unit, rounding=ROUND_DOWN)
self.assertEqual(an_fs.targetSize, TARGET_SIZE)
self.assertEqual(an_fs.size, an_fs.targetSize)
self.assertEqual(an_fs.currentSize, old_size)
--
To view this commit on github, visit https://github.com/rhinstaller/blivet/commit/9809a742cfbfe7884615016926f9d80c5f0f507f
More information about the anaconda-patches
mailing list