On Sun, 2009-04-05 at 11:54 +0200, Hans de Goede wrote: > See my comments below. Likewise.. > > On 04/04/2009 07:11 AM, David Lehman wrote: > > 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 > > > > Seems to be missing a return size, also why all the > self._minSize = self.minSize It should be return the size. > > Statements below, why not just set self._minSize at the > end of the minSize getter? The only reason I did all that was because I wasn't sure how else to trigger it. I could probably just call it as a method. > > Also note that due to the > > > + if self._minSize: > > + return self._minSize > > At the beginning of the getter, the rest will be done > only once, and I'm not sure if that is what you want. That is exactly what I was after -- when we are populating the 'edit logical volume' dialog, we check the minSize attribute, which causes us to active the lv, mount the filesystem, obtain the minimum size. Without this patch we do this every time. Dave > > > > > > @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): > > Regards, > > Hans > > _______________________________________________ > Anaconda-devel-list mailing list > Anaconda-devel-list@xxxxxxxxxx > https://www.redhat.com/mailman/listinfo/anaconda-devel-list _______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/anaconda-devel-list