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 03:34:18PM -0500, David Lehman wrote:
> On Mon, 2009-04-06 at 22:25 +0200, Joel Granados wrote:
> > On Mon, Apr 06, 2009 at 02:58:54PM -0500, David Lehman wrote:
> > > On Mon, 2009-04-06 at 21:50 +0200, Joel Granados wrote:
> > > > On Mon, Apr 06, 2009 at 02:24:40PM -0500, David Lehman wrote:
> > > > > On Mon, 2009-04-06 at 21:17 +0200, Joel Granados wrote:
> > > > > > 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.?
> > > > > 
> > > > > It had nothing to do with cylinder alignment. I saw that the first
> > > > > partition was expected to start at sector 63 and assumed that meant the
> > > > > start of the second track.
> > > > 
> > > > Well, in anycase, since we take out the free values from parted, there
> > > > is no need to do this calculation.  since free.start should give us a
> > > > valid value (valid as in no less than its suppose to be).
> > > > 
> > > > Or can free start become less that the firs free partition (numver=-1)
> > > > start value?
> > > 
> > > Yes -- parted will report the first free range as starting at sector 0
> > > and then promptly fail when you try to add a partition at sector 0.
> > > Brilliant.
> > 
> > Well in this case we have one of two choices. leave the cylinder
> > alignment thing in the partition geometry, or try to use the min_max
> > approach, just not restricted to 1 sector but to sectors_per_track
> > sectors and let parted do the intersecting.
> > Will test the two tmrow see which is better.
> 
> I don't see what the problem is with leaving the max(63, start) thing in
No problem at all, just that the other option might be less lines.  But,
I just hit a bug that comes before this issue.  will solve that one and
get to this once I've gotten passed what I found today

Regards.
> there if that's one of the rules. No need to bring cylinder-alignment
> into this -- all that max call does is make sure we don't try to start a
> partition before sector 63.
> 
> Dave
> 
> > > 
> > > 
> > > > 
> > > > > 
> > > > > > > >          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
> > > > > > 
> > > > > 
> > > > > _______________________________________________
> > > > > Anaconda-devel-list mailing list
> > > > > Anaconda-devel-list@xxxxxxxxxx
> > > > > https://www.redhat.com/mailman/listinfo/anaconda-devel-list
> > > > 
> > > 
> > > _______________________________________________
> > > Anaconda-devel-list mailing list
> > > Anaconda-devel-list@xxxxxxxxxx
> > > https://www.redhat.com/mailman/listinfo/anaconda-devel-list
> > 
> 
> _______________________________________________
> 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