Define a resize() method on PartitionDevice to handle resizing the partition when the format resizes. --- storage/devices.py | 20 ++++++++++++++++++++ 1 files changed, 20 insertions(+), 0 deletions(-) diff --git a/storage/devices.py b/storage/devices.py index 2f4b1e9..35b0717 100644 --- a/storage/devices.py +++ b/storage/devices.py @@ -1049,6 +1049,26 @@ class PartitionDevice(StorageDevice): self.exists = True self.setup() + def resize(self, intf=None): + """ Resize the device. + + New size should already be set. + """ + currentGeometry = self.partedPartition.geometry + currentDevice = currentGeometry.device + newLength = long(self.size * 1024 * 1024) / currentDevice.sectorSize + geometry = parted.Geometry(device=currentDevice, + start=currentGeometry.start, + length=newLength) + constraint = parted.Constraint(exactGeom=geometry) + + partedDisk = self.disk.partedDisk + partedDisk.setPartitionGeometry(partition=self.partedPartition, + constraint=constraint, + start=geometry.start, + end=geometry.end) + self.disk.commit() + def destroy(self): """ Destroy the device. """ log_method_call(self, self.name, status=self.status) -- 1.6.1.3 _______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/anaconda-devel-list