Re: [PATCH] Determine minimum device/format size on first setup.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



See my comments below.

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

Statements below, why not just set self._minSize at the
end of the minSize getter?

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.




      @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

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux