[PATCH 01/13] Let users set the size property of StorageDevices.

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

 



For resize operations, we need the ability to set a new size for
the StorageDevice before performing the resize.

Raise DeviceError exception if newsize > maxSize
---
 storage/devices.py |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/storage/devices.py b/storage/devices.py
index 39ffcf7..de18113 100644
--- a/storage/devices.py
+++ b/storage/devices.py
@@ -587,11 +587,13 @@ class StorageDevice(Device):
 
     def _setSize(self, newsize):
         """ Set the device's size to a new value. """
-        # FIXME: this should involve some verification
+        if newsize > self.maxSize():
+            raise DeviceError("device cannot be larger than %s MB" %
+                              (self.maxSize(),))
         self._size = newsize
 
     size = property(lambda x: x._getSize(),
-                    #lambda x, y: x._setSize(y),
+                    lambda x, y: x._setSize(y),
                     doc="The device's size, accounting for pending changes")
 
     @property
-- 
1.6.2

_______________________________________________
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