Previously, if format's minSize was 0, then it returned self.size instead.
I think this was an error, and the intention was to fall back on self.size
only if format.minSize was not set.
Adds a test for minSize as well.
Signed-off-by: mulhern <amulhern(a)redhat.com>
---
blivet/devices.py | 10 ++++++++--
tests/devices_test.py | 1 +
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/blivet/devices.py b/blivet/devices.py
index 45305a9..f8bc836 100644
--- a/blivet/devices.py
+++ b/blivet/devices.py
@@ -880,8 +880,14 @@ class StorageDevice(Device):
@property
def minSize(self):
- """ The minimum size this device can be. """
- if self.format.minSize:
+ """ The minimum size this device can be. If the format's
minimum
+ size is set, then the underlying filesystem requires at least
+ that amount, so use that.
+
+ If the format's minimum size is not set, then fall back on
+ this device's size for the value.
+ """
+ if self.format.minSize is not None:
return self.format.minSize
else:
return self.size
diff --git a/tests/devices_test.py b/tests/devices_test.py
index b1e724e..f084adb 100644
--- a/tests/devices_test.py
+++ b/tests/devices_test.py
@@ -68,6 +68,7 @@ class MDRaidArrayDeviceTestCase(DeviceStateTestCase):
"mediaPresent" : self.assertFalse,
"metadataVersion" : lambda x, m: self.assertEqual(x,
"default", m),
"minor" : lambda x, m: self.assertEqual(x, 0, m),
+ "minSize" : lambda x, m: self.assertEqual(x, 0, m),
"parents" : lambda x, m: self.assertEqual(x, [], m),
"path" : lambda x, m: self.assertRegexpMatches(x, "^/dev",
m),
"partitionable" : self.assertFalse,
--
1.8.3.1