Failures to parse ssacli output on HP Gen9 with a few RAID controllers
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
proliantutils |
Fix Released
|
Undecided
|
Anton Antonov |
Bug Description
When I tried to use Ironic to deploy Centos on HP Gen9 the deployment failed with an error:
```
| last_error | Agent returned error for clean step {u'interface': u'raid', u'priority': 0, u'step': u'delete_
```
After checking IPA logs (attached) I discovered that the issue is caused by incorrect parsing of ssacli output. While fixing this issue I found a few other less significant problems. I'm going to create a pull request and add its details to this bug report.
This is a list of issues I fixed in the pull request. For each of the issue below I use a small part of the real output. My pull-request includes unittests which fails before the fix and pass with the fix.
1. This is the main problem. _get_dict function uses recursion to parse ssacli output, but it doesn't return correctly from multi-level depth when a few RAID controllers listed. For example, this output:
```
Smart HBA H240 in Slot 1 (RAID Mode)
Slot: 1
Unassigned
physicaldrive 1I:1:1
Port: 1I
Box: 1
Bay: 1
Smart HBA H240 in Slot 2 (RAID Mode)
Slot: 2
Array: H
Interface Type: SAS
physicaldrive 2I:2:8
Port: 2I
Box: 2
Bay: 8
Smart HBA H240 in Slot 3 (RAID Mode)
Slot: 3
```
will be parsed as:
```
{
"Smart HBA H240 in Slot 1 (RAID Mode)": {
"Slot": "1",
"Unassigned": {
"Smart HBA H240 in Slot 2 (RAID Mode)": {
"Slot": "2",
"Array: H": {
"Box": "2",
"Port": "2I",
"Bay": "8"
},
"Smart HBA H240 in Slot 3 (RAID Mode)": {
"Slot": "3"
},
}
},
"
"Box": "1",
"Port": "1I",
"Bay": "1"
}
}
}
}
```
2. Parameters with ':' in name are not properly parsed:
```
Smart HBA H240 in Slot 1 (RAID Mode)
Bus Interface: PCI
Slot: 1
PCI Address (Domain:
Controller Mode: RAID Mode
```
result:
```
{
"Smart HBA H240 in Slot 1 (RAID Mode)": {
"Slot": "1",
"Controller Mode": "RAID Mode",
"Bus Interface": "PCI"
}
}
```
3. _get_dict function can return premature if it's not in recursion:
```
Smart HBA H240 in Slot 2 (RAID Mode)
Slot: 2
Smart HBA H240 in Slot 3 (RAID Mode)
Slot: 3
```
result:
```{
"Smart HBA H240 in Slot 2 (RAID Mode)": {
"Slot": "2"
}
}
```
4. There is a special case in _get_key_value function for "physicaldrive" parameters. But, with the current implementation all drives except last will be lost ("physicaldrive" is used as a key for all of them):
```
Smart HBA H240 in Slot 2 (RAID Mode)
Slot: 2
Physical Drives
physicaldrive 2I:1:5 (port 2I:box 1:bay 5, SAS HDD, 900 GB, OK)
physicaldrive 2I:1:8 (port 2I:box 1:bay 8, SAS HDD, 900 GB, OK)
```
result:
```
{
"Smart HBA H240 in Slot 2 (RAID Mode)": {
"Slot": "2",
"Physical Drives": {
"
}
}
}
```
5. Maps update done in way that new map replaces an existing one. For example, when physical drives are in different cages:
```Smart HBA H240 in Slot 1 (RAID Mode)
Slot: 1
Internal Drive Cage at Port 1I, Box 1, OK
Drive Bays: 4
Port: 1I
Box: 1
Physical Drives
physicaldrive 1I:1:4 (port 1I:box 1:bay 4, SAS HDD, 900 GB, OK)
physicaldrive 1I:1:3 (port 1I:box 1:bay 3, SAS HDD, 900 GB, OK)
Internal Drive Cage at Port 2I, Box 1, OK
Drive Bays: 4
Port: 2I
Box: 1
Physical Drives
physicaldrive 2I:1:5 (port 2I:box 1:bay 5, SAS HDD, 900 GB, OK)
physicaldrive 2I:1:6 (port 2I:box 1:bay 6, SAS HDD, 900 GB, OK)
```
result:
```
{
"Smart HBA H240 in Slot 1 (RAID Mode)": {
"Slot": "1",
"Physical Drives": {
"
},
"Internal Drive Cage at Port 2I, Box 1, OK": {
"Box": "1",
"Drive Bays": "4",
"Port": "2I"
},
"Internal Drive Cage at Port 1I, Box 1, OK": {
"Box": "1",
"Drive Bays": "4",
"Port": "1I"
}
}
}
```
Changed in proliantutils: | |
status: | New → In Progress |
assignee: | nobody → Anton Antonov (anta-nok) |
Please also find full ssacli output ("ssacli controller all show config detail") from HP Gen9 I used for testing