fix(baremetal): ignore RetrieveStorages leftover diagnostics when disks match (#25696)

Only fail buildRaid when no disk is selected, matching CalculateLayout behavior.
This commit is contained in:
Zexi Li
2026-09-18 11:17:23 +08:00
committed by GitHub
parent 92e18c0e07
commit 16a6c438e6

View File

@@ -123,10 +123,12 @@ func buildRaid(driver raid.IRaidDriver, adapter raid.IRaidAdapter, confs []*api.
for _, conf := range confs { for _, conf := range confs {
selected, left, err = baremetal.RetrieveStorages(conf, left) selected, left, err = baremetal.RetrieveStorages(conf, left)
if err != nil { // RetrieveStorages also returns match diagnostics for leftover disks in rest;
return errors.Wrap(err, "baremetal.RetrieveStorages") // only treat it as failure when no disk was selected (same as CalculateLayout).
}
if len(selected) == 0 { if len(selected) == 0 {
if err != nil {
return errors.Wrapf(err, "no enough disks for config %#v", conf)
}
return errors.Wrapf(httperrors.ErrInputParameter, "no enough disks for config %#v", conf) return errors.Wrapf(httperrors.ErrInputParameter, "no enough disks for config %#v", conf)
} }
var err error var err error