baremetal: fix hpssactl split last LV size out of limit (#7429)

This commit is contained in:
Zexi Li
2020-07-31 22:38:00 +08:00
committed by GitHub
parent e5cabfb3a8
commit f91526f96f
@@ -249,11 +249,17 @@ func (adapter *HPSARaidAdaptor) buildRaid(level string, devs []*baremetal.Bareme
return fmt.Errorf("getLastArray: %v", err)
}
cmds := []string{}
for _, sz := range conf.Size[1:] {
restSize := conf.Size[1:]
for idx, sz := range restSize {
isLast := idx == len(restSize)-1
sizeStr := fmt.Sprintf("size=%d", sz)
if isLast {
sizeStr = "size=max"
}
args = []string{"controller", fmt.Sprintf("slot=%d", adapter.index),
"array", array, "create", "type=ld",
fmt.Sprintf("raid=%s", level),
fmt.Sprintf("size=%d", sz),
sizeStr,
}
args = append(args, params...)
cmds = append(cmds, GetCommand(args...))