From 65141a277ce459f69e0751bdff6f186d8c711f7e Mon Sep 17 00:00:00 2001 From: Qiu Jian Date: Tue, 8 Sep 2020 15:19:30 +0800 Subject: [PATCH] fix: ignore 409 error when doing redfish power on --- pkg/baremetal/manager.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pkg/baremetal/manager.go b/pkg/baremetal/manager.go index 17925db176..eec38d248b 100644 --- a/pkg/baremetal/manager.go +++ b/pkg/baremetal/manager.go @@ -61,6 +61,7 @@ import ( "yunion.io/x/onecloud/pkg/mcclient/modules" "yunion.io/x/onecloud/pkg/util/dhcp" "yunion.io/x/onecloud/pkg/util/fileutils2" + "yunion.io/x/onecloud/pkg/util/httputils" "yunion.io/x/onecloud/pkg/util/influxdb" "yunion.io/x/onecloud/pkg/util/procutils" "yunion.io/x/onecloud/pkg/util/redfish" @@ -1402,7 +1403,15 @@ func (b *SBaremetalInstance) DoRedfishPowerOn() error { b.ClearSSHConfig() redfishApi := b.GetRedfishCli(ctx) if redfishApi != nil { - return redfishApi.Reset(ctx, "On") + err := redfishApi.Reset(ctx, "On") + if err != nil { + if httputils.ErrorCode(err) == 409 { + log.Warningf("redfishApi.Reset On fail %s", err) + } else { + return errors.Wrap(err, "redfishApi.Reset On") + } + } + return nil } return fmt.Errorf("Baremetal %s redfishApi is nil", b.GetId()) }