Skip to content

Commit

Permalink
controller.create_vd : Try to fix corner case reported in issue Addit…
Browse files Browse the repository at this point in the history
…ional params in methods - create_vd #2
  • Loading branch information
ralequi committed Apr 10, 2023
1 parent 7e2e6a6 commit f0bdceb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Version 0.6.1
- **Fixes**:
----------
- [**Controller**] Fixed device count on controller.create_vd. Requested in [#2](https://github.com/Naudit/pystorcli2/issues/2)
- [**Controller**] Fixed default pd on controller.create_vd in some scenarios. Requested in [#2](https://github.com/Naudit/pystorcli2/issues/2)

Version 0.6.0
=============
Expand Down
14 changes: 11 additions & 3 deletions pystorcli2/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,13 +314,21 @@ def create_vd(self, name: str, raid: str, drives: str, strip: str = '64', PDperA
# The format of the drives argument is e:s|e:s-x|e:s-x,y;e:s-x,y,z

numDrives = common.count_drives(drives)
PDperArray = numDrives//2

if numDrives % 2 != 0 and numDrives % 3 == 0:
# In some scenarios, such as 9 drives with raid 60, 3 is a good pd number but 4 is not
# Must check for similar scenarios
# BTW we don't clearly understand what PDperArray is for and what exactly it does under the hood. More investigation is needed
PDperArray = numDrives//3
else:
PDperArray = numDrives//2

except ValueError:
pass

if raid == '00' and PDperArray is None:
PDperArray = 1
finally:
if raid == '00' and PDperArray is None:
PDperArray = 1

if PDperArray is not None:
args.append('PDperArray={0}'.format(PDperArray))
Expand Down

0 comments on commit f0bdceb

Please sign in to comment.