mirror of
https://hubproxy.babadafafafafa.cn/https://github.com/yunionio/cloudpods.git
synced 2026-09-20 08:03:53 +08:00
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:
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user