[blivet 12/13] Put additional constraints on the ActionResizeDevice initializer.

mulhern amulhern at redhat.com
Fri Dec 6 16:50:12 UTC 2013


Signed-off-by: mulhern <amulhern at redhat.com>
---
 blivet/deviceaction.py | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/blivet/deviceaction.py b/blivet/deviceaction.py
index 4284c4b..b48462e 100644
--- a/blivet/deviceaction.py
+++ b/blivet/deviceaction.py
@@ -386,6 +386,12 @@ class ActionResizeDevice(DeviceAction):
         if long(math.floor(device.currentSize)) == newsize:
             raise ValueError("new size same as old size")
 
+        if newsize < device.minSize:
+            raise ValueError("new size is too small")
+
+        if newsize > device.maxSize:
+            raise ValueError("new size is too large")
+
         DeviceAction.__init__(self, device)
         if newsize > long(math.floor(device.currentSize)):
             self.dir = RESIZE_GROW
-- 
1.8.3.1



More information about the anaconda-patches mailing list