On Thu, 2014-11-27 at 14:09 +0100, Radek Vykydal wrote:
Looks good to me. Maybe add the same comment in StorageDevice case
too?
Also looks good to me & agree with adding some more comments. :)
On 11/27/2014 01:46 PM, Vratislav Podzimek wrote:
> If the original size was unaligned, it's not our fault and we can do nothing
> about it.
>
> Signed-off-by: Vratislav Podzimek <vpodzime(a)redhat.com>
> ---
> blivet/devices.py | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/blivet/devices.py b/blivet/devices.py
> index c66bfd4..7f03a4d 100644
> --- a/blivet/devices.py
> +++ b/blivet/devices.py
> @@ -605,6 +605,8 @@ class StorageDevice(Device):
> size = read_int_from_sys("%s/size" % device_root)
> self._size = Size(size * sector_size)
>
> + self._orig_size = self._size
> +
> def __str__(self):
> exist = "existing"
> if not self.exists:
> @@ -743,7 +745,7 @@ class StorageDevice(Device):
> newsize, self.minSize)
> raise ValueError("size is smaller than the minimum for this
device")
>
> - if self.alignTargetSize(newsize) != newsize:
> + if self.alignTargetSize(newsize) != newsize and newsize !=
self._orig_size:
> raise ValueError("new size would violate alignment
requirements")
>
> self._targetSize = newsize
> @@ -1480,6 +1482,8 @@ class PartitionDevice(StorageDevice):
> self.req_start_sector = start
> self.req_end_sector = end
>
> + self._orig_size = self._size
> +
> def __repr__(self):
> s = StorageDevice.__repr__(self)
> s += (" grow = %(grow)s max size = %(maxsize)s bootable =
%(bootable)s\n"
> @@ -1546,7 +1550,8 @@ class PartitionDevice(StorageDevice):
> # this gets handled in superclass setter, below
> aligned = newsize
>
> - if aligned != newsize:
> + # reverting to unaligned original size is not an issue
> + if aligned != newsize and newsize != self._orig_size:
> raise ValueError("new size will not yield an aligned
partition")
>
> # change this partition's geometry in-memory so that other
_______________________________________________
anaconda-patches mailing list
anaconda-patches(a)lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/anaconda-patches