Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 578514

Summary: pykickstart doesn't support RAID4
Product: Red Hat Enterprise Linux 6 Reporter: Alexander Todorov <atodorov>
Component: pykickstartAssignee: Chris Lumens <clumens>
Status: CLOSED CURRENTRELEASE QA Contact: Release Test Team <release-test-team-automation>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.0Keywords: TestBlocker
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard: anaconda_trace_hash:b4e8c4036508d579b4f403476b41a2ad1f00419a93a6d682fbafdc0c959760d6
Fixed In Version: pykickstart-1.70-1 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-11-10 21:22:34 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Attached traceback automatically from anaconda. none

Description Alexander Todorov 2010-03-31 14:09:05 UTC
The following was filed automatically by anaconda:
anaconda 13.21.20.2 exception report
Traceback (most recent call first):
  File "/usr/lib/anaconda/kickstart.py", line 835, in execute
    raise KickstartValueError, formatErrorMsg(self.lineno, msg="RAID Partition defined without RAID level")
  File "/usr/lib/anaconda/kickstart.py", line 1086, in execute
    obj.execute(self.anaconda)
  File "/usr/bin/anaconda", line 1035, in <module>
    ksdata.execute()
KickstartValueError: The following problem occurred on line 36 of the kickstart file:

RAID Partition defined without RAID level

Comment 1 Alexander Todorov 2010-03-31 14:09:09 UTC
Created attachment 403755 [details]
Attached traceback automatically from anaconda.

Comment 2 Alexander Todorov 2010-03-31 14:15:28 UTC
I believe this is pykickstart not anaconda, changing component and summary to reflect that. 

It looks like pykcikstart is not aware of RAID4 at all. 

Looking at commands/raid.py in git I see:

        self.levelMap = { "RAID0": "RAID0", "0": "RAID0",
                          "RAID1": "RAID1", "1": "RAID1",
                          "RAID5": "RAID5", "5": "RAID5",
                          "RAID6": "RAID6", "6": "RAID6" }

No trace of RAID4 at all, while anaconda UI shows it as available option. 

The pykickstart code that I was using was (raid4_xfs RHTS test case):

    # create raid4 device and members
    members = list()
    for devNum in range(1,5):
        members.append(ks.PartData(mountpoint="raid.0%d" % devNum, size=2048, grow=True, format=True))
    md0 = ks.RaidData(mountpoint="/", fstype="xfs", device="md0", format=True, level="RAID4", members=map(lambda m: m.mountpoint, members))

This resulted in a ks.cfg definition which doesn't specify RAID level and caused anaconda to traceback.

Comment 3 Alexander Todorov 2010-03-31 14:20:37 UTC
This patch should fix it but I've not tested it. 

diff --git a/pykickstart/commands/raid.py b/pykickstart/commands/raid.py
index c9d4342..abbf799 100644
--- a/pykickstart/commands/raid.py
+++ b/pykickstart/commands/raid.py
@@ -316,3 +316,12 @@ class F12_Raid(F9_Raid):
         op.add_option("--escrowcert")
         op.add_option("--backuppassphrase", action="store_true", default=False)
         return op
+
+class RHEL6_Raid(F12_Raid):
+    removedKeywords = F12_Raid.removedKeywords
+    removedAttrs = F12_Raid.removedAttrs
+
+    def __init__(self, writePriority=131, *args, **kwargs):
+        F12_Raid.__init__(self, writePriority, *args, **kwargs)
+
+        self.levelMap.update({"RAID4": "RAID4", "4": "RAID4"})
diff --git a/pykickstart/handlers/control.py b/pykickstart/handlers/control.py
index ed27c6a..506a15b 100644
--- a/pykickstart/handlers/control.py
+++ b/pykickstart/handlers/control.py
@@ -848,7 +848,7 @@ commandMap = {
         "part": partition.F12_Partition,
         "partition": partition.F12_Partition,
         "poweroff": reboot.FC6_Reboot,
-        "raid": raid.F12_Raid,
+        "raid": raid.RHEL6_Raid,
         "reboot": reboot.FC6_Reboot,
         "repo": repo.F13_Repo,
         "rescue": rescue.F10_Rescue,

Comment 4 Chris Lumens 2010-03-31 14:35:28 UTC
Basic patch looks okay, though I need to make sure F13 supports RAID4 as well so I'll change around the names of the classes a little bit.  I'll also add a test case.

Comment 8 Alexander Todorov 2010-08-13 14:26:48 UTC
Tested with pykickstart-1.74-1.el6.noarch and snake-0.11-0.20.el6.noarch installed on a RHEL6 server. My template is:

from pykickstart.version import RHEL6
from defaults import Defaults

# minimal install, procedural style
def ks(**context):
    '''Partitioning / raid4_xfs'''

    ks=Defaults()
    ks.version=RHEL6
    ks.packages.add(['@base'])
    ks.autopart(autopart=False)

    # create raid4 device and members
    members = list()
    for devNum in range(1,5):
        members.append(ks.PartData(mountpoint="raid.0%d" % devNum, size=2048, grow=False, format=True))
    md0 = ks.RaidData(mountpoint="/usr", fstype="xfs", device="md0", format=True, level="RAID4", members=map(lambda m: m.mountpoint, members))
    root = ks.PartData(mountpoint="/", fstype="ext4", size=2048, grow=True, format=True)


    for member in members:
        ks.partition.partitions.append(member)
    ks.partition.partitions.append(md0)
    ks.partition.partitions.append(root)

    return ks


snake-ks generate generated the correct ks.cfg file. Moving to VERIFIED.

Comment 9 releng-rhel@redhat.com 2010-11-10 21:22:34 UTC
Red Hat Enterprise Linux 6.0 is now available and should resolve
the problem described in this bug report. This report is therefore being closed
with a resolution of CURRENTRELEASE. You may reopen this bug report if the
solution does not work for you.