This prevents repeated on-demand setup/teardown of devices to determine minimum size. --- storage/devices.py | 18 +++++++++++++----- 1 files changed, 13 insertions(+), 5 deletions(-) diff --git a/storage/devices.py b/storage/devices.py index f5f1200..daceb32 100644 --- a/storage/devices.py +++ b/storage/devices.py @@ -410,6 +410,7 @@ class StorageDevice(Device): self.format = format self.fstabComment = "" self._targetSize = self._size + self._minSize = 0 self._partedDevice = None @@ -567,13 +568,15 @@ class StorageDevice(Device): @property def minSize(self): """ The minimum size this device can be. """ - if self.exists: + if self._minSize: + return self._minSize + + if self.exists and not self.status: self.setup() - if self.format.minSize: - return self.format.minSize - else: - return self.size + size = self.format.minSize + if not size: + size = self.size @property def maxSize(self): @@ -1442,6 +1445,7 @@ class LUKSDevice(DMCryptDevice): # we always probe since the device may not be set up when we want # information about it self._size = self.currentSize + self._minSize = self.minSize def teardown(self, recursive=False): """ Close, or tear down, a device. """ @@ -1949,6 +1953,7 @@ class LVMLogicalVolumeDevice(DMDevice): # we always probe since the device may not be set up when we want # information about it self._size = self.currentSize + self._minSize = self.minSize def teardown(self, recursive=None): """ Close, or tear down, a device. """ @@ -2231,6 +2236,7 @@ class MDRaidArrayDevice(StorageDevice): # we always probe since the device may not be set up when we want # information about it self._size = self.currentSize + self._minSize = self.minSize def _removeDevice(self, device): """ Remove a component device from the array. @@ -2312,6 +2318,7 @@ class MDRaidArrayDevice(StorageDevice): # we always probe since the device may not be set up when we want # information about it self._size = self.currentSize + self._minSize = self.minSize def teardown(self, recursive=None): """ Close, or tear down, a device. """ @@ -2491,6 +2498,7 @@ class DMRaidArrayDevice(DiskDevice): # we always probe since the device may not be set up when we want # information about it self._size = self.currentSize + self._minSize = self.minSize class MultipathDevice(DMDevice): -- 1.6.0.6 _______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/anaconda-devel-list