[PATCH V2][blivet] Add support for FBA EDEV/EAV installation. (#885957)
Nageswara R Sastry
rnsastry at linux.vnet.ibm.com
Thu Aug 22 13:42:51 UTC 2013
Hello,
Please find the version 2 of the patch with minimal changes. Overall
approach
was not changed, because the current approach is less intrusive and
effects only System z specific code.
We are planning to support and help to maintain this System z specific
code,
should the storage architecture require changes or need fixes.
The following patch has been tested with Fedora19 GA and with already
installed EDEV disk and fresh EDEV disk.
Thank you.
Regards
R.Nageswara Sastry
Subject: [PATCH v2] 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
devies (EDEV)
This version (v2) of the patch contains the code customized for
blivet and made 'isLDL' definition as 'property'. Overall approach
was not changed, because the current approach is less intrusive and
effects only System z related code.
Signed-off-by: Nageswara R Sastry <rnsastry at linux.vnet.ibm.com>
---
blivet/__init__.py | 6 ++++--
blivet/devices.py | 21 +++++++++++++--------
blivet/formats/disklabel.py | 24 +++++++++++++++++++++++-
blivet/partitioning.py | 2 ++
4 files changed, 42 insertions(+), 11 deletions(-)
--- a/blivet/__init__.py
+++ b/blivet/__init__.py
@@ -821,8 +821,10 @@ 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")
+ # Do not remove partition from LDL formatted
+ if not disk.format.isLDL():
+ 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)
--- a/blivet/devices.py
+++ b/blivet/devices.py
@@ -1520,15 +1520,20 @@ class PartitionDevice(StorageDevice):
def _create(self):
""" Create the device. """
log_method_call(self, self.name, status=self.status)
- 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
+ # 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
+
def _postCreate(self):
if self.isExtended:
--- a/blivet/formats/disklabel.py
+++ b/blivet/formats/disklabel.py
@@ -144,6 +144,20 @@ 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)
+
+ @property
+ 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 +179,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 +462,8 @@ class DiskLabel(DeviceFormat):
return 1
elif self.labelType == "sun":
return 3
+ elif self.isLDL():
+ return 1
else:
return 0
--- a/blivet/partitioning.py
+++ b/blivet/partitioning.py
@@ -453,6 +453,8 @@ def getNextPartitionType(disk, no_primar
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
More information about the anaconda-patches
mailing list