diff options
author | Hans de Goede <hdegoede@redhat.com> | 2010-02-16 14:57:53 +0100 |
---|---|---|
committer | Hans de Goede <hdegoede@redhat.com> | 2010-02-16 20:26:24 +0100 |
commit | ad5b2571c63f0c66219146e4740d5f200b048bb2 (patch) | |
tree | 0ac84ed58f2d5f507631b656daf1e7ac60345df9 /storage | |
parent | aee86fba5ee9c66b114f484dfaac740a9f485cc3 (diff) | |
download | anaconda-ad5b2571c63f0c66219146e4740d5f200b048bb2.tar.gz anaconda-ad5b2571c63f0c66219146e4740d5f200b048bb2.tar.xz anaconda-ad5b2571c63f0c66219146e4740d5f200b048bb2.zip |
Add currentSize method to the PartitionDevice class (#565822)
PartitionDevice was inheriting the currentSize property from StorageDevice,
but that uses partedDevice.getSize() which returns 1024 when called on
extended partitions (as that is what the kernel reports).
This causes _setTargetSize() to try and change the extended partition geometry
even when called with the current extended partition geometry size, as
currentSize was mis-reporting the extended partition size. Since
we do end sector alignment now a days when changing the partition geometry,
we could end up making the extended partition to small to hold the
last logical partition resulting in a:
PartitionException: Unable to satisfy all constraints on the partition.
Error. This patch fixes this by adding a currentSize method to the
PartitionDevice class, which properly reports the currentSize for extended
partitions.
Diffstat (limited to 'storage')
-rw-r--r-- | storage/devices.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/storage/devices.py b/storage/devices.py index 9584055e1..22956285c 100644 --- a/storage/devices.py +++ b/storage/devices.py @@ -926,6 +926,7 @@ class PartitionDevice(StorageDevice): self.partedFlags = {} self._partedPartition = None self._origPath = None + self._currentSize = 0 # FIXME: Validate size, but only if this is a new partition. # For existing partitions we will get the size from @@ -1231,6 +1232,7 @@ class PartitionDevice(StorageDevice): # this is in MB self._size = self.partedPartition.getSize() + self._currentSize = self._size self.targetSize = self._size self._partType = self.partedPartition.type @@ -1270,6 +1272,7 @@ class PartitionDevice(StorageDevice): self.partedPartition = self.disk.format.partedDisk.getPartitionByPath(self.path) self.exists = True + self._currentSize = self.partedPartition.getSize() self.setup() finally: if w: @@ -1313,6 +1316,7 @@ class PartitionDevice(StorageDevice): end=geometry.end) self.disk.format.commit() + self._currentSize = partition.getSize() def destroy(self): """ Destroy the device. """ @@ -1426,6 +1430,14 @@ class PartitionDevice(StorageDevice): else: return self.format.maxSize + @property + def currentSize(self): + """ The device's actual size. """ + if self.exists: + return self._currentSize + else: + return 0 + class DMDevice(StorageDevice): """ A device-mapper device """ |