[rhel5-branch] Skip relabeling empty disks on s390 (#966950)

Brian C. Lane bcl at redhat.com
Wed May 29 17:37:46 UTC 2013


From: "Brian C. Lane" <bcl at redhat.com>

s390 reports that its default disklabel should be msdos when it actually
uses dasd, and s390 doesn't use GPT, so just skip trying to relabel
empty disks on s390

It also ends up that the dev = parted.PedDevice.get(deviceFile) call
needs to be after the format on s390.

Related: rhbz#758881
---
 autopart.py    | 4 +++-
 partedUtils.py | 5 +++--
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/autopart.py b/autopart.py
index ff46eb1..6a24762 100644
--- a/autopart.py
+++ b/autopart.py
@@ -1205,7 +1205,9 @@ def doClearPartAction(anaconda, partitions, diskset):
             partitions.addDelete(delete)
             deletePart(diskset, delete)
 
-        if linuxOnly == 0 and disk.get_primary_partition_count() == 0:
+        # s390 reports msdos as default, but doesn't use it or gpt, so skip this
+        if rhpl.getArch() != "s390" and \
+          linuxOnly == 0 and disk.get_primary_partition_count() == 0:
             # The disk is empty and we are clearing all partitions, so relabel it
             dev = disk.dev
             label = needGPTLabel(dev, getDefaultDiskType())
diff --git a/partedUtils.py b/partedUtils.py
index a6dac86..4fa319b 100644
--- a/partedUtils.py
+++ b/partedUtils.py
@@ -1095,7 +1095,8 @@ class DiskSet:
                     "-F",
                     "-f",
                     "/tmp/%s" % drive]
-        
+        log.debug(" ".join(argList))
+
         fd = os.open("/dev/null", os.O_RDWR | os.O_CREAT | os.O_APPEND)
         p = os.pipe()
         childpid = os.fork()
@@ -1207,7 +1208,6 @@ class DiskSet:
         log.info("Reinitializing label for drive %s" % (drive,))
 
         deviceFile = isys.makeDevInode(drive, "/dev/" + drive)
-        dev = parted.PedDevice.get(deviceFile)
 
         try:
             try:
@@ -1217,6 +1217,7 @@ class DiskSet:
                     if self.dasdFmt(drive):
                         raise LabelError, drive
 
+                    dev = parted.PedDevice.get(deviceFile)
                     disk = parted.PedDisk.new(dev)
                 else:
                     disk = labelDisk(deviceFile)
-- 
1.8.1.4



More information about the anaconda-patches mailing list