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

Nageswara R Sastry rnsastry at linux.vnet.ibm.com
Mon Oct 28 05:20:58 UTC 2013


Hello,

Please find the version 4 of the patch with the changes suggested by Dave.

The following patch has been tested with Fedora19 GA and with already installed
EDEV, EAV disks and fresh EDEV, EAV disks.

This version of the patch requires some fixes in 'parted' tool. The same can
be found at URL
http://lists.alioth.debian.org/pipermail/parted-devel/2013-October/004404.html

Regards
R.Nageswara Sastry

Subject: [PATCH v4] storage: add support for EDEV device

From: Nageswara R Sastry <rnsastry at linux.vnet.ibm.com>

Fixed Block Access (FBA) DASDs are mainframe-specific disk devices
which are layed out as a sequence of 512-byte sectors. In contrast
to ECKD DASDs, these disks do not require formatting and resemble
the LBA layout of non-mainframe disks. Despite this resemblance,
the Linux kernel applies special handling during partition detection
for FBA DASDs, resulting in a single, immutable partition being
reported.

While actual FBA DASD hardware is no longer available, the z/VM
hypervisor can simulate FBA DASD disks, backed by either ECKD or
SCSI devices.

This patch adds support for successful installation on FBA DASD
devices (EDEV)

This version (v4) of the patch contains the code customized for
blivet and changed logic to minimize effecting other code paths
and effects only System z related code.

Signed-off-by: Nageswara R Sastry <rnsastry at linux.vnet.ibm.com>
---
 blivet/__init__.py          |    5 ++++-
 blivet/devices.py           |   10 +++++++++-
 blivet/formats/disklabel.py |   23 +++++++++++++++++++++--
 3 files changed, 34 insertions(+), 4 deletions(-)

--- 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")

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

         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:
+                        self._partedDisk = self.freshPartedDisk()
+                else:
+                    self._partedDisk = self.freshPartedDisk()

             # turn off cylinder alignment
             if self._partedDisk.isFlagAvailable(parted.DISK_CYLINDER_ALIGNMENT):
@@ -291,7 +305,10 @@ class DiskLabel(DeviceFormat):
         try:
             self.partedDisk.commit()
         except parted.DiskException as msg:
-            raise DiskLabelCommitError(msg)
+            if self.isLDL and len(self.partitions) == 1:
+                pass
+            else:
+                raise DiskLabelCommitError(msg)
         else:
             self.updateOrigPartedDisk()
             udev_settle()
@@ -442,6 +459,8 @@ class DiskLabel(DeviceFormat):
             return 1
         elif self.labelType == "sun":
             return 3
+        elif self.isLDL:
+            return 1
         else:
             return 0



More information about the anaconda-patches mailing list