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 > Ubuntu > Ubuntu User

 
 
LinkBack Thread Tools
 
Old 03-10-2009, 10:58 PM
David Lehman
 
Default Create partitions with exactly the geometry we calculate.

If we use the device constraint as before, libparted will
align the start and end to a cylinder boundary which, on
my disks, means a granularity of 7MB. Not good enough.

Plus, for mdraid we need >= 1% variation in size between
members of an array. We can get this with cylinder-aligned
partitions, but we'll have to do the alignment ourselves
and continue to use exact constraints.
---
storage/devices.py | 6 ++----
storage/partitioning.py | 11 ++++++++---
2 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/storage/devices.py b/storage/devices.py
index be604f5..713449b 100644
--- a/storage/devices.py
+++ b/storage/devices.py
@@ -723,14 +723,12 @@ class DiskDevice(StorageDevice):
part.geometry))

geometry = device.partedPartition.geometry
- # XXX at some point we need to improve precision of non-grow sizes
- #constraint = parted.Constraint(exactGeom=geometry,
- # device=self.partedDisk.device)
+ constraint = parted.Constraint(exactGeom=geometry)
partition = parted.Partition(disk=self.partedDisk,
type=device.partedPartition.type,
geometry=geometry)
self.partedDisk.addPartition(partition,
- constraint=self.partedDisk.device.getConstraint())
+ constraint=constraint)

def probe(self):
""" Probe for any missing information about this device.
diff --git a/storage/partitioning.py b/storage/partitioning.py
index 7cad2f3..c104401 100644
--- a/storage/partitioning.py
+++ b/storage/partitioning.py
@@ -507,6 +507,10 @@ def doPartitioning(storage, exclusiveDisks=None):
disks = [d for d in disks if d.name in exclusiveDisks]

partitions = storage.partitions
+ for part in partitions:
+ if not part.exists:
+ # start over with flexible-size requests
+ part.req_size = part.req_base_size

# FIXME: isn't there a better place for this to happen?
try:
@@ -698,18 +702,19 @@ def allocatePartitions(disks, partitions):

# create minimum geometry for this request
# req_size is in MB
+ sectors_per_track = disk.device.biosGeometry[2]
length = (_part.req_size * (1024 * 1024)) / sectorSize
new_geom = parted.Geometry(device=disk.device,
- start=free.start,
+ start=max(sectors_per_track, free.start),
length=length)

# 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)
disk.addPartition(partition=partition,
- constraint=disk.device.getConstraint())
-# constraint=parted.Constraint(device=disk.device))
+ constraint=constraint)
log.debug("created partition %s of %dMB and added it to %s" % (partition.getDeviceNodeName(), partition.getSize(), disk))

# this one sets the name
--
1.6.0.6

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 03-10-2009, 11:52 PM
David Lehman
 
Default Create partitions with exactly the geometry we calculate.

On Tue, 2009-03-10 at 14:42 -1000, David Cantrell wrote:
> This looks fine to me. The only comment I have is the use of the
> biosGeometry property from pyparted. I know I expose both biosGeometry
> and hardwareGeometry, but I'm not sure which we should use when or if it
> matters.

I think I saw device.startSectorToCylinder and friends using
biosGeometry -- that is my only basis. I'm definitely learning by doing.

Dave

>
> On 03/10/2009 01:58 PM, David Lehman wrote:
> > If we use the device constraint as before, libparted will
> > align the start and end to a cylinder boundary which, on
> > my disks, means a granularity of 7MB. Not good enough.
> >
> > Plus, for mdraid we need>= 1% variation in size between
> > members of an array. We can get this with cylinder-aligned
> > partitions, but we'll have to do the alignment ourselves
> > and continue to use exact constraints.
> > ---
> > storage/devices.py | 6 ++----
> > storage/partitioning.py | 11 ++++++++---
> > 2 files changed, 10 insertions(+), 7 deletions(-)
> >
> > diff --git a/storage/devices.py b/storage/devices.py
> > index be604f5..713449b 100644
> > --- a/storage/devices.py
> > +++ b/storage/devices.py
> > @@ -723,14 +723,12 @@ class DiskDevice(StorageDevice):
> > part.geometry))
> >
> > geometry = device.partedPartition.geometry
> > - # XXX at some point we need to improve precision of non-grow sizes
> > - #constraint = parted.Constraint(exactGeom=geometry,
> > - # device=self.partedDisk.device)
> > + constraint = parted.Constraint(exactGeom=geometry)
> > partition = parted.Partition(disk=self.partedDisk,
> > type=device.partedPartition.type,
> > geometry=geometry)
> > self.partedDisk.addPartition(partition,
> > - constraint=self.partedDisk.device.getConstraint())
> > + constraint=constraint)
> >
> > def probe(self):
> > """ Probe for any missing information about this device.
> > diff --git a/storage/partitioning.py b/storage/partitioning.py
> > index 7cad2f3..c104401 100644
> > --- a/storage/partitioning.py
> > +++ b/storage/partitioning.py
> > @@ -507,6 +507,10 @@ def doPartitioning(storage, exclusiveDisks=None):
> > disks = [d for d in disks if d.name in exclusiveDisks]
> >
> > partitions = storage.partitions
> > + for part in partitions:
> > + if not part.exists:
> > + # start over with flexible-size requests
> > + part.req_size = part.req_base_size
> >
> > # FIXME: isn't there a better place for this to happen?
> > try:
> > @@ -698,18 +702,19 @@ def allocatePartitions(disks, partitions):
> >
> > # create minimum geometry for this request
> > # req_size is in MB
> > + sectors_per_track = disk.device.biosGeometry[2]
> > length = (_part.req_size * (1024 * 1024)) / sectorSize
> > new_geom = parted.Geometry(device=disk.device,
> > - start=free.start,
> > + start=max(sectors_per_track, free.start),
> > length=length)
> >
> > # 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)
> > disk.addPartition(partition=partition,
> > - constraint=disk.device.getConstraint())
> > -# constraint=parted.Constraint(device=disk.device))
> > + constraint=constraint)
> > log.debug("created partition %s of %dMB and added it to %s" % (partition.getDeviceNodeName(), partition.getSize(), disk))
> >
> > # this one sets the name
>
>

_______________________________________________
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 11:23 PM.

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