[PATCH V5][blivet] Add support for FBA EDEV/EAV installation (#885957)
David Lehman
dlehman at redhat.com
Thu Oct 31 22:13:16 UTC 2013
On Fri, 2013-11-01 at 03:32 +0530, Nageswara R Sastry wrote:
> On 10/31/2013 9:27 PM, David Lehman wrote:
> >> --- a/blivet/__init__.py
> >> +++ b/blivet/__init__.py
> >> @@ -807,7 +807,10 @@ class Blivet(object):
> >> self.devicetree._removeDevice(part, moddisk=False)
> >>
> >> if disk.partitioned and disk.format.partitions:
> >> - raise ValueError("cannot initialize a disk that has partitions")
> >> + if disk.format.isLDL:
> >> + pass
> >> + else:
> >> + raise ValueError("cannot initialize a disk that has partitions")
> >
> > In this case will the partition be listed by udev or
> > in /proc/partitions? If so, you should be using the block just above
> > this whose entire purpose is to handle disklabels with magic/special
> > partitions.
>
> The partition is listed in /proc/partitions. I tried removing the magic
> partition using the above block. But still disk.partitioned and
> disk.format.partitions gets true and installation struck here. Reason
> FBA disk partition can not be deleted.
That's because the code I am asking you to rely on is broken. Please try
it with the following patch applied:
diff --git a/blivet/__init__.py b/blivet/__init__.py
index 4feaa6f..c54229e 100644
--- a/blivet/__init__.py
+++ b/blivet/__init__.py
@@ -815,12 +815,11 @@ class Blivet(object):
"""
# first, remove magic mac/sun partitions from the parted Disk
if disk.partitioned:
- magic_partitions = {"mac": 1, "sun": 3}
- if disk.format.labelType in magic_partitions:
- number = magic_partitions[disk.format.labelType]
+ magic = disk.format.magicPartitionNumber
+ if magic:
# remove the magic partition
- for part in disk.format.partitions:
- if part.disk == disk and
part.partedPartition.number == number:
+ for part in self.devicetree.getChildren(disk):
+ if part.partedPartition.number == magic:
log.debug("removing %s" % part.name)
# We can't schedule the magic partition for
removal
# because parted will not allow us to remove it
from the
>
> >>
> >> # remove existing formatting from the disk
> >> destroy_action = ActionDestroyFormat(disk)
> >> --- a/blivet/devices.py
> >> +++ b/blivet/devices.py
> >> @@ -94,6 +94,7 @@
> >> """
> >>
> >> import os
> >> +import sys
> >> import math
> >> import copy
> >> import pprint
> >> @@ -1503,7 +1504,14 @@ class PartitionDevice(StorageDevice):
> >> def _create(self):
> >> """ Create the device. """
> >> log_method_call(self, self.name, status=self.status)
> >> - self.disk.format.addPartition(self.partedPartition)
> >> + try:
> >> + self.disk.format.addPartition(self.partedPartition)
> >> + except Exception as e:
> >> + if self.disk.format.isLDL:
> >> + log.debug("Skipping add partition for FBA disk")
> >> + sys.exc_clear()
> >> + else:
> >> + raise DeviceCreateError(str(e), self.name)
> >
> > As I said before, the above chunk is not acceptable. If it is not
> > possible to add partitions on LDL disks it will not get to this point.
> > The code in partitioning.py will not succeed in allocating partitions
> > from these devices any more than this code will.
>
> What are the different possibilities to skip this code for these kind of
> disks. Installation always struck here throwing exception 'Too many
> primary partitions'. FBA disk is already having one partition and can not
> add more.
Please provide the /tmp/storage.log file from an installation attempt
that exhibits this behavior.
>
> >>
> >> self._wipe()
> >> try:
> >> --- a/blivet/formats/disklabel.py
> >> +++ b/blivet/formats/disklabel.py
> >> @@ -145,6 +145,13 @@ class DiskLabel(DeviceFormat):
> >> return parted.freshDisk(device=self.partedDevice, ty=self._labelType)
> >>
> >> @property
> >> + def isLDL(self):
> >> + """ Return True for LDL formatted disk. """
> >> + log_method_call(self, device=self.device)
> >> + return (self._labelType == "dasd" and
> >> + self.partedDisk.maxPrimaryPartitionCount == 1)
> >> +
> >> + @property
> >> def partedDisk(self):
> >> if not self._partedDisk:
> >> if self.exists:
> >> @@ -165,7 +172,14 @@ class DiskLabel(DeviceFormat):
> >> # preexisting disklabels if the passed type was wrong
> >> self._labelType = self._partedDisk.type
> >> else:
> >> - self._partedDisk = self.freshPartedDisk()
> >> + if (self._labelType == "dasd"):
> >> + # FBA need to handle differently
> >> + self._partedDisk = parted.newDisk(self.partedDevice)
> >> + # Do not want to break for DASD
> >> + if self._partedDisk.maxPrimaryPartitionCount != 1:
> >
> > Why not use isLDL above? Either use it everywhere or remove it and use
> > the longhand notation everywhere.
> After running freshPartedDisk/parted.newDisk gives access to
> 'self.partedDisk.maxPrimaryPartitionCount'. So here isLDL can not be used.
You are right -- my mistake.
>
>
> Regards
> R.Nageswara Sastry
>
More information about the anaconda-patches
mailing list