FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian Kernel

 
 
LinkBack Thread Tools
 
Old 02-16-2010, 03:32 PM
David Cantrell
 
Default Add currentSize method to the PartitionDevice class (#565822)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Ack.

On Tue, 16 Feb 2010, Hans de Goede wrote:


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.
---
storage/devices.py | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/storage/devices.py b/storage/devices.py
index eee43e2..44b063a 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(sel f.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 """



- --
David Cantrell <dcantrell@redhat.com>

Red Hat / Honolulu, HI

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

iEYEARECAAYFAkt6yLQACgkQ5hsjjIy1Vkk11wCaA9cPrq0wLx VnkkKfBKcWNKop
FYcAoIwwa7lfgW4TVdcgotAQ3+5oyin4
=Ojqe
-----END PGP SIGNATURE-----

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 

Thread Tools




All times are GMT. The time now is 10:47 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org