[PATCH 3/4] Make sure new values of targetSize are within bounds.
David Lehman
dlehman at redhat.com
Tue Nov 12 17:44:28 UTC 2013
---
blivet/devices.py | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/blivet/devices.py b/blivet/devices.py
index bc614bd..9564b05 100644
--- a/blivet/devices.py
+++ b/blivet/devices.py
@@ -599,6 +599,11 @@ class StorageDevice(Device):
return self._targetSize
def _setTargetSize(self, newsize):
+ if newsize > self.maxSize:
+ log.error("requested size %s is larger than maximum %s",
+ newsize, self.maxSize)
+ raise ValueError("size is larger than the maximum for this device")
+
self._targetSize = newsize
targetSize = property(lambda s: s._getTargetSize(),
@@ -1257,7 +1262,7 @@ class PartitionDevice(StorageDevice):
if newsize != self.currentSize:
# change this partition's geometry in-memory so that other
# partitioning operations can complete (e.g., autopart)
- self._targetSize = newsize
+ super(PartitionDevice, self)._setTargetSize(newsize)
disk = self.disk.format.partedDisk
# resize the partition's geometry in memory
--
1.8.1.4
More information about the anaconda-patches
mailing list