On Tue, 2009-03-10 at 14:35 -1000, David Cantrell wrote: > Define a resize() method on PartitionDevice to handle resizing the > partition when the format resizes. The logic looks right to me. Eventually we will want this handled when scheduling the resize action. Then the resize method can just apply the calculated geometry to the "real" disk, aka DiskDevice._origPartedDisk (as obtained from the "future" disk, aka DiskDevice._partedDisk) and commit. Maybe a PartitionDevice method to do the work as below and another to "make it so". Dave > --- > 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) _______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/anaconda-devel-list