[PATCH 1/3] Reverting partition's size shouldn't require it to be aligned (#1165714)
Radek Vykydal
rvykydal at redhat.com
Thu Nov 27 13:09:58 UTC 2014
Looks good to me. Maybe add the same comment in StorageDevice case too?
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 at 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
More information about the anaconda-patches
mailing list