Re: [PATCH] Create a min_max constraint to avoid alignments issues.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Apr 06, 2009 at 12:36:38PM -0500, David Lehman wrote:
> On Mon, 2009-04-06 at 19:24 +0200, Joel Granados Moreno wrote:
> > ---
> >  storage/partitioning.py |   14 +++++++++++---
> >  1 files changed, 11 insertions(+), 3 deletions(-)
> > 
> > diff --git a/storage/partitioning.py b/storage/partitioning.py
> > index eba0cb7..245d986 100644
> > --- a/storage/partitioning.py
> > +++ b/storage/partitioning.py
> > @@ -755,17 +755,25 @@ def allocatePartitions(disks, partitions):
> >  
> >          # create minimum geometry for this request
> >          # req_size is in MB
> > -        sectors_per_track = disk.device.biosGeometry[2]
BTW, is there any reason for having sectors_per_track besides playing
nice with cylinder alignment.?
> >          length = (_part.req_size * (1024 * 1024)) / sectorSize
> >          new_geom = parted.Geometry(device=disk.device,
> > -                                   start=max(sectors_per_track, free.start),
> > +                                   start=free.start,
> >                                     length=length)
> >  
> > +        # create maximum and minimum geometries for constraint
> > +        max_geom = parted.Geometry(device=disk.device,
> > +                                   start=max(0 , free.start - 1),
> > +                                   length=min(length + 1, disk.device.length))
> 
> Shouldn't this be more like
> 
> start = max(0, free.start - 1)
> max_geom = parted.Geometry(device=disk.device,
>                            start=start,
>                            length=min(length + 1, disk.device.length -
> start))
> 
> (since it seems possible for start to be non-zero in which case we
> certainly don't want max to run off the end of the device. Or does
> parted cover that for us?)
> 
> > +        min_geom = parted.Geometry(device=disk.device,
> > +                                   start=free.start + 1,
> > +                                   length=length-1)
> > +
> > +
> >          # create the partition and add it to the disk
> >          partition = parted.Partition(disk=disk,
> >                                       type=part_type,
> >                                       geometry=new_geom)
> > -        constraint = parted.Constraint(exactGeom=new_geom)
> > +        constraint = parted.Constraint(maxGeom=max_geom, minGeom=min_geom)
> >          disk.addPartition(partition=partition,
> >                            constraint=constraint)
> >          log.debug("created partition %s of %dMB and added it to %s" %
> 
> _______________________________________________
> Anaconda-devel-list mailing list
> Anaconda-devel-list@xxxxxxxxxx
> https://www.redhat.com/mailman/listinfo/anaconda-devel-list

-- 
Joel Andres Granados
Brno, Czech Republic, Red Hat.

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

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux