[PATCH V5][blivet] Add support for FBA EDEV/EAV installation (#885957)

Nageswara R Sastry rnsastry at linux.vnet.ibm.com
Thu Oct 31 22:02:15 UTC 2013


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.

>>
>>          # 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.

>>
>>          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.


Regards
R.Nageswara Sastry



More information about the anaconda-patches mailing list