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 > Redhat > Fedora Development

 
 
LinkBack Thread Tools
 
Old 06-15-2011, 10:32 PM
David Lehman
 
Default Sun disklabel hacks. (#697100)

Handle magic third partition and don't write partitions starting at
sector 0, even if it might work in some cases.
---
pyanaconda/storage/devicetree.py | 9 +++++++--
pyanaconda/storage/partitioning.py | 17 +++++++++++++----
2 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/pyanaconda/storage/devicetree.py b/pyanaconda/storage/devicetree.py
index af8a6de..9d09d71 100644
--- a/pyanaconda/storage/devicetree.py
+++ b/pyanaconda/storage/devicetree.py
@@ -776,13 +776,18 @@ class DeviceTree(object):
devicelibs.lvm.lvm_cc_addFilterRejectRegexp(name)
return

+ # Sun disklabels have a partition that spans the entire disk as
+ # partition 3. It does not appear in the partition list. Fantastic.
+ is_sun_magic = (getattr(disk.format, "labelType", None) == "sun" and
+ udev_device_get_minor(info) == 3)
+
# Check that the disk has partitions. If it does not, we must have
# reinitialized the disklabel.
#
# Also ignore partitions on devices we do not support partitioning
# of, like logical volumes.
- if not getattr(disk.format, "partitions", None) or
- not disk.partitionable:
+ if ((not getattr(disk.format, "partitions", None) and not is_sun_magic)
+ or not disk.partitionable):
# When we got here because the disk does not have a disklabel
# format (ie a biosraid member), or because it is not
# partitionable we want LVM to ignore this partition too
diff --git a/pyanaconda/storage/partitioning.py b/pyanaconda/storage/partitioning.py
index 41ab5c5..2822812 100644
--- a/pyanaconda/storage/partitioning.py
+++ b/pyanaconda/storage/partitioning.py
@@ -351,9 +351,13 @@ def shouldClear(device, clearPartType, clearPartDisks=None):
if isinstance(device, PartitionDevice):
# Never clear the special first partition on a Mac disk label, as that
# holds the partition table itself.
+ # Something similar for the third partition on a Sun disklabel.
if device.disk.format.partedDisk.type == "mac" and
device.partedPartition.number == 1:
return False
+ elif device.disk.format.labelType == "sun" and
+ device.partedPartition.number == 3:
+ return False

# If we got a list of disks to clear, make sure this one's on it
if clearPartDisks and device.disk.name not in clearPartDisks:
@@ -494,12 +498,14 @@ def clearPartitions(storage, bootloader=None):
if disk.format.labelType == nativeLabelType:
continue

- if disk.format.labelType == "mac":
- # remove the magic apple partition
+ magic_partitions = {"mac": 1, "sun": 3}
+ if disk.format.labelType in magic_partitions:
+ number = magic_partitions[disk.format.labelType]
+ # remove the magic partition
for part in storage.partitions:
- if part.disk == disk and part.partedPartition.number == 1:
+ if part.disk == disk and part.partedPartition.number == number:
log.debug("clearing %s" % part.name)
- # We can't schedule the apple map partition for removal
+ # We can't schedule the magic partition for removal
# because parted will not allow us to remove it from the
# disk. Still, we need it out of the devicetree.
storage.devicetree._removeDevice(part, moddisk=False)
@@ -812,6 +818,9 @@ def addPartition(disklabel, free, part_type, size):
if not disklabel.alignment.isAligned(free, start):
start = disklabel.alignment.alignNearest(free, start)

+ if disklabel.labelType == "sun" and start == 0:
+ start = disklabel.alignment.alignUp(free, start)
+
if part_type == parted.PARTITION_LOGICAL:
# make room for logical partition's metadata
start += disklabel.alignment.grainSize
--
1.7.3.4

_______________________________________________
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 01:28 PM.

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