[blivet] Add support for FBA EDEV/EAV installation. (#885957)
Samantha N. Bueno
sbueno+anaconda at redhat.com
Wed Jun 5 12:56:11 UTC 2013
Note: these patches have been tested by IBM. Two minor issues arose
from testing (noted in comment 15 of the bug if interested), but they
are non-fatal and not directly related to the patches below.
====
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
devies (EDEV)
Patches originally submitted by Nageswara R Sastry
<rnsastry at linux.vnet.ibm.com>; I only refactored them as needed to mesh
with current code since they were written last year.
---
blivet/__init__.py | 7 +++++--
blivet/devices.py | 17 +++++++++--------
blivet/formats/disklabel.py | 23 ++++++++++++++++++++++-
blivet/partitioning.py | 2 ++
4 files changed, 38 insertions(+), 11 deletions(-)
diff --git a/blivet/__init__.py b/blivet/__init__.py
index 2d69eb1..95d77e0 100644
--- a/blivet/__init__.py
+++ b/blivet/__init__.py
@@ -802,8 +802,11 @@ class Blivet(object):
# disk. Still, we need it out of the devicetree.
self.devicetree._removeDevice(part, moddisk=False)
- if disk.partitioned and disk.format.partitions:
- raise ValueError("cannot initialize a disk that has partitions")
+ log.debug("Checking to see if device is LDL DASD")
+ if not disk.format.isLDL():
+ log.debug("Disk is not LDL DASD")
+ if disk.partitioned and disk.format.partitions:
+ raise ValueError("cannot initialize a disk that has partitions")
# remove existing formatting from the disk
destroy_action = ActionDestroyFormat(disk)
diff --git a/blivet/devices.py b/blivet/devices.py
index 2bb7289..e8b3e0b 100644
--- a/blivet/devices.py
+++ b/blivet/devices.py
@@ -1484,15 +1484,16 @@ class PartitionDevice(StorageDevice):
def _create(self):
""" Create the device. """
log_method_call(self, self.name, status=self.status)
- self.disk.format.addPartition(self.partedPartition)
+ # Do not create partition on LDL formatted
+ if not self.disk.format.isLDL():
+ self.disk.format.addPartition(self.partedPartition)
- self._wipe()
- try:
- self.disk.format.commit()
- except DiskLabelCommitError:
- part = self.disk.format.partedDisk.getPartitionByPath(self.path)
- self.disk.format.removePartition(part)
- raise
+ try:
+ self.disk.format.commit()
+ except DiskLabelCommitError:
+ part = self.disk.format.partedDisk.getPartitionByPath(self.path)
+ self.disk.format.removePartition(part)
+ raise
def _postCreate(self):
if self.isExtended:
diff --git a/blivet/formats/disklabel.py b/blivet/formats/disklabel.py
index 90b73f3..7cb41f5 100644
--- a/blivet/formats/disklabel.py
+++ b/blivet/formats/disklabel.py
@@ -144,6 +144,19 @@ class DiskLabel(DeviceFormat):
log_method_call(self, device=self.device, labelType=self._labelType)
return parted.freshDisk(device=self.partedDevice, ty=self._labelType)
+ def newPartedDisk(self):
+ """ Return a new, empty parted.Disk instance for this device. """
+ log_method_call(self, device=self.device)
+ return parted.newDisk(device=self.partedDevice)
+
+ def isLDL(self):
+ """ Return True for LDL formatted disk. """
+ log_method_call(self, device=self.device)
+ if (self._labelType == "dasd" and self.partedDisk.maxPrimaryPartitionCount == 1):
+ return True
+ else:
+ return False
+
@property
def partedDisk(self):
if not self._partedDisk:
@@ -165,7 +178,13 @@ 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"):
+ self._partedDisk = self.newPartedDisk()
+ # Don't want to break for the normal 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):
@@ -442,6 +461,8 @@ class DiskLabel(DeviceFormat):
return 1
elif self.labelType == "sun":
return 3
+ elif self.isLDL():
+ return 1
else:
return 0
diff --git a/blivet/partitioning.py b/blivet/partitioning.py
index 8660969..1bd0d08 100644
--- a/blivet/partitioning.py
+++ b/blivet/partitioning.py
@@ -425,6 +425,8 @@ def getNextPartitionType(disk, no_primary=None):
part_type = parted.PARTITION_LOGICAL
elif extended and logical_count < max_logicals:
part_type = parted.PARTITION_LOGICAL
+ elif (disk.type == "dasd" and disk.maxPrimaryPartitionCount == 1):
+ part_type = parted.PARTITION_NORMAL
return part_type
--
1.7.11.7
More information about the anaconda-patches
mailing list