From f0bdcebf0e7e06ee4a121d2c7dd58aae96050cf9 Mon Sep 17 00:00:00 2001 From: Rafael Leira Date: Mon, 10 Apr 2023 11:42:19 +0200 Subject: [PATCH] controller.create_vd : Try to fix corner case reported in issue Additional params in methods - create_vd Naudit/pystorcli2#2 --- CHANGELOG.md | 1 + pystorcli2/controller.py | 14 +++++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 021937b..8f29d9f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 ============= diff --git a/pystorcli2/controller.py b/pystorcli2/controller.py index 93d6b93..3a58435 100644 --- a/pystorcli2/controller.py +++ b/pystorcli2/controller.py @@ -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))