fix: upgrade go 1.24 (#23241)

This commit is contained in:
屈轩
2025-09-05 18:26:33 +08:00
committed by GitHub
parent 3fdab63193
commit eb82b9d9ca
223 changed files with 659 additions and 1115 deletions

View File

@@ -13,7 +13,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: '1.21'
go-version: '1.25'
- name: Install check tools
shell: bash

View File

@@ -22,7 +22,7 @@ jobs:
- uses: actions/setup-go@v4
with:
go-version: '1.21'
go-version: '1.25'
- name: Set up QEMU
uses: docker/setup-qemu-action@v2

View File

@@ -20,7 +20,7 @@ jobs:
- uses: actions/setup-go@v4
with:
go-version: '1.21'
go-version: '1.25'
- name: Set up QEMU
uses: docker/setup-qemu-action@v2

View File

@@ -21,7 +21,7 @@ jobs:
- uses: actions/setup-go@v4
with:
go-version: '1.21'
go-version: '1.25'
- name: Set up QEMU
uses: docker/setup-qemu-action@v2

View File

@@ -19,7 +19,7 @@ jobs:
- uses: actions/setup-go@v4
with:
go-version: '1.21'
go-version: '1.25'
- name: Set up QEMU
uses: docker/setup-qemu-action@v2

View File

@@ -23,7 +23,7 @@ jobs:
- uses: actions/setup-go@v4
with:
go-version: '1.21'
go-version: '1.25'
- name: Set up QEMU
uses: docker/setup-qemu-action@v2

View File

@@ -19,7 +19,7 @@ jobs:
- uses: actions/setup-go@v4
with:
go-version: '1.21'
go-version: '1.25'
- name: Set up QEMU
uses: docker/setup-qemu-action@v2

View File

@@ -23,7 +23,7 @@ jobs:
- uses: actions/setup-go@v4
with:
go-version: '1.21'
go-version: '1.25'
- name: Set up QEMU
uses: docker/setup-qemu-action@v2

View File

@@ -23,7 +23,7 @@ jobs:
- uses: actions/setup-go@v4
with:
go-version: '1.21'
go-version: '1.25'
- name: Set up QEMU
uses: docker/setup-qemu-action@v2

View File

@@ -23,7 +23,7 @@ jobs:
- uses: actions/setup-go@v4
with:
go-version: '1.21'
go-version: '1.25'
- name: Set up QEMU
uses: docker/setup-qemu-action@v2

View File

@@ -24,7 +24,7 @@ jobs:
- uses: actions/setup-go@v4
with:
go-version: '1.21'
go-version: '1.25'
- name: Set up QEMU
uses: docker/setup-qemu-action@v2

View File

@@ -20,7 +20,7 @@ jobs:
- uses: actions/setup-go@v4
with:
go-version: '1.21'
go-version: '1.25'
- name: Set up QEMU
uses: docker/setup-qemu-action@v2

View File

@@ -23,7 +23,7 @@ jobs:
- uses: actions/setup-go@v4
with:
go-version: '1.21'
go-version: '1.25'
- name: Set up QEMU
uses: docker/setup-qemu-action@v2

View File

@@ -8,7 +8,7 @@ endif
ModBaseName:=$(notdir $(ModName))
DockerImageRegistry?=registry.cn-beijing.aliyuncs.com
DockerImageAlpineBuild?=$(DockerImageRegistry)/yunionio/alpine-build:3.19.0-go-1.21.10-0
DockerImageAlpineBuild?=$(DockerImageRegistry)/yunionio/alpine-build:3.22.0-go-1.24.6-0
DockerImageCentOSBuild?=$(DockerImageRegistry)/yunionio/centos-build:go-1.21.10-0
EnvIf=$(if $($(1)),$(1)=$($(1)))

View File

@@ -1,4 +1,4 @@
FROM registry.cn-beijing.aliyuncs.com/yunionio/alpine-build:3.19.0-go-1.21.10-0 as build
FROM registry.cn-beijing.aliyuncs.com/yunionio/alpine-build:3.22.0-go-1.24.6-0 as build
ARG TARGETPLATFORM
ARG BUILDPLATFORM
RUN mkdir -p /root/go/src/yunion.io/x/onecloud

View File

@@ -200,7 +200,7 @@ func main() {
options.HostOptions.CudaMPSReplicas,
)
if err != nil {
log.Fatalf(err.Error())
log.Fatalf("%s", err.Error())
return
}
@@ -214,7 +214,7 @@ func main() {
signalutils.StartTrap()
if err = daemon.Start(); err != nil {
log.Fatalf(err.Error())
log.Fatalf("%s", err.Error())
}
log.Infof("MPS daemon started ......")

6
go.mod
View File

@@ -1,6 +1,6 @@
module yunion.io/x/onecloud
go 1.21
go 1.24
require (
bazil.org/fuse v0.0.0-20180421153158-65cc252bf669
@@ -51,7 +51,7 @@ require (
github.com/miekg/dns v1.1.25
github.com/minio/minio-go v6.0.14+incompatible
github.com/mitchellh/go-wordwrap v1.0.1
github.com/petermattis/goid v0.0.0-20250508124226-395b08cebbdb
github.com/petermattis/goid v0.0.0-20250904145737-900bdf8bb490
github.com/pierrec/lz4/v4 v4.1.15
github.com/pkg/errors v0.9.1
github.com/pkg/sftp v1.13.6
@@ -96,7 +96,7 @@ require (
k8s.io/cri-api v0.22.17
k8s.io/klog/v2 v2.20.0
moul.io/http2curl/v2 v2.3.0
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20250902085702-cb118fc37e8a
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20250904062553-2e7d040a1d28
yunion.io/x/executor v0.0.0-20250518005516-5402e9e0bed0
yunion.io/x/jsonutils v1.0.1-0.20250507052344-1abcf4f443b1
yunion.io/x/log v1.0.1-0.20240305175729-7cf2d6cd5a91

8
go.sum
View File

@@ -716,8 +716,8 @@ github.com/openzipkin/zipkin-go-opentracing v0.3.4/go.mod h1:js2AbwmHW0YD9DwIw2J
github.com/oracle/oci-go-sdk v24.3.0+incompatible h1:x4mcfb4agelf1O4/1/auGlZ1lr97jXRSSN5MxTgG/zU=
github.com/oracle/oci-go-sdk v24.3.0+incompatible/go.mod h1:VQb79nF8Z2cwLkLS35ukwStZIg5F66tcBccjip/j888=
github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU=
github.com/petermattis/goid v0.0.0-20250508124226-395b08cebbdb h1:3PrKuO92dUTMrQ9dx0YNejC6U/Si6jqKmyQ9vWjwqR4=
github.com/petermattis/goid v0.0.0-20250508124226-395b08cebbdb/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4=
github.com/petermattis/goid v0.0.0-20250904145737-900bdf8bb490 h1:QTvNkZ5ylY0PGgA+Lih+GdboMLY/G9SEGLMEGVjTVA4=
github.com/petermattis/goid v0.0.0-20250904145737-900bdf8bb490/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4=
github.com/philhofer/fwd v1.0.0 h1:UbZqGr5Y38ApvM/V/jEljVxwocdweyH+vmYvRPBnbqQ=
github.com/philhofer/fwd v1.0.0/go.mod h1:gk3iGcWd9+svBvR0sR+KPcfE+RNWozjowpeBVG3ZVNU=
github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY=
@@ -1409,8 +1409,8 @@ sigs.k8s.io/structured-merge-diff/v4 v4.0.1/go.mod h1:bJZC9H9iH24zzfZ/41RGcq60oK
sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
sigs.k8s.io/yaml v1.2.0 h1:kr/MCeFWJWTwyaHoR9c8EjH9OumOmoF9YGiZd7lFm/Q=
sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc=
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20250902085702-cb118fc37e8a h1:v2TsC0peqfQv993Gc6YOVU1rzyZkr48RiNzIShFmXa8=
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20250902085702-cb118fc37e8a/go.mod h1:FXxAEbdNfWXX9gjME3K2nJhkydHY5EKEUZb+RLEzVwQ=
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20250904062553-2e7d040a1d28 h1:4PDFt1V4ti4pbWfh7VEhX/5tfhA+1jcn9qTIE6je3Fs=
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20250904062553-2e7d040a1d28/go.mod h1:FXxAEbdNfWXX9gjME3K2nJhkydHY5EKEUZb+RLEzVwQ=
yunion.io/x/executor v0.0.0-20250518005516-5402e9e0bed0 h1:msG4SiDSVU7CrXH06WuHlNEZXIooTcmNbfrIGHuIHBU=
yunion.io/x/executor v0.0.0-20250518005516-5402e9e0bed0/go.mod h1:Uxuou9WQIeJXNpy7t2fPLL0BYLvLiMvGQwY7Qc6aSws=
yunion.io/x/jsonutils v0.0.0-20190625054549-a964e1e8a051/go.mod h1:4N0/RVzsYL3kH3WE/H1BjUQdFiWu50JGCFQuuy+Z634=

View File

@@ -252,7 +252,7 @@ func (h *AuthHandlers) getScopedPolicyBindings(ctx context.Context, w http.Respo
func (h *AuthHandlers) getUser(ctx context.Context, w http.ResponseWriter, req *http.Request) {
data, err := getUserInfo(ctx, req)
if err != nil {
httperrors.NotFoundError(ctx, w, err.Error())
httperrors.NotFoundError(ctx, w, "%s", err.Error())
return
}
body := jsonutils.NewDict()

View File

@@ -54,7 +54,7 @@ func toQrcode(secret string, token mcclient.TokenCredential) (string, error) {
c, err := qrcode.Encode(uri, qrcode.High, 256)
if err != nil {
log.Errorf(err.Error())
log.Errorf("%s", err.Error())
return "", httperrors.NewInternalServerError("generate totp qrcode failed")
}

View File

@@ -16,7 +16,6 @@ package handler
import (
"context"
"fmt"
"net/http"
"yunion.io/x/jsonutils"
@@ -71,7 +70,7 @@ func fetchEnv3Csrf(ctx context.Context, w http.ResponseWriter, r *http.Request)
}
module3, e := modulebase.GetModule(session, params[ResName3])
if e != nil || module == nil {
httperrors.NotFoundError(ctx, w, fmt.Sprintf("resource %s not found", params[ResName3]))
httperrors.NotFoundError(ctx, w, "resource %s not found", params[ResName3])
return nil, nil, nil, nil, nil, nil, nil
}
return module, module2, module3, session, params, query, body
@@ -84,7 +83,7 @@ func fetchEnv2Csrf(ctx context.Context, w http.ResponseWriter, r *http.Request)
}
module2, e := modulebase.GetModule(session, params[ResName2])
if e != nil || module == nil {
httperrors.NotFoundError(ctx, w, fmt.Sprintf("resource %s not found", params[ResName2]))
httperrors.NotFoundError(ctx, w, "resource %s not found", params[ResName2])
return nil, nil, nil, nil, nil, nil
}
return module, module2, session, params, query, body
@@ -94,7 +93,7 @@ func fetchEnvCsrf(ctx context.Context, w http.ResponseWriter, r *http.Request) (
session, params, query, body := fetchEnvCsrf0(ctx, w, r)
module, e := modulebase.GetModule(session, params[ResName])
if e != nil || module == nil {
httperrors.NotFoundError(ctx, w, fmt.Sprintf("resource %s not found", params[ResName]))
httperrors.NotFoundError(ctx, w, "resource %s not found", params[ResName])
return nil, nil, nil, nil, nil
}
return module, session, params, query, body
@@ -105,7 +104,7 @@ func fetchEnvCsrf0(ctx context.Context, w http.ResponseWriter, r *http.Request)
region := r.URL.Query().Get("region")
log.Println("csrf region from url:", region)
if len(region) < 1 {
httperrors.NotFoundError(ctx, w, fmt.Sprintf("region %s is empty", region))
httperrors.NotFoundError(ctx, w, "region %s is empty", region)
return nil, nil, nil, nil
}
log.Infof("csrf region from url: %s", region)

View File

@@ -177,7 +177,7 @@ func (mh *MiscHandler) DoBatchHostRegister(ctx context.Context, w http.ResponseW
file, err := hostfiles[0].Open()
defer file.Close()
if err != nil {
log.Errorf(err.Error())
log.Errorf("%s", err.Error())
e := httperrors.NewInternalServerError("can't open file")
httperrors.JsonClientError(ctx, w, e)
return
@@ -185,7 +185,7 @@ func (mh *MiscHandler) DoBatchHostRegister(ctx context.Context, w http.ResponseW
xlsx, err := excelize.OpenReader(file)
if err != nil {
log.Errorf(err.Error())
log.Errorf("%s", err.Error())
e := httperrors.NewInternalServerError("can't parse file")
httperrors.JsonClientError(ctx, w, e)
return
@@ -245,7 +245,7 @@ func (mh *MiscHandler) DoBatchHostRegister(ctx context.Context, w http.ResponseW
// skipped header row
if len(rows) > BATCH_HOST_REGISTER_QUANTITY_LIMITATION {
e := httperrors.NewInputParameterError(fmt.Sprintf("beyond limitation. excel file rows must less than %d", BATCH_HOST_REGISTER_QUANTITY_LIMITATION))
e := httperrors.NewInputParameterError("beyond limitation. excel file rows must less than %d", BATCH_HOST_REGISTER_QUANTITY_LIMITATION)
httperrors.JsonClientError(ctx, w, e)
return
}
@@ -330,7 +330,7 @@ func (mh *MiscHandler) DoBatchUserRegister(ctx context.Context, w http.ResponseW
file, err := userfiles[0].Open()
defer file.Close()
if err != nil {
log.Errorf(err.Error())
log.Errorf("%s", err.Error())
e := httperrors.NewInternalServerError("can't open file")
httperrors.JsonClientError(ctx, w, e)
return
@@ -338,7 +338,7 @@ func (mh *MiscHandler) DoBatchUserRegister(ctx context.Context, w http.ResponseW
xlsx, err := excelize.OpenReader(file)
if err != nil {
log.Errorf(err.Error())
log.Errorf("%s", err.Error())
e := httperrors.NewInternalServerError("can't parse file")
httperrors.JsonClientError(ctx, w, e)
return
@@ -351,7 +351,7 @@ func (mh *MiscHandler) DoBatchUserRegister(ctx context.Context, w http.ResponseW
httperrors.JsonClientError(ctx, w, e)
return
} else if len(rows) > BATCH_USER_REGISTER_QUANTITY_LIMITATION {
e := httperrors.NewInputParameterError(fmt.Sprintf("beyond limitation.excel file rows must less than %d", BATCH_USER_REGISTER_QUANTITY_LIMITATION))
e := httperrors.NewInputParameterError("beyond limitation.excel file rows must less than %d", BATCH_USER_REGISTER_QUANTITY_LIMITATION)
httperrors.JsonClientError(ctx, w, e)
return
}

View File

@@ -242,7 +242,7 @@ func (f *ResourceHandlers) fetchExportQuery(query jsonutils.JSONObject) (jsonuti
func (f *ResourceHandlers) doList(ctx context.Context, session *mcclient.ClientSession, module modulebase.IBaseManager, query jsonutils.JSONObject, w http.ResponseWriter, r *http.Request) {
query, export, err := f.fetchExportQuery(query)
if err != nil {
httperrors.InvalidInputError(ctx, w, err.Error())
httperrors.InvalidInputError(ctx, w, "%s", err.Error())
return
}
@@ -323,7 +323,7 @@ func (f *ResourceHandlers) getSpecHandler(ctx context.Context, w http.ResponseWr
// list in 1 context
query, export, err := f.fetchExportQuery(query)
if err != nil {
httperrors.InvalidInputError(ctx, w, err.Error())
httperrors.InvalidInputError(ctx, w, "%s", err.Error())
return
}
jmod, e := modulebase.GetJointModule2(session, module, module2)
@@ -367,7 +367,7 @@ func (f *ResourceHandlers) getJointHandler(ctx context.Context, w http.ResponseW
jmod, e := modulebase.GetJointModule2(session, module, module2)
if e != nil {
httperrors.NotFoundError(ctx, w, fmt.Sprintf("resource %s-%s not exist", req.ResName(), req.ResName2()))
httperrors.NotFoundError(ctx, w, "resource %s-%s not exist", req.ResName(), req.ResName2())
return
}
obj, e := jmod.Get(session, req.ResID(), req.ResID2(), req.Query())
@@ -525,7 +525,7 @@ func (f *ResourceHandlers) attachHandler(ctx context.Context, w http.ResponseWri
jmod, e := modulebase.GetJointModule2(session, module, module2)
if e != nil {
httperrors.NotFoundError(ctx, w, fmt.Sprintf("resource %s-%s not exists", req.ResName(), req.ResName2()))
httperrors.NotFoundError(ctx, w, "resource %s-%s not exists", req.ResName(), req.ResName2())
return
}
obj, e := jmod.Attach(session, req.ResID(), req.ResID2(), body)

View File

@@ -16,7 +16,6 @@ package handler
import (
"context"
"fmt"
"net/http"
"reflect"
@@ -79,7 +78,7 @@ func RpcHandler(ctx context.Context, w http.ResponseWriter, req *http.Request) {
log.Errorf("Error get JSON body: %s", e)
}
default:
httperrors.InvalidInputError(ctx, w, fmt.Sprintf("Unsupported RPC method %s", req.Method))
httperrors.InvalidInputError(ctx, w, "Unsupported RPC method %s", req.Method)
return
}
token := AppContextToken(ctx)
@@ -90,13 +89,13 @@ func RpcHandler(ctx context.Context, w http.ResponseWriter, req *http.Request) {
if e != nil {
log.Debugf("module %s not found %s", resType, e)
}
httperrors.NotFoundError(ctx, w, fmt.Sprintf("resource %s not exists", resType))
httperrors.NotFoundError(ctx, w, "resource %s not exists", resType)
return
}
modvalue := reflect.ValueOf(mod)
funcvalue := modvalue.MethodByName(funcname)
if !funcvalue.IsValid() || funcvalue.IsNil() {
httperrors.NotFoundError(ctx, w, fmt.Sprintf("RPC method %s not found", funcname))
httperrors.NotFoundError(ctx, w, "RPC method %s not found", funcname)
return
}
callParams := make([]reflect.Value, 0)
@@ -137,5 +136,5 @@ func RpcHandler(ctx context.Context, w http.ResponseWriter, req *http.Request) {
httperrors.GeneralServerError(ctx, w, je)
return
}
httperrors.BadGatewayError(ctx, w, fmt.Sprintf("%s", reterr.Interface()))
httperrors.BadGatewayError(ctx, w, "%s", reterr.Interface())
}

View File

@@ -48,7 +48,7 @@ func (mh *MiscHandler) getServiceSettings(ctx context.Context, w http.ResponseWr
}
resp, err := identity.ServicesV3.List(s, jsonutils.Marshal(params))
if err != nil {
e := httperrors.NewInternalServerError(err.Error())
e := httperrors.NewInternalServerError("%s", err.Error())
httperrors.JsonClientError(ctx, w, e)
return
}
@@ -58,7 +58,7 @@ func (mh *MiscHandler) getServiceSettings(ctx context.Context, w http.ResponseWr
}{}
err = jsonutils.Update(&services, resp.Data)
if err != nil {
e := httperrors.NewInternalServerError(err.Error())
e := httperrors.NewInternalServerError("%s", err.Error())
httperrors.JsonClientError(ctx, w, e)
return
}
@@ -67,7 +67,7 @@ func (mh *MiscHandler) getServiceSettings(ctx context.Context, w http.ResponseWr
result[service.Type] = map[string]interface{}{}
data, err := identity.ServicesV3.GetSpecific(s, service.Id, "config", nil)
if err != nil {
e := httperrors.NewInternalServerError(err.Error())
e := httperrors.NewInternalServerError("%s", err.Error())
httperrors.JsonClientError(ctx, w, e)
return
}

View File

@@ -303,7 +303,7 @@ func (app *Application) ServeHTTP(w http.ResponseWriter, r *http.Request) {
}
if lrw.status >= 500 && app.exception != nil {
url := fmt.Sprintf("%d %s (%s) %.2fms", lrw.status, r.URL.String(), remote, duration)
app.exception(r.Method, url, params.Body, errors.Errorf(string(lrw.data)))
app.exception(r.Method, url, params.Body, errors.Errorf("%s", string(lrw.data)))
}
}

View File

@@ -30,7 +30,7 @@ type FilterHandler func(ctx context.Context, w http.ResponseWriter, r *http.Requ
type TMiddleware func(handler FilterHandler) FilterHandler
func VersionHandler(ctx context.Context, w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, version.GetShortString())
fmt.Fprintf(w, "%s", version.GetShortString())
}
func PingHandler(ctx context.Context, w http.ResponseWriter, r *http.Request) {

View File

@@ -38,10 +38,10 @@ func ProcessStatsHandler(ctx context.Context, w http.ResponseWriter, r *http.Req
ret.ProcessStat.MemSize = m.Alloc
process, err := process.NewProcess(int32(os.Getpid()))
if err != nil {
fmt.Fprintf(w, jsonutils.Marshal(ret).String())
fmt.Fprintf(w, "%s", jsonutils.Marshal(ret).String())
return
}
ret.ProcessStat.CpuPercent, _ = process.CPUPercent()
ret.ProcessStat.MemPercent, _ = process.MemoryPercent()
fmt.Fprintf(w, jsonutils.Marshal(ret).String())
fmt.Fprintf(w, "%s", jsonutils.Marshal(ret).String())
}

View File

@@ -61,5 +61,5 @@ func StatisticHandler(ctx context.Context, w http.ResponseWriter, r *http.Reques
result.Add(jsonutils.NewFloat64(total.counter4XX.duration), "duration.4XX")
result.Add(jsonutils.NewInt(total.counter5XX.hit), "hit.5XX")
result.Add(jsonutils.NewFloat64(total.counter5XX.duration), "duration.5XX")
fmt.Fprintf(w, result.String())
fmt.Fprintf(w, "%s", result.String())
}

View File

@@ -381,7 +381,7 @@ func WorkerStatsHandler(ctx context.Context, w http.ResponseWriter, r *http.Requ
}
result := jsonutils.NewDict()
result.Add(jsonutils.Marshal(&stats), "workers")
fmt.Fprintf(w, result.String())
fmt.Fprintf(w, "%s", result.String())
}
func GetDBConnectionCount() int {

View File

@@ -285,7 +285,7 @@ type BmRegisterInput struct {
}
func (i *BmRegisterInput) responseSucc(bmId string) {
fmt.Fprintf(i.W, bmId)
fmt.Fprintf(i.W, "%s", bmId)
close(i.C)
}

View File

@@ -208,11 +208,11 @@ func (self *SBaremetalIpmiProbeTask) doRawIpmiProbe(ctx context.Context, cli ipm
// ignore error
err := errors.Wrapf(err, "ipmitool.GetLanConfig for channel %d failed", lanChannel)
errs = append(errs, err)
log.Warningf(err.Error())
log.Warningf("%s", err.Error())
} else if conf.IPAddr == "0.0.0.0" {
err := errors.Errorf("get 0.0.0.0 ip address of channel %d", lanChannel)
errs = append(errs, err)
log.Warningf(err.Error())
log.Warningf("%s", err.Error())
continue
} else {
channel = lanChannel

View File

@@ -77,7 +77,7 @@ func DBStatsHandler(ctx context.Context, w http.ResponseWriter, r *http.Request)
stats := dbConn.DB().Stats()
result.Add(jsonutils.Marshal(&stats), "db_stats")
}
fmt.Fprintf(w, result.String())
fmt.Fprintf(w, "%s", result.String())
}
func AutoPurgeSplitable(ctx context.Context, userCred mcclient.TokenCredential, startRun bool) {

View File

@@ -1401,7 +1401,7 @@ func (dispatcher *DBModelDispatcher) Create(ctx context.Context, query jsonutils
}
failErr := manager.OnCreateFailed(ctx, userCred, ownerId, query, data)
if failErr != nil {
err = errors.Wrapf(err, failErr.Error())
err = errors.Wrapf(err, "%s", failErr.Error())
}
return nil, httperrors.NewGeneralError(err)
}
@@ -1565,7 +1565,7 @@ func (dispatcher *DBModelDispatcher) BatchCreate(ctx context.Context, query json
if err != nil {
failErr := manager.OnCreateFailed(ctx, userCred, ownerId, query, data)
if failErr != nil {
err = errors.Wrapf(err, failErr.Error())
err = errors.Wrapf(err, "%s", failErr.Error())
}
return nil, httperrors.NewGeneralError(errors.Wrap(err, "createResults"))
}

View File

@@ -52,12 +52,12 @@ func NewJointResourceBaseManager(dt interface{}, tableName string, keyword strin
log.Debugf("Initialize %s", keywordPlural)
if master == nil {
msg := fmt.Sprintf("%s master is nil, retry initialization later...", keywordPlural)
log.Errorf(msg)
log.Errorf("%s", msg)
panic(msg)
}
if slave == nil {
msg := fmt.Sprintf("%s slave is nil, retry initialization later...", keywordPlural)
log.Errorf(msg)
log.Errorf("%s", msg)
panic(msg)
}
return SJointResourceBaseManager{

View File

@@ -51,7 +51,7 @@ func TestRunManu(t *testing.T) {
ctx := context.Background()
now := time.Now()
ms := now.UnixMilli()
ctx = context.WithValue(ctx, "Time", ms)
ctx = context.WithValue(ctx, "time", ms)
lockman.LockKey(ctx, "test")
defer lockman.UnlockKey(ctx, "test")
counter++

View File

@@ -524,10 +524,10 @@ func execITask(taskValue reflect.Value, task *STask, odata jsonutils.JSONObject,
msg := fmt.Sprintf("Stage %s not found", stageName)
if taskFailed {
// failed handler is optional, ignore the error
log.Warningf(msg)
log.Warningf("%s", msg)
msg, _ = data.GetString()
} else {
log.Errorf(msg)
log.Errorf("%s", msg)
}
task.SetStageFailed(ctx, jsonutils.NewString(msg))
task.SaveRequestContext(&ctxData)
@@ -537,7 +537,7 @@ func execITask(taskValue reflect.Value, task *STask, odata jsonutils.JSONObject,
objManager := db.GetModelManager(task.ObjType)
if objManager == nil {
msg := fmt.Sprintf("model %s %s(%s) not found??? ...", task.ObjType, task.Object, task.ObjId)
log.Errorf(msg)
log.Errorf("%s", msg)
task.SetStageFailed(ctx, jsonutils.NewString(msg))
task.SaveRequestContext(&ctxData)
return
@@ -546,7 +546,7 @@ func execITask(taskValue reflect.Value, task *STask, odata jsonutils.JSONObject,
objResManager, ok := objManager.(db.IStandaloneModelManager)
if !ok {
msg := fmt.Sprintf("model %s %s(%s) is not a resource??? ...", task.ObjType, task.Object, task.ObjId)
log.Errorf(msg)
log.Errorf("%s", msg)
task.SetStageFailed(ctx, jsonutils.NewString(msg))
task.SaveRequestContext(&ctxData)
return
@@ -562,7 +562,7 @@ func execITask(taskValue reflect.Value, task *STask, odata jsonutils.JSONObject,
obj, err := objResManager.FetchById(objId)
if err != nil {
msg := fmt.Sprintf("fail to find %s object %s", task.ObjType, objId)
log.Errorf(msg)
log.Errorf("%s", msg)
task.SetStageFailed(ctx, jsonutils.NewString(msg))
task.SaveRequestContext(&ctxData)
return
@@ -584,7 +584,7 @@ func execITask(taskValue reflect.Value, task *STask, odata jsonutils.JSONObject,
obj, err := objResManager.FetchById(task.ObjId)
if err != nil {
msg := fmt.Sprintf("fail to find %s object %s", task.ObjType, task.ObjId)
log.Errorf(msg)
log.Errorf("%s", msg)
task.SetStageFailed(ctx, jsonutils.NewString(msg))
task.SaveRequestContext(&ctxData)
return

View File

@@ -146,7 +146,7 @@ func (disp *SEtcdModelHandler) GetSpecific(ctx context.Context, idstr string, sp
funcName := fmt.Sprintf("GetDetails%s", specCamel)
funcValue := modelValue.MethodByName(funcName)
if !funcValue.IsValid() || funcValue.IsNil() {
return nil, httperrors.NewSpecNotFoundError(fmt.Sprintf("%s %s %s not found", disp.Keyword(), idstr, spec))
return nil, httperrors.NewSpecNotFoundError("%s %s %s not found", disp.Keyword(), idstr, spec)
}
outs := funcValue.Call(params)

View File

@@ -857,7 +857,7 @@ func (group *SCloudgroup) GetICloudgroup() (cloudprovider.ICloudgroup, error) {
return groups[i], nil
}
}
return nil, errors.Wrapf(cloudprovider.ErrNotFound, group.ExternalId)
return nil, errors.Wrapf(cloudprovider.ErrNotFound, "%v", group.ExternalId)
}
func (group *SCloudgroup) SyncWithCloudgroup(ctx context.Context, userCred mcclient.TokenCredential, iGroup cloudprovider.ICloudgroup) error {

View File

@@ -163,7 +163,7 @@ func (self *SSAMLProvider) GetISAMLProvider() (cloudprovider.ICloudSAMLProvider,
return samlProviders[i], nil
}
}
return nil, errors.Wrapf(cloudprovider.ErrNotFound, self.ExternalId)
return nil, errors.Wrapf(cloudprovider.ErrNotFound, "%v", self.ExternalId)
}
func (self *SSAMLProvider) Delete(ctx context.Context, userCred mcclient.TokenCredential) error {

View File

@@ -771,7 +771,7 @@ func (res *SResources) CollectMetrics(ctx context.Context, userCred mcclient.Tok
err = driver.CollectServerMetrics(ctx, manager, provider, servers, startTime, endTime)
if err != nil && errors.Cause(err) != cloudprovider.ErrNotImplemented && errors.Cause(err) != cloudprovider.ErrNotSupported {
logmsg := fmt.Sprintf("CollectServerMetrics for %s(%s) error: %v", manager.Name, manager.Provider, err)
log.Errorf(logmsg)
log.Errorf("%s", logmsg)
msgs = append(msgs, logmsg)
succ = false
}
@@ -791,7 +791,7 @@ func (res *SResources) CollectMetrics(ctx context.Context, userCred mcclient.Tok
err = driver.CollectHostMetrics(ctx, manager, provider, hosts, startTime, endTime)
if err != nil && errors.Cause(err) != cloudprovider.ErrNotImplemented && errors.Cause(err) != cloudprovider.ErrNotSupported {
logmsg := fmt.Sprintf("CollectHostMetrics for %s(%s) error: %v", manager.Name, manager.Provider, err)
log.Errorln(logmsg)
log.Errorf("%s", logmsg)
msgs = append(msgs, logmsg)
succ = false
}
@@ -802,7 +802,7 @@ func (res *SResources) CollectMetrics(ctx context.Context, userCred mcclient.Tok
err = jsonutils.Update(&storages, resources)
if err != nil {
logmsg := fmt.Sprintf("unmarsha storage resources error: %v", err)
log.Errorln(logmsg)
log.Errorf("%s", logmsg)
msgs = append(msgs, logmsg)
succ = false
}
@@ -810,7 +810,7 @@ func (res *SResources) CollectMetrics(ctx context.Context, userCred mcclient.Tok
err = driver.CollectStorageMetrics(ctx, manager, provider, storages, startTime, endTime)
if err != nil && errors.Cause(err) != cloudprovider.ErrNotImplemented && errors.Cause(err) != cloudprovider.ErrNotSupported {
logmsg := fmt.Sprintf("CollectStorageMetrics for %s(%s) error: %v", manager.Name, manager.Provider, err)
log.Errorln(logmsg)
log.Errorf("%s", logmsg)
msgs = append(msgs, logmsg)
succ = false
}
@@ -821,7 +821,7 @@ func (res *SResources) CollectMetrics(ctx context.Context, userCred mcclient.Tok
err = jsonutils.Update(&caches, resources)
if err != nil {
logmsg := fmt.Sprintf("unmarsha redis resources error: %v", err)
log.Errorln(logmsg)
log.Errorf("%s", logmsg)
msgs = append(msgs, logmsg)
succ = false
}
@@ -830,7 +830,7 @@ func (res *SResources) CollectMetrics(ctx context.Context, userCred mcclient.Tok
err = driver.CollectRedisMetrics(ctx, manager, provider, caches, startTime, endTime)
if err != nil && errors.Cause(err) != cloudprovider.ErrNotImplemented && errors.Cause(err) != cloudprovider.ErrNotSupported {
logmsg := fmt.Sprintf("CollectRedisMetrics for %s(%s) error: %v", manager.Name, manager.Provider, err)
log.Errorf(logmsg)
log.Errorf("%s", logmsg)
msgs = append(msgs, logmsg)
succ = false
}
@@ -841,7 +841,7 @@ func (res *SResources) CollectMetrics(ctx context.Context, userCred mcclient.Tok
err = jsonutils.Update(&lbs, resources)
if err != nil {
logmsg := fmt.Sprintf("unmarsha lb resources error: %v", err)
log.Errorln(logmsg)
log.Errorf("%s", logmsg)
msgs = append(msgs, logmsg)
succ = false
}
@@ -850,7 +850,7 @@ func (res *SResources) CollectMetrics(ctx context.Context, userCred mcclient.Tok
err = driver.CollectLoadbalancerMetrics(ctx, manager, provider, lbs, startTime, endTime)
if err != nil && errors.Cause(err) != cloudprovider.ErrNotImplemented && errors.Cause(err) != cloudprovider.ErrNotSupported {
logmsg := fmt.Sprintf("CollectLoadbalancerMetrics for %s(%s) error: %v", manager.Name, manager.Provider, err)
log.Errorf(logmsg)
log.Errorf("%s", logmsg)
msgs = append(msgs, logmsg)
succ = false
}
@@ -861,7 +861,7 @@ func (res *SResources) CollectMetrics(ctx context.Context, userCred mcclient.Tok
err = jsonutils.Update(&buckets, resources)
if err != nil {
logmsg := fmt.Sprintf("unmarsha bucket resources error: %v", err)
log.Errorln(logmsg)
log.Errorf("%s", logmsg)
msgs = append(msgs, logmsg)
succ = false
}
@@ -870,7 +870,7 @@ func (res *SResources) CollectMetrics(ctx context.Context, userCred mcclient.Tok
err = driver.CollectBucketMetrics(ctx, manager, provider, buckets, startTime, endTime)
if err != nil && errors.Cause(err) != cloudprovider.ErrNotImplemented && errors.Cause(err) != cloudprovider.ErrNotSupported {
logmsg := fmt.Sprintf("CollectBucketMetrics for %s(%s) error: %v", manager.Name, manager.Provider, err)
log.Errorln(logmsg)
log.Errorf("%s", logmsg)
msgs = append(msgs, logmsg)
succ = false
}

View File

@@ -33,7 +33,8 @@ import (
)
func (proxyendpoint *SProxyEndpoint) remoteCheckMake(ctx context.Context, userCred mcclient.TokenCredential) error {
ctx, _ = context.WithTimeout(ctx, 7*time.Second)
ctx, cancel := context.WithTimeout(ctx, 7*time.Second)
defer cancel()
conf := ssh_util.ClientConfig{
Username: proxyendpoint.User,
Host: proxyendpoint.Host,

View File

@@ -689,7 +689,7 @@ func (base *SBaseGuestDriver) ValidateGuestChangeConfigInput(ctx context.Context
return nil, errors.Wrap(err, "SchedManager.DoScheduleForecast")
}
if !canChangeConf {
return nil, httperrors.NewInsufficientResourceError(res.String())
return nil, httperrors.NewInsufficientResourceError("%s", res.String())
}
confs.SchedDesc = jsonutils.Marshal(schedDesc)

View File

@@ -228,7 +228,7 @@ func (self *SGoogleGuestDriver) RequestStartOnHost(ctx context.Context, guest *m
}
log.Debugf("wait for google startup scripts finish")
if strings.Contains(output, keyword) {
log.Debugf(keyword)
log.Debugf("%s", keyword)
return true, nil
}
return false, nil
@@ -261,7 +261,7 @@ func (self *SGoogleGuestDriver) RemoteActionAfterGuestCreated(ctx context.Contex
}
log.Debugf("wait for google sysprep finish")
if strings.Contains(output, keyword) {
log.Debugf(keyword)
log.Debugf("%s", keyword)
return true, nil
}
return false, nil

View File

@@ -1261,7 +1261,7 @@ func (drv *SManagedVirtualizedGuestDriver) OnGuestDeployTaskDataReceived(ctx con
})
if err != nil {
msg := fmt.Sprintf("save disk info failed %s", err)
log.Errorf(msg)
log.Errorf("%s", msg)
break
}
db.OpsLog.LogEvent(disk, db.ACT_ALLOCATE, disk.GetShortDesc(ctx), task.GetUserCred())
@@ -1273,7 +1273,7 @@ func (drv *SManagedVirtualizedGuestDriver) OnGuestDeployTaskDataReceived(ctx con
})
if err != nil {
msg := fmt.Sprintf("save disk info failed %s", err)
log.Errorf(msg)
log.Errorf("%s", msg)
break
}
}
@@ -1475,7 +1475,7 @@ func (self *SManagedVirtualizedGuestDriver) requestMigrate(ctx context.Context,
vmStatus := iVM.GetStatus()
log.Debugf("vm %s migrate status: %s", guest.Name, vmStatus)
if vmStatus == api.VM_UNKNOWN || strings.Contains(vmStatus, "fail") {
return false, errors.Wrapf(cloudprovider.ErrInvalidStatus, vmStatus)
return false, errors.Wrapf(cloudprovider.ErrInvalidStatus, "%s", vmStatus)
}
if !utils.IsInStringArray(vmStatus, []string{api.VM_RUNNING, api.VM_READY}) {
return false, nil

View File

@@ -112,7 +112,7 @@ func (self *SCasHostDriver) CheckAndSetCacheImage(ctx context.Context, userCred
}
}
if !find {
return nil, errors.Wrapf(cloudprovider.ErrNotFound, image.ExternalId)
return nil, errors.Wrapf(cloudprovider.ErrNotFound, "%s", image.ExternalId)
}
opts.ExternalId = image.ExternalId
} else {

View File

@@ -119,7 +119,7 @@ func (self *SESXiHostDriver) CheckAndSetCacheImage(ctx context.Context, userCred
storage := host.GetStorageByFilePath(storageCache.Path)
if storage == nil {
msg := fmt.Sprintf("fail to find storage for storageCache %s", storageCache.Path)
log.Errorf(msg)
log.Errorf("%s", msg)
return errors.Error(msg)
}

View File

@@ -116,7 +116,7 @@ func (self *SProxmoxHostDriver) CheckAndSetCacheImage(ctx context.Context, userC
}
}
if !find {
return nil, errors.Wrapf(cloudprovider.ErrNotFound, image.ExternalId)
return nil, errors.Wrapf(cloudprovider.ErrNotFound, "%s", image.ExternalId)
}
opts.ExternalId = image.ExternalId
} else {

View File

@@ -112,7 +112,7 @@ func (self *SUisHostDriver) CheckAndSetCacheImage(ctx context.Context, userCred
}
}
if !find {
return nil, errors.Wrapf(cloudprovider.ErrNotFound, image.ExternalId)
return nil, errors.Wrapf(cloudprovider.ErrNotFound, "%s", image.ExternalId)
}
opts.ExternalId = image.ExternalId
} else {

View File

@@ -67,7 +67,7 @@ func getBmAgentUrl(ctx context.Context, w http.ResponseWriter, r *http.Request)
return
}
fmt.Fprintf(w, bmAgent.ManagerUri)
fmt.Fprintf(w, "%s", bmAgent.ManagerUri)
}
func getBmPrepareScript(ctx context.Context, w http.ResponseWriter, r *http.Request) {
@@ -88,5 +88,5 @@ func getBmPrepareScript(ctx context.Context, w http.ResponseWriter, r *http.Requ
script += "tar -zxf ./baremetal_prepare.tar.gz -C ./baremetal_prepare;"
script += fmt.Sprintf("./baremetal_prepare/prepare.sh %s %s",
userCred.GetTokenString(), regionUrl)
fmt.Fprintf(w, script)
fmt.Fprintf(w, "%s", script)
}

View File

@@ -66,7 +66,7 @@ type SAiGateway struct {
CacheTTL int `default:"0" list:"user" create:"optional"`
CollectLogs bool `default:"false" list:"user" create:"optional"`
RateLimitingInterval int `default:"0" list:"user" create:"optional"`
RateLimitingLimit int `default:"0" list:"user" create:"optional`
RateLimitingLimit int `default:"0" list:"user" create:"optional"`
RateLimitingTechnique string `width:"32" charset:"ascii" default:"" list:"user" create:"optional"`
}

View File

@@ -1107,10 +1107,10 @@ func (acnt *SCloudaccount) getDefaultExternalProject(id string) (*SExternalProje
return nil, errors.Wrapf(err, "db.FetchModelObjects")
}
if len(projects) > 1 {
return nil, errors.Wrapf(cloudprovider.ErrDuplicateId, id)
return nil, errors.Wrapf(cloudprovider.ErrDuplicateId, "%s", id)
}
if len(projects) == 0 {
return nil, errors.Wrapf(cloudprovider.ErrNotFound, id)
return nil, errors.Wrapf(cloudprovider.ErrNotFound, "%s", id)
}
return &projects[0], nil
}
@@ -1662,8 +1662,8 @@ func migrateCloudprovider(cloudprovider *SCloudprovider) error {
}
} else {
msg := fmt.Sprintf("error azure provider account format %s", cloudprovider.Account)
log.Errorf(msg)
return fmt.Errorf(msg)
log.Errorf("%s", msg)
return fmt.Errorf("%s", msg)
}
}

View File

@@ -27,7 +27,7 @@ import (
func TestParseAndSuggest(t *testing.T) {
_, err := structureTestData()
if err != nil {
t.Fatalf(err.Error())
t.Fatalf("%v", err)
}
/*out := CloudaccountManager.parseAndSuggestSingleWire(param)
for _, net := range out.CAWireNets[0].GuestSuggestedNetworks {

View File

@@ -85,10 +85,10 @@ func (self *SCloudregionResourceBase) GetZoneBySuffix(suffix string) (*SZone, er
return nil, err
}
if count == 0 {
return nil, errors.Wrapf(cloudprovider.ErrNotFound, suffix)
return nil, errors.Wrapf(cloudprovider.ErrNotFound, "%s", suffix)
}
if count > 1 {
return nil, errors.Wrapf(cloudprovider.ErrDuplicateId, suffix)
return nil, errors.Wrapf(cloudprovider.ErrDuplicateId, "%s", suffix)
}
zone := &SZone{}
zone.SetModelManager(ZoneManager, zone)

View File

@@ -156,11 +156,12 @@ func (self *SCloudregion) GetZoneBySuffix(suffix string) (*SZone, error) {
if err != nil {
return nil, err
}
msg := suffix
if count == 0 {
return nil, errors.Wrapf(cloudprovider.ErrNotFound, suffix)
return nil, errors.Wrapf(cloudprovider.ErrNotFound, "%s", msg)
}
if count > 1 {
return nil, errors.Wrapf(cloudprovider.ErrDuplicateId, suffix)
return nil, errors.Wrapf(cloudprovider.ErrDuplicateId, "%s", msg)
}
zone := &SZone{}
zone.SetModelManager(ZoneManager, zone)

View File

@@ -108,7 +108,7 @@ func syncRegionQuotas(ctx context.Context, userCred mcclient.TokenCredential, sy
return nil
}
msg := fmt.Sprintf("GetICloudQuotas for region %s failed %s", remoteRegion.GetName(), err)
log.Errorf(msg)
log.Errorf("%s", msg)
return err
}
result := func() compare.SyncResult {
@@ -119,9 +119,9 @@ func syncRegionQuotas(ctx context.Context, userCred mcclient.TokenCredential, sy
msg := result.Result()
notes := fmt.Sprintf("SyncQuotas for region %s result: %s", localRegion.Name, msg)
provider.SyncError(result, notes, userCred)
log.Infof(notes)
log.Infof("%s", notes)
if result.IsError() {
return fmt.Errorf(msg)
return fmt.Errorf("%s", msg)
}
return nil
}
@@ -133,7 +133,7 @@ func syncRegionZones(ctx context.Context, userCred mcclient.TokenCredential, syn
}()
if err != nil {
msg := fmt.Sprintf("GetZones for region %s failed %s", remoteRegion.GetName(), err)
log.Errorf(msg)
log.Errorf("%s", msg)
return nil, nil, err
}
localZones, remoteZones, result := func() ([]SZone, []cloudprovider.ICloudZone, compare.SyncResult) {
@@ -143,7 +143,7 @@ func syncRegionZones(ctx context.Context, userCred mcclient.TokenCredential, syn
syncResults.Add(ZoneManager, result)
msg := result.Result()
notes := fmt.Sprintf("SyncZones for region %s result: %s", localRegion.Name, msg)
log.Infof(notes)
log.Infof("%s", notes)
provider.SyncError(result, notes, userCred)
db.OpsLog.LogEvent(provider, db.ACT_SYNC_HOST_COMPLETE, msg, userCred)
return localZones, remoteZones, nil
@@ -216,7 +216,7 @@ func syncRegionEips(
return
}
msg := fmt.Sprintf("GetIEips for region %s failed %s", remoteRegion.GetName(), err)
log.Errorf(msg)
log.Errorf("%s", msg)
return
}
@@ -229,7 +229,7 @@ func syncRegionEips(
msg := result.Result()
notes := fmt.Sprintf("SyncEips for region %s result: %s", localRegion.Name, msg)
log.Infof(msg)
log.Infof("%s", msg)
provider.SyncError(result, notes, userCred)
if result.IsError() {
return
@@ -246,7 +246,7 @@ func syncRegionBuckets(ctx context.Context, userCred mcclient.TokenCredential, s
return
}
msg := fmt.Sprintf("GetIBuckets for region %s failed %s", remoteRegion.GetName(), err)
log.Errorf(msg)
log.Errorf("%s", msg)
return
}
@@ -259,7 +259,7 @@ func syncRegionBuckets(ctx context.Context, userCred mcclient.TokenCredential, s
msg := result.Result()
notes := fmt.Sprintf("GetIBuckets for region %s result: %s", localRegion.Name, msg)
log.Infof(notes)
log.Infof("%s", notes)
provider.SyncError(result, notes, userCred)
if result.IsError() {
return
@@ -285,7 +285,7 @@ func syncRegionVPCs(
return
}
msg := fmt.Sprintf("GetVpcs for region %s failed %s", remoteRegion.GetName(), err)
log.Errorf(msg)
log.Errorf("%s", msg)
return
}
@@ -298,7 +298,7 @@ func syncRegionVPCs(
msg := result.Result()
notes := fmt.Sprintf("SyncVPCs for region %s result: %s", localRegion.Name, msg)
log.Infof(notes)
log.Infof("%s", notes)
provider.SyncError(result, notes, userCred)
if result.IsError() {
return
@@ -348,7 +348,7 @@ func syncRegionAccessGroups(ctx context.Context, userCred mcclient.TokenCredenti
syncResults.Add(AccessGroupManager, result)
msg := result.Result()
notes := fmt.Sprintf("Sync Access Group for region %s result: %s", localRegion.Name, msg)
log.Infof(notes)
log.Infof("%s", notes)
provider.SyncError(result, notes, userCred)
}
@@ -381,7 +381,7 @@ func syncRegionFileSystems(
msg := result.Result()
notes := fmt.Sprintf("Sync FileSystem for region %s result: %s", localRegion.Name, msg)
log.Infof(msg)
log.Infof("%s", notes)
provider.SyncError(result, notes, userCred)
for j := 0; j < len(localFSs); j += 1 {
@@ -416,7 +416,7 @@ func syncFileSystemMountTargets(
}
result := localFs.SyncMountTargets(ctx, userCred, mountTargets, xor)
notes := fmt.Sprintf("SyncMountTargets for FileSystem %s result: %s", localFs.Name, result.Result())
log.Infof(notes)
log.Infof("%s", notes)
}
func syncVpcPeerConnections(
@@ -464,7 +464,7 @@ func syncVpcPeerConnections(
syncResults.Add(VpcPeeringConnectionManager, backSyncResult)
notes := fmt.Sprintf("SyncVpcPeeringConnections for vpc %s result: %s", localVpc.Name, result.Result())
log.Infof(notes)
log.Infof("%s", notes)
provider.SyncError(result, notes, userCred)
if result.IsError() {
return
@@ -486,7 +486,7 @@ func syncRegionSecGroup(
}()
if err != nil {
msg := fmt.Sprintf("GetISecurityGroups for region %s failed %s", localRegion.Name, err)
log.Errorf(msg)
log.Errorf("%s", msg)
return
}
groups := []cloudprovider.ICloudSecurityGroup{}
@@ -506,7 +506,7 @@ func syncRegionSecGroup(
msg := result.Result()
notes := fmt.Sprintf("SyncSecurityGroup for region %s result: %s", localRegion.Name, msg)
log.Infof(notes)
log.Infof("%s", notes)
provider.SyncError(result, notes, userCred)
if result.IsError() {
return
@@ -529,7 +529,7 @@ func syncVpcSecGroup(
}()
if err != nil {
msg := fmt.Sprintf("GetISecurityGroups for vpc %s failed %s", remoteVpc.GetId(), err)
log.Errorf(msg)
log.Errorf("%s", msg)
return
}
@@ -550,7 +550,7 @@ func syncVpcSecGroup(
msg := result.Result()
notes := fmt.Sprintf("SyncSecurityGroup for VPC %s result: %s", localVpc.Name, msg)
log.Infof(notes)
log.Infof("%s", notes)
provider.SyncError(result, notes, userCred)
if result.IsError() {
return
@@ -564,7 +564,7 @@ func syncVpcRouteTables(ctx context.Context, userCred mcclient.TokenCredential,
}()
if err != nil {
msg := fmt.Sprintf("GetIRouteTables for vpc %s failed %s", remoteVpc.GetId(), err)
log.Errorf(msg)
log.Errorf("%s", msg)
return
}
localRouteTables, remoteRouteTables, result := func() ([]SRouteTable, []cloudprovider.ICloudRouteTable, compare.SyncResult) {
@@ -576,7 +576,7 @@ func syncVpcRouteTables(ctx context.Context, userCred mcclient.TokenCredential,
msg := result.Result()
notes := fmt.Sprintf("SyncRouteTables for VPC %s result: %s", localVpc.Name, msg)
log.Infof(notes)
log.Infof("%s", notes)
provider.SyncError(result, notes, userCred)
if result.IsError() {
return
@@ -602,7 +602,7 @@ func syncIPv6Gateways(ctx context.Context, userCred mcclient.TokenCredential, sy
}()
if err != nil {
msg := fmt.Sprintf("GetICloudIPv6Gateways for vpc %s failed %s", remoteVpc.GetId(), err)
log.Errorf(msg)
log.Errorf("%s", msg)
return
}
result := func() compare.SyncResult {
@@ -614,7 +614,7 @@ func syncIPv6Gateways(ctx context.Context, userCred mcclient.TokenCredential, sy
msg := result.Result()
notes := fmt.Sprintf("SyncIPv6Gateways for VPC %s result: %s", localVpc.Name, msg)
log.Infof(notes)
log.Infof("%s", notes)
provider.SyncError(result, notes, userCred)
if result.IsError() {
return
@@ -631,7 +631,7 @@ func syncVpcNatgateways(ctx context.Context, userCred mcclient.TokenCredential,
return
}
msg := fmt.Sprintf("GetINatGateways for vpc %s failed %s", remoteVpc.GetId(), err)
log.Errorf(msg)
log.Errorf("%s", msg)
return
}
localNatGateways, remoteNatGateways, result := func() ([]SNatGateway, []cloudprovider.ICloudNatGateway, compare.SyncResult) {
@@ -643,7 +643,7 @@ func syncVpcNatgateways(ctx context.Context, userCred mcclient.TokenCredential,
msg := result.Result()
notes := fmt.Sprintf("SyncNatGateways for VPC %s result: %s", localVpc.Name, msg)
log.Infof(notes)
log.Infof("%s", notes)
provider.SyncError(result, notes, userCred)
if result.IsError() {
return
@@ -671,13 +671,13 @@ func syncNatGatewayEips(ctx context.Context, userCred mcclient.TokenCredential,
eips, err := remoteNatGateway.GetIEips()
if err != nil {
msg := fmt.Sprintf("GetIEIPs for NatGateway %s failed %s", remoteNatGateway.GetName(), err)
log.Errorf(msg)
log.Errorf("%s", msg)
return
}
result := localNatGateway.SyncNatGatewayEips(ctx, userCred, provider, eips)
msg := result.Result()
notes := fmt.Sprintf("SyncNatGatewayEips for NatGateway %s result: %s", localNatGateway.Name, msg)
log.Infof(notes)
log.Infof("%s", notes)
provider.SyncError(result, notes, userCred)
if result.IsError() {
return
@@ -696,13 +696,13 @@ func syncNatDTable(
dtable, err := remoteNatGateway.GetINatDTable()
if err != nil {
msg := fmt.Sprintf("GetINatDTable for NatGateway %s failed %s", remoteNatGateway.GetName(), err)
log.Errorf(msg)
log.Errorf("%s", msg)
return
}
result := NatDEntryManager.SyncNatDTable(ctx, userCred, provider, localNatGateway, dtable, xor)
msg := result.Result()
notes := fmt.Sprintf("SyncNatDTable for NatGateway %s result: %s", localNatGateway.Name, msg)
log.Infof(notes)
log.Infof("%s", notes)
provider.SyncError(result, notes, userCred)
if result.IsError() {
return
@@ -721,13 +721,13 @@ func syncNatSTable(
stable, err := remoteNatGateway.GetINatSTable()
if err != nil {
msg := fmt.Sprintf("GetINatSTable for NatGateway %s failed %s", remoteNatGateway.GetName(), err)
log.Errorf(msg)
log.Errorf("%s", msg)
return
}
result := NatSEntryManager.SyncNatSTable(ctx, userCred, provider, localNatGateway, stable, xor)
msg := result.Result()
notes := fmt.Sprintf("SyncNatSTable for NatGateway %s result: %s", localNatGateway.Name, msg)
log.Infof(notes)
log.Infof("%s", notes)
provider.SyncError(result, notes, userCred)
if result.IsError() {
return
@@ -746,7 +746,7 @@ func syncVpcWires(ctx context.Context, userCred mcclient.TokenCredential, syncRe
}()
if err != nil {
msg := fmt.Sprintf("GetIWires for vpc %s failed %s", remoteVpc.GetId(), err)
log.Errorf(msg)
log.Errorf("%s", msg)
return
}
localWires, remoteWires, result := func() ([]SWire, []cloudprovider.ICloudWire, compare.SyncResult) {
@@ -764,7 +764,7 @@ func syncVpcWires(ctx context.Context, userCred mcclient.TokenCredential, syncRe
msg := result.Result()
notes := fmt.Sprintf("SyncWires for VPC %s result: %s", localVpc.Name, msg)
log.Infof(notes)
log.Infof("%s", notes)
provider.SyncError(result, notes, userCred)
if result.IsError() {
return
@@ -799,7 +799,7 @@ func syncWireNetworks(ctx context.Context, userCred mcclient.TokenCredential, sy
}()
if err != nil {
msg := fmt.Sprintf("GetINetworks for wire %s failed %s", remoteWire.GetId(), err)
log.Errorf(msg)
log.Errorf("%s", msg)
return
}
_, _, result := func() ([]SNetwork, []cloudprovider.ICloudNetwork, compare.SyncResult) {
@@ -817,7 +817,7 @@ func syncWireNetworks(ctx context.Context, userCred mcclient.TokenCredential, sy
msg := result.Result()
notes := fmt.Sprintf("SyncNetworks for wire %s result: %s", localWire.Name, msg)
log.Infof(notes)
log.Infof("%s", notes)
provider.SyncError(result, notes, userCred)
if result.IsError() {
return
@@ -841,7 +841,7 @@ func syncZoneStorages(
}()
if err != nil {
msg := fmt.Sprintf("GetIStorages for zone %s failed %s", remoteZone.GetName(), err)
log.Errorf(msg)
log.Errorf("%s", msg)
return nil
}
localStorages, remoteStorages, result := func() ([]SStorage, []cloudprovider.ICloudStorage, compare.SyncResult) {
@@ -853,7 +853,7 @@ func syncZoneStorages(
msg := result.Result()
notes := fmt.Sprintf("SyncStorages for zone %s result: %s", localZone.Name, msg)
log.Infof(notes)
log.Infof("%s", notes)
provider.SyncError(result, notes, userCred)
if result.IsError() {
return nil
@@ -920,7 +920,7 @@ func syncStorageDisks(ctx context.Context, userCred mcclient.TokenCredential, sy
}()
if err != nil {
msg := fmt.Sprintf("GetIDisks for storage %s failed %s", remoteStorage.GetName(), err)
log.Errorf(msg)
log.Errorf("%s", msg)
return
}
_, _, result := func() ([]SDisk, []cloudprovider.ICloudDisk, compare.SyncResult) {
@@ -932,7 +932,7 @@ func syncStorageDisks(ctx context.Context, userCred mcclient.TokenCredential, sy
msg := result.Result()
notes := fmt.Sprintf("SyncDisks for storage %s result: %s", localStorage.Name, msg)
log.Infof(notes)
log.Infof("%s", notes)
provider.SyncError(result, notes, userCred)
if result.IsError() {
return
@@ -956,7 +956,7 @@ func syncZoneHosts(
}()
if err != nil {
msg := fmt.Sprintf("GetIHosts for zone %s failed %s", remoteZone.GetName(), err)
log.Errorf(msg)
log.Errorf("%s", msg)
return nil
}
localHosts, remoteHosts, result := func() ([]SHost, []cloudprovider.ICloudHost, compare.SyncResult) {
@@ -968,7 +968,7 @@ func syncZoneHosts(
msg := result.Result()
notes := fmt.Sprintf("SyncHosts for zone %s result: %s", localZone.Name, msg)
log.Infof(notes)
log.Infof("%s", notes)
provider.SyncError(result, notes, userCred)
if result.IsError() {
return nil
@@ -1007,7 +1007,7 @@ func syncHostStorages(ctx context.Context, userCred mcclient.TokenCredential, sy
}()
if err != nil {
msg := fmt.Sprintf("GetIStorages for host %s failed %s", remoteHost.GetName(), err)
log.Errorf(msg)
log.Errorf("%s", msg)
return nil
}
localStorages, remoteStorages, result := func() ([]SStorage, []cloudprovider.ICloudStorage, compare.SyncResult) {
@@ -1019,7 +1019,7 @@ func syncHostStorages(ctx context.Context, userCred mcclient.TokenCredential, sy
msg := result.Result()
notes := fmt.Sprintf("SyncHostStorages for host %s result: %s", localHost.Name, msg)
log.Infof(notes)
log.Infof("%s", notes)
provider.SyncError(result, notes, userCred)
if result.IsError() {
return nil
@@ -1053,7 +1053,7 @@ func syncHostStorages(ctx context.Context, userCred mcclient.TokenCredential, sy
}()
if err != nil {
msg := fmt.Sprintf("GetIWires for host %s failed %s", remoteHost.GetName(), err)
log.Errorf(msg)
log.Errorf("%s", msg)
return
}
result := func() compare.SyncResult {
@@ -1071,7 +1071,7 @@ func syncHostStorages(ctx context.Context, userCred mcclient.TokenCredential, sy
msg := result.Result()
notes := fmt.Sprintf("SyncHostWires/NetInterfaces for host %s result: %s", localHost.Name, msg)
log.Infof(notes)
log.Infof("%s", notes)
provider.SyncError(result, notes, userCred)
if result.IsError() {
return
@@ -1086,7 +1086,7 @@ func syncHostVMs(ctx context.Context, userCred mcclient.TokenCredential, syncRes
}()
if err != nil {
msg := fmt.Sprintf("GetIVMs for host %s failed %s", remoteHost.GetName(), err)
log.Errorf(msg)
log.Errorf("%s", msg)
return
}
@@ -1099,7 +1099,7 @@ func syncHostVMs(ctx context.Context, userCred mcclient.TokenCredential, syncRes
msg := result.Result()
notes := fmt.Sprintf("SyncHostVMs for host %s result: %s", localHost.Name, msg)
log.Infof(notes)
log.Infof("%s", notes)
provider.SyncError(result, notes, userCred)
for i := 0; i < len(syncVMPairs); i += 1 {
@@ -1136,7 +1136,7 @@ func syncHostIsolateDevices(ctx context.Context, userCred mcclient.TokenCredenti
return
}
msg := fmt.Sprintf("GetIsolateDevices for host %s failed %s", remoteHost.GetName(), err)
log.Errorf(msg)
log.Errorf("%s", msg)
return
}
@@ -1149,7 +1149,7 @@ func syncHostIsolateDevices(ctx context.Context, userCred mcclient.TokenCredenti
msg := result.Result()
notes := fmt.Sprintf("SyncHostIsolateDevices for host %s result: %s", localHost.Name, msg)
log.Infof(notes)
log.Infof("%s", notes)
provider.SyncError(result, notes, userCred)
}
@@ -1209,7 +1209,7 @@ func syncVMNics(
result := localVM.SyncVMNics(ctx, userCred, host, nics, nil)
msg := result.Result()
notes := fmt.Sprintf("syncVMNics for VM %s result: %s", localVM.Name, msg)
log.Infof(notes)
log.Infof("%s", notes)
if result.IsError() {
return result.AllError()
}
@@ -1232,7 +1232,7 @@ func syncVMDisks(
result := localVM.SyncVMDisks(ctx, userCred, driver, host, disks, provider.GetOwnerId())
msg := result.Result()
notes := fmt.Sprintf("syncVMDisks for VM %s result: %s", localVM.Name, msg)
log.Infof(notes)
log.Infof("%s", notes)
if result.IsError() {
return result.AllError()
}
@@ -1310,7 +1310,7 @@ func (self *SGuest) SyncVMIsolateDevices(ctx context.Context, userCred mcclient.
}
msg := result.Result()
notes := fmt.Sprintf("syncHostIsolateDevices for VM %s result: %s", self.Name, msg)
log.Infof(notes)
log.Infof("%s", notes)
return nil
}
@@ -1325,7 +1325,7 @@ func syncSkusFromPrivateCloud(
skus, err := remoteRegion.GetISkus()
if err != nil {
msg := fmt.Sprintf("GetISkus for region %s(%s) failed %v", region.Name, region.Id, err)
log.Errorf(msg)
log.Errorf("%s", msg)
return
}
@@ -1359,7 +1359,7 @@ func syncRegionDBInstances(
}()
if err != nil {
msg := fmt.Sprintf("GetIDBInstances for region %s failed %s", remoteRegion.GetName(), err)
log.Errorf(msg)
log.Errorf("%s", msg)
return
}
localInstances, remoteInstances, result := func() ([]SDBInstance, []cloudprovider.ICloudDBInstance, compare.SyncResult) {
@@ -1372,7 +1372,7 @@ func syncRegionDBInstances(
msg := result.Result()
notes := fmt.Sprintf("SyncDBInstances for region %s result: %s", localRegion.Name, msg)
log.Infof(notes)
log.Infof("%s", notes)
provider.SyncError(result, notes, userCred)
if result.IsError() {
return
@@ -1402,7 +1402,7 @@ func syncDBInstanceSkus(ctx context.Context, userCred mcclient.TokenCredential,
return
}
msg := fmt.Sprintf("GetIDBInstanceSkus for region %s failed %s", remoteRegion.GetName(), err)
log.Errorf(msg)
log.Errorf("%s", msg)
return
}
result := func() compare.SyncResult {
@@ -1414,7 +1414,7 @@ func syncDBInstanceSkus(ctx context.Context, userCred mcclient.TokenCredential,
msg := result.Result()
notes := fmt.Sprintf("sync rds sku for region %s result: %s", localRegion.Name, msg)
log.Infof(notes)
log.Infof("%s", notes)
provider.SyncError(result, notes, userCred)
if result.IsError() {
return
@@ -1431,7 +1431,7 @@ func syncNATSkus(ctx context.Context, userCred mcclient.TokenCredential, syncRes
return
}
msg := fmt.Sprintf("GetINatSkus for region %s failed %s", remoteRegion.GetName(), err)
log.Errorf(msg)
log.Errorf("%s", msg)
return
}
result := func() compare.SyncResult {
@@ -1443,7 +1443,7 @@ func syncNATSkus(ctx context.Context, userCred mcclient.TokenCredential, syncRes
msg := result.Result()
notes := fmt.Sprintf("SyncNatSkus for region %s result: %s", localRegion.Name, msg)
log.Infof(notes)
log.Infof("%s", notes)
provider.SyncError(result, notes, userCred)
if result.IsError() {
return
@@ -1460,7 +1460,7 @@ func syncCacheSkus(ctx context.Context, userCred mcclient.TokenCredential, syncR
return
}
msg := fmt.Sprintf("GetIElasticcacheSkus for region %s failed %s", remoteRegion.GetName(), err)
log.Errorf(msg)
log.Errorf("%s", msg)
return
}
result := func() compare.SyncResult {
@@ -1472,7 +1472,7 @@ func syncCacheSkus(ctx context.Context, userCred mcclient.TokenCredential, syncR
msg := result.Result()
notes := fmt.Sprintf("SyncRedisSkus for region %s result: %s", localRegion.Name, msg)
log.Infof(notes)
log.Infof("%s", notes)
provider.SyncError(result, notes, userCred)
if result.IsError() {
return
@@ -1708,7 +1708,7 @@ func syncWafIPSets(
return nil
}
msg := fmt.Sprintf("GetICloudWafIPSets for region %s failed %s", remoteRegion.GetName(), err)
log.Errorf(msg)
log.Errorf("%s", msg)
return err
}
@@ -1719,7 +1719,7 @@ func syncWafIPSets(
syncResults.Add(WafIPSetManager, result)
notes := fmt.Sprintf("SyncWafIPSets for region %s result: %s", localRegion.Name, result.Result())
log.Infof(notes)
log.Infof("%s", notes)
provider.SyncError(result, notes, userCred)
if result.IsError() {
return result.AllError()
@@ -1745,7 +1745,7 @@ func syncWafRegexSets(
return nil
}
msg := fmt.Sprintf("GetICloudWafRegexSets for region %s failed %s", remoteRegion.GetName(), err)
log.Errorf(msg)
log.Errorf("%s", msg)
return err
}
result := func() compare.SyncResult {
@@ -1754,7 +1754,7 @@ func syncWafRegexSets(
}()
syncResults.Add(WafRegexSetManager, result)
notes := fmt.Sprintf("SyncWafRegexSets for region %s result: %s", localRegion.Name, result.Result())
log.Infof(notes)
log.Infof("%s", notes)
provider.SyncError(result, notes, userCred)
if result.IsError() {
return result.AllError()
@@ -1777,7 +1777,7 @@ func syncMongoDBs(
}()
if err != nil {
msg := fmt.Sprintf("GetICloudMongoDBs for region %s failed %s", remoteRegion.GetName(), err)
log.Errorf(msg)
log.Errorf("%s", msg)
return err
}
@@ -1788,7 +1788,7 @@ func syncMongoDBs(
syncResults.Add(MongoDBManager, result)
msg := result.Result()
notes := fmt.Sprintf("SyncMongoDBs for region %s result: %s", localRegion.Name, msg)
log.Infof(notes)
log.Infof("%s", notes)
provider.SyncError(result, notes, userCred)
if result.IsError() {
return result.AllError()
@@ -1812,7 +1812,7 @@ func syncElasticSearchs(
}()
if err != nil {
msg := fmt.Sprintf("GetIElasticSearchs for region %s failed %s", remoteRegion.GetName(), err)
log.Errorf(msg)
log.Errorf("%s", msg)
return err
}
@@ -1823,7 +1823,7 @@ func syncElasticSearchs(
syncResults.Add(ElasticSearchManager, result)
msg := result.Result()
notes := fmt.Sprintf("SyncElasticSearchs for region %s result: %s", localRegion.Name, msg)
log.Infof(notes)
log.Infof("%s", notes)
provider.SyncError(result, notes, userCred)
if result.IsError() {
return result.AllError()
@@ -1846,7 +1846,7 @@ func syncKafkas(
}()
if err != nil {
msg := fmt.Sprintf("GetICloudKafkas for region %s failed %s", remoteRegion.GetName(), err)
log.Errorf(msg)
log.Errorf("%s", msg)
return err
}
@@ -1857,7 +1857,7 @@ func syncKafkas(
syncResults.Add(KafkaManager, result)
msg := result.Result()
notes := fmt.Sprintf("SyncKafkas for region %s result: %s", localRegion.Name, msg)
log.Infof(notes)
log.Infof("%s", notes)
provider.SyncError(result, notes, userCred)
if result.IsError() {
return result.AllError()
@@ -1880,7 +1880,7 @@ func syncApps(
}()
if err != nil {
msg := fmt.Sprintf("GetICloudApps for region %s failed %s", remoteRegion.GetName(), err)
log.Errorf(msg)
log.Errorf("%s", msg)
return err
}
result := func() compare.SyncResult {
@@ -1890,7 +1890,7 @@ func syncApps(
syncResults.Add(AppManager, result)
msg := result.Result()
notes := fmt.Sprintf("SyncApps for region %s result: %s", localRegion.Name, msg)
log.Infof(notes)
log.Infof("%s", notes)
provider.SyncError(result, notes, userCred)
if result.IsError() {
return result.AllError()
@@ -1913,7 +1913,7 @@ func syncKubeClusters(
}()
if err != nil {
msg := fmt.Sprintf("GetICloudKubeClusters for region %s failed %s", remoteRegion.GetName(), err)
log.Errorf(msg)
log.Errorf("%s", msg)
return err
}
localClusters, remoteClusters, result := func() ([]SKubeCluster, []cloudprovider.ICloudKubeCluster, compare.SyncResult) {
@@ -1923,7 +1923,7 @@ func syncKubeClusters(
syncResults.Add(KubeClusterManager, result)
msg := result.Result()
notes := fmt.Sprintf("SyncKubeClusters for region %s result: %s", localRegion.Name, msg)
log.Infof(notes)
log.Infof("%s", notes)
provider.SyncError(result, notes, userCred)
if result.IsError() {
return result.AllError()
@@ -1962,7 +1962,7 @@ func syncKubeClusterNodePools(ctx context.Context, userCred mcclient.TokenCreden
}()
if err != nil {
msg := fmt.Sprintf("GetICloudKubeNodePools for cluster %s failed %s", cluster.GetName(), err)
log.Errorf(msg)
log.Errorf("%s", msg)
return err
}
@@ -1973,7 +1973,7 @@ func syncKubeClusterNodePools(ctx context.Context, userCred mcclient.TokenCreden
syncResults.Add(KubeNodePoolManager, result)
msg := result.Result()
notes := fmt.Sprintf("SyncKubeNodePools for cluster %s result: %s", cluster.Name, msg)
log.Infof(notes)
log.Infof("%s", notes)
if result.IsError() {
return result.AllError()
}
@@ -1988,7 +1988,7 @@ func syncKubeClusterNodes(ctx context.Context, userCred mcclient.TokenCredential
}()
if err != nil {
msg := fmt.Sprintf("GetICloudKubeNodes for cluster %s failed %s", cluster.GetName(), err)
log.Errorf(msg)
log.Errorf("%s", msg)
return err
}
@@ -1997,8 +1997,8 @@ func syncKubeClusterNodes(ctx context.Context, userCred mcclient.TokenCredential
return cluster.SyncKubeNodes(ctx, userCred, iNodes)
}()
syncResults.Add(KubeNodeManager, result)
msg := result.Result()
log.Infof("SyncKubeNodes for cluster %s result: %s", cluster.Name, msg)
notes := fmt.Sprintf("SyncKubeNodes for cluster %s result: %s", cluster.Name, result.Result())
log.Infof("%s", notes)
if result.IsError() {
return result.AllError()
}
@@ -2021,7 +2021,7 @@ func syncWafInstances(
}()
if err != nil {
msg := fmt.Sprintf("GetICloudWafInstances for region %s failed %s", remoteRegion.GetName(), err)
log.Errorf(msg)
log.Errorf("%s", msg)
return err
}
@@ -2032,7 +2032,7 @@ func syncWafInstances(
syncResults.Add(WafInstanceManager, result)
msg := result.Result()
notes := fmt.Sprintf("SyncWafInstances for region %s result: %s", localRegion.Name, msg)
log.Infof(notes)
log.Infof("%s", notes)
provider.SyncError(result, notes, userCred)
if result.IsError() {
return result.AllError()
@@ -2049,7 +2049,7 @@ func syncWafInstances(
err = syncWafRules(ctx, userCred, syncResults, &localWafs[i], remoteWafs[i])
if err != nil {
log.Errorf("syncDBInstanceAccountPrivileges error: %v", err)
log.Errorf("syncWafRules error: %v", err)
}
}()
@@ -2068,7 +2068,7 @@ func syncWafRules(ctx context.Context, userCred mcclient.TokenCredential, syncRe
return nil
}
msg := fmt.Sprintf("GetRules for waf instance %s failed %s", localWaf.Name, err)
log.Errorf(msg)
log.Errorf("%s", msg)
return err
}
result := func() compare.SyncResult {
@@ -2077,7 +2077,8 @@ func syncWafRules(ctx context.Context, userCred mcclient.TokenCredential, syncRe
}()
syncResults.Add(WafRuleManager, result)
msg := result.Result()
log.Infof("SyncWafRules for waf %s result: %s", localWaf.Name, msg)
notes := fmt.Sprintf("SyncWafRules for waf %s result: %s", localWaf.Name, msg)
log.Infof("%s", notes)
if result.IsError() {
return result.AllError()
}
@@ -2102,7 +2103,7 @@ func syncRegionSnapshots(
return
}
msg := fmt.Sprintf("GetISnapshots for region %s failed %s", remoteRegion.GetName(), err)
log.Errorf(msg)
log.Errorf("%s", msg)
return
}
@@ -2115,7 +2116,7 @@ func syncRegionSnapshots(
msg := result.Result()
notes := fmt.Sprintf("SyncSnapshots for region %s result: %s", localRegion.Name, msg)
log.Infof(notes)
log.Infof("%s", notes)
provider.SyncError(result, notes, userCred)
if result.IsError() {
return
@@ -2139,7 +2140,8 @@ func syncRegionSnapshotPolicies(
if errors.Cause(err) == cloudprovider.ErrNotImplemented || errors.Cause(err) == cloudprovider.ErrNotSupported {
return
}
log.Errorf("GetISnapshotPolicies for region %s failed %s", remoteRegion.GetName(), err)
msg := fmt.Sprintf("GetISnapshotPolicies for region %s failed %s", remoteRegion.GetName(), err)
log.Errorf("%s", msg)
return
}
@@ -2150,7 +2152,7 @@ func syncRegionSnapshotPolicies(
syncResults.Add(SnapshotPolicyManager, result)
msg := result.Result()
notes := fmt.Sprintf("SyncSnapshotPolicies for region %s result: %s", localRegion.Name, msg)
log.Infof(notes)
log.Infof("%s", notes)
provider.SyncError(result, notes, userCred)
if result.IsError() {
return
@@ -2175,7 +2177,7 @@ func syncRegionNetworkInterfaces(
return
}
msg := fmt.Sprintf("GetINetworkInterfaces for region %s failed %s", remoteRegion.GetName(), err)
log.Errorf(msg)
log.Errorf("%s", msg)
return
}
@@ -2187,7 +2189,7 @@ func syncRegionNetworkInterfaces(
msg := result.Result()
notes := fmt.Sprintf("SyncNetworkInterfaces for region %s result: %s", localRegion.Name, msg)
log.Infof(notes)
log.Infof("%s", notes)
provider.SyncError(result, notes, userCred)
if result.IsError() {
return
@@ -2214,14 +2216,14 @@ func syncInterfaceAddresses(ctx context.Context, userCred mcclient.TokenCredenti
return
}
msg := fmt.Sprintf("GetICloudInterfaceAddresses for networkinterface %s failed %s", remoteInterface.GetName(), err)
log.Errorf(msg)
log.Errorf("%s", msg)
return
}
result := NetworkinterfacenetworkManager.SyncInterfaceAddresses(ctx, userCred, localInterface, addresses)
msg := result.Result()
notes := fmt.Sprintf("SyncInterfaceAddresses for networkinterface %s result: %s", localInterface.Name, msg)
log.Infof(notes)
log.Infof("%s", notes)
if result.IsError() {
return
}
@@ -2456,9 +2458,8 @@ func syncPublicCloudProviderInfo(
syncResults.Add(CachedimageManager, result)
msg := result.Result()
notes := fmt.Sprintf("syncCloudImages for %s result: %s", storageCachePairs[i].local.GetName(), msg)
log.Infof(notes)
notes := fmt.Sprintf("syncCloudImages for %s result: %s", storageCachePairs[i].local.GetName(), result.Result())
log.Infof("%s", notes)
provider.SyncError(result, notes, userCred)
}
}
@@ -2478,14 +2479,14 @@ func getZoneForOnPremiseCloudRegion(ctx context.Context, userCred mcclient.Token
accessIp := extHost.GetAccessIp()
if len(accessIp) == 0 {
msg := fmt.Sprintf("fail to find wire for host %s: empty host access ip", extHost.GetName())
log.Errorf(msg)
log.Errorf("%s", msg)
continue
}
ips = append(ips, accessIp)
wire, err := WireManager.GetOnPremiseWireOfIp(accessIp)
if err != nil {
msg := fmt.Sprintf("fail to find wire for host %s %s: %s", extHost.GetName(), accessIp, err)
log.Errorf(msg)
log.Errorf("%s", msg)
continue
}
return wire.GetZone()
@@ -2497,7 +2498,7 @@ func syncOnPremiseCloudProviderStorage(ctx context.Context, userCred mcclient.To
istorages, err := iregion.GetIStorages()
if err != nil {
msg := fmt.Sprintf("GetIStorages for provider %s failed %s", provider.GetName(), err)
log.Errorf(msg)
log.Errorf("%s", msg)
return nil
}
localStorages, remoteStorages, result := StorageManager.SyncStorages(ctx, userCred, provider, zone, istorages, syncRange.Xor)
@@ -2505,7 +2506,7 @@ func syncOnPremiseCloudProviderStorage(ctx context.Context, userCred mcclient.To
msg := result.Result()
notes := fmt.Sprintf("SyncStorages for provider %s result: %s", provider.Name, msg)
log.Infof(notes)
log.Infof("%s", notes)
provider.SyncError(result, notes, userCred)
if result.IsError() {
return nil
@@ -2553,7 +2554,7 @@ func syncOnPremiseCloudProviderInfo(
iregion, err := driver.GetOnPremiseIRegion()
if err != nil {
msg := fmt.Sprintf("GetOnPremiseIRegion for provider %s failed %s", provider.GetName(), err)
log.Errorf(msg)
log.Errorf("%s", msg)
return err
}
@@ -2580,7 +2581,7 @@ func syncOnPremiseCloudProviderInfo(
zone, err := getZoneForOnPremiseCloudRegion(ctx, userCred, iregion)
if err != nil {
msg := fmt.Sprintf("Can't get zone for Premise cloud region %s error: %v", iregion.GetName(), err)
log.Errorf(msg)
log.Errorf("%s", msg)
return errors.Wrap(err, "getZoneForOnPremiseCloudRegion")
}
@@ -2588,7 +2589,7 @@ func syncOnPremiseCloudProviderInfo(
remoteVpcs, err := iregion.GetIVpcs()
if err != nil {
msg := fmt.Sprintf("GetIVpcs for provider %s failed %s", provider.GetName(), err)
log.Errorf(msg)
log.Errorf("%s", msg)
return err
}
{
@@ -2607,7 +2608,7 @@ func syncOnPremiseCloudProviderInfo(
}()
if err != nil {
msg := fmt.Sprintf("GetIHosts for provider %s failed %s", provider.GetName(), err)
log.Errorf(msg)
log.Errorf("%s", msg)
return err
}
@@ -2618,9 +2619,8 @@ func syncOnPremiseCloudProviderInfo(
syncResults.Add(HostManager, result)
msg := result.Result()
notes := fmt.Sprintf("SyncHosts for provider %s result: %s", provider.Name, msg)
log.Infof(notes)
notes := fmt.Sprintf("SyncHosts for provider %s result: %s", provider.Name, result.Result())
log.Infof("%s", notes)
provider.SyncError(result, notes, userCred)
for i := 0; i < len(localHosts); i += 1 {
@@ -2648,9 +2648,8 @@ func syncOnPremiseCloudProviderInfo(
}()
syncResults.Add(CachedimageManager, result)
msg := result.Result()
notes := fmt.Sprintf("syncCloudImages for stroagecache %s result: %s", storageCachePairs[i].local.GetId(), msg)
log.Infof(notes)
notes := fmt.Sprintf("syncCloudImages for stroagecache %s result: %s", storageCachePairs[i].local.GetId(), result.Result())
log.Infof("%s", notes)
provider.SyncError(result, notes, userCred)
// }
}
@@ -2669,14 +2668,8 @@ func syncHostNics(ctx context.Context, userCred mcclient.TokenCredential, syncRe
if syncResults != nil {
syncResults.Add(NetInterfaceManager, result)
}
msg := result.Result()
notes := fmt.Sprintf("SyncHostExternalNics for host %s result: %s", localHost.Name, msg)
log.Infof(notes)
if result.IsError() {
return
} else {
log.Infof(notes)
}
notes := fmt.Sprintf("SyncHostExternalNics for host %s result: %s", localHost.Name, result.Result())
log.Infof("%s", notes)
}
func (manager *SCloudproviderregionManager) fetchRecordsByQuery(q *sqlchemy.SQuery) []SCloudproviderregion {
@@ -2791,9 +2784,8 @@ func syncProjects(ctx context.Context, userCred mcclient.TokenCredential, syncRe
syncResults.Add(ExternalProjectManager, result)
msg := result.Result()
notes := fmt.Sprintf("SyncProjects for manager %s result: %s", cp.Name, msg)
log.Infof(notes)
notes := fmt.Sprintf("SyncProjects for manager %s result: %s", cp.Name, result.Result())
log.Infof("%s", notes)
cp.SyncError(result, notes, userCred)
if result.IsError() {
return err
@@ -2864,7 +2856,7 @@ func syncCdnDomains(ctx context.Context, userCred mcclient.TokenCredential, sync
result := provider.SyncCDNDomains(ctx, userCred, domains, xor)
notes := fmt.Sprintf("Sync CDN for provider %s result: %s", provider.Name, result.Result())
log.Infof(notes)
log.Infof("%s", notes)
provider.SyncError(result, notes, userCred)
return nil
}
@@ -2876,7 +2868,7 @@ func syncInterVpcNetworks(ctx context.Context, userCred mcclient.TokenCredential
}
localNetwork, remoteNetwork, result := provider.SyncInterVpcNetwork(ctx, userCred, networks, xor)
notes := fmt.Sprintf("Sync inter vpc network for cloudprovider %s result: %s", provider.GetName(), result.Result())
log.Infof(notes)
log.Infof("%s", notes)
provider.SyncError(result, notes, userCred)
for i := range localNetwork {
lockman.LockObject(ctx, &localNetwork[i])
@@ -2897,7 +2889,7 @@ func syncDnsZones(ctx context.Context, userCred mcclient.TokenCredential, syncRe
}
localZones, remoteZones, result := provider.SyncDnsZones(ctx, userCred, dnsZones, xor)
notes := fmt.Sprintf("Sync dns zones for cloudaccount %s result: %s", provider.Name, result.Result())
log.Infof(notes)
log.Infof("%s", notes)
provider.SyncError(result, notes, userCred)
for i := range localZones {
lockman.LockObject(ctx, &localZones[i])
@@ -2922,7 +2914,7 @@ func syncAiGateways(ctx context.Context, userCred mcclient.TokenCredential, sync
}()
syncResults.Add(AiGatewayManager, result)
notes := fmt.Sprintf("Sync ai gateways for cloudprovider %s result: %s", provider.GetName(), result.Result())
log.Infof(notes)
log.Infof("%s", notes)
provider.SyncError(result, notes, userCred)
return nil
}
@@ -2938,7 +2930,7 @@ func syncGlobalVpcs(ctx context.Context, userCred mcclient.TokenCredential, sync
localVpcs, remoteVpcs, result := provider.SyncGlobalVpcs(ctx, userCred, gvpcs, xor)
notes := fmt.Sprintf("Sync global vpcs for cloudprovider %s result: %s", provider.GetName(), result.Result())
log.Infof(notes)
log.Infof("%s", notes)
provider.SyncError(result, notes, userCred)
for i := range localVpcs {
@@ -2958,7 +2950,7 @@ func syncGlobalVpcs(ctx context.Context, userCred mcclient.TokenCredential, sync
}
result := localVpcs[i].SyncSecgroups(ctx, userCred, secgroups, xor)
notes := fmt.Sprintf("Sync security group for global vpc %s result: %s", localVpcs[i].Name, result.Result())
log.Infof(notes)
log.Infof("%s", notes)
}
return nil
@@ -2972,7 +2964,7 @@ func syncSSLCertificates(ctx context.Context, userCred mcclient.TokenCredential,
result := provider.SyncSSLCertificates(ctx, userCred, iEss)
notes := fmt.Sprintf("SyncSSLCertificates for provider %s result: %s", provider.Name, result.Result())
log.Infof(notes)
log.Infof("%s", notes)
provider.SyncError(result, notes, userCred)
return nil
}
@@ -2995,7 +2987,7 @@ func syncTablestore(
return nil
}
msg := fmt.Sprintf("GetICloudTablestores for region %s failed %s", remoteRegion.GetName(), err)
log.Errorf(msg)
log.Errorf("%s", msg)
return err
}
result := func() compare.SyncResult {
@@ -3005,7 +2997,7 @@ func syncTablestore(
syncResults.Add(TablestoreManager, result)
msg := result.Result()
notes := fmt.Sprintf("SyncTablestores for region %s result: %s", localRegion.Name, msg)
log.Infof(notes)
log.Infof("%s", notes)
provider.SyncError(result, notes, userCred)
if result.IsError() {
return result.AllError()
@@ -3028,12 +3020,12 @@ func syncModelartsPools(
return nil
}
msg := fmt.Sprintf("GetIModelartsPools for provider %s failed %s", err, ipools)
log.Errorf(msg)
log.Errorf("%s", msg)
return err
}
result := localRegion.SyncModelartsPools(ctx, userCred, provider, ipools, xor)
notes := fmt.Sprintf("SyncModelartsPools for region %s result: %s", provider.GetName(), result.Result())
log.Infof(notes)
log.Infof("%s", notes)
provider.SyncError(result, notes, userCred)
return nil
}
@@ -3053,12 +3045,12 @@ func syncModelartsPoolSkus(
return nil
}
msg := fmt.Sprintf("GetIModelartsPoolSku for provider %s failed %s", err, ipools)
log.Errorf(msg)
log.Errorf("%s", msg)
return err
}
result := localRegion.SyncModelartsPoolSkus(ctx, userCred, provider, ipools, xor)
notes := fmt.Sprintf("SyncModelartsPoolSkus for region %s result: %s", provider.GetName(), result.Result())
log.Infof(notes)
log.Infof("%s", notes)
provider.SyncError(result, notes, userCred)
return nil
}
@@ -3078,12 +3070,12 @@ func syncMiscResources(
return nil
}
msg := fmt.Sprintf("GetIMiscResources for provider %s failed %v", provider.Name, err)
log.Errorf(msg)
log.Errorf("%s", msg)
return err
}
result := localRegion.SyncMiscResources(ctx, userCred, provider, exts, xor)
notes := fmt.Sprintf("SyncMiscResources for provider %s result: %s", provider.GetName(), result.Result())
log.Infof(notes)
log.Infof("%s", notes)
provider.SyncError(result, notes, userCred)
return nil
}

View File

@@ -44,7 +44,7 @@ func syncElasticcaches(
}()
if err != nil {
msg := fmt.Sprintf("GetIElasticcaches for region %s failed %s", remoteRegion.GetName(), err)
log.Errorf(msg)
log.Errorf("%s", msg)
return
}
@@ -82,7 +82,7 @@ func syncElasticcacheParameters(ctx context.Context, userCred mcclient.TokenCred
}()
if err != nil {
msg := fmt.Sprintf("GetIElasticcacheParameters for dbinstance %s failed %s", remoteInstance.GetName(), err)
log.Errorf(msg)
log.Errorf("%s", msg)
return
}
@@ -91,8 +91,8 @@ func syncElasticcacheParameters(ctx context.Context, userCred mcclient.TokenCred
result := ElasticcacheParameterManager.SyncElasticcacheParameters(ctx, userCred, localInstance, parameters)
syncResults.Add(ElasticcacheParameterManager, result)
msg := result.Result()
log.Infof("SyncElasticcacheParameters for dbinstance %s result: %s", localInstance.Name, msg)
msg := fmt.Sprintf("SyncElasticcacheParameters for dbinstance %s result: %s", localInstance.Name, result.Result())
log.Infof("%s", msg)
if result.IsError() {
return
}
@@ -106,7 +106,7 @@ func syncElasticcacheAccounts(ctx context.Context, userCred mcclient.TokenCreden
}()
if err != nil {
msg := fmt.Sprintf("GetIElasticcacheAccounts for dbinstance %s failed %s", remoteInstance.GetName(), err)
log.Errorf(msg)
log.Errorf("%s", msg)
return
}
@@ -115,11 +115,8 @@ func syncElasticcacheAccounts(ctx context.Context, userCred mcclient.TokenCreden
result := ElasticcacheAccountManager.SyncElasticcacheAccounts(ctx, userCred, localInstance, accounts)
syncResults.Add(ElasticcacheAccountManager, result)
msg := result.Result()
log.Infof("SyncElasticcacheAccounts for dbinstance %s result: %s", localInstance.Name, msg)
if result.IsError() {
return
}
msg := fmt.Sprintf("SyncElasticcacheAccounts for dbinstance %s result: %s", localInstance.Name, result.Result())
log.Infof("%s", msg)
}()
}
@@ -129,11 +126,11 @@ func syncElasticcacheAcls(ctx context.Context, userCred mcclient.TokenCredential
return remoteInstance.GetICloudElasticcacheAcls()
}()
if err != nil {
msg := fmt.Sprintf("GetIElasticcacheAcls for dbinstance %s failed %s", remoteInstance.GetName(), err)
msg := fmt.Sprintf("GetIElasticcacheAcls for dbinstance %s failed %v", remoteInstance.GetName(), err)
if errors.Cause(err) == cloudprovider.ErrNotSupported {
log.Warningf(msg)
log.Warningf("%s", msg)
} else {
log.Errorf(msg)
log.Errorf("%s", msg)
}
return
}
@@ -143,11 +140,8 @@ func syncElasticcacheAcls(ctx context.Context, userCred mcclient.TokenCredential
result := ElasticcacheAclManager.SyncElasticcacheAcls(ctx, userCred, localInstance, acls)
syncResults.Add(ElasticcacheAclManager, result)
msg := result.Result()
log.Infof("SyncElasticcacheAcls for dbinstance %s result: %s", localInstance.Name, msg)
if result.IsError() {
return
}
msg := fmt.Sprintf("SyncElasticcacheAcls for dbinstance %s result: %s", localInstance.Name, result.Result())
log.Infof("%s", msg)
}()
}
@@ -158,7 +152,7 @@ func syncElasticcacheBackups(ctx context.Context, userCred mcclient.TokenCredent
}()
if err != nil {
msg := fmt.Sprintf("GetIElasticcacheBackups for dbinstance %s failed %s", remoteInstance.GetName(), err)
log.Errorf(msg)
log.Errorf("%s", msg)
return
}
@@ -167,11 +161,8 @@ func syncElasticcacheBackups(ctx context.Context, userCred mcclient.TokenCredent
result := ElasticcacheBackupManager.SyncElasticcacheBackups(ctx, userCred, localInstance, backups)
syncResults.Add(ElasticcacheBackupManager, result)
msg := result.Result()
log.Infof("SyncElasticcacheBackups for dbinstance %s result: %s", localInstance.Name, msg)
if result.IsError() {
return
}
msg := fmt.Sprintf("SyncElasticcacheBackups for dbinstance %s result: %s", localInstance.Name, result.Result())
log.Infof("%s", msg)
}()
}
@@ -183,9 +174,9 @@ func syncElasticcacheSecgroups(ctx context.Context, userCred mcclient.TokenCrede
if err != nil {
msg := fmt.Sprintf("Elasticcache.GetSecurityGroupIds for dbinstance %s failed %s", remoteInstance.GetName(), err)
if errors.Cause(err) == cloudprovider.ErrNotSupported {
log.Warningf(msg)
log.Warningf("%s", msg)
} else {
log.Errorf(msg)
log.Errorf("%s", msg)
}
return
}
@@ -195,10 +186,7 @@ func syncElasticcacheSecgroups(ctx context.Context, userCred mcclient.TokenCrede
result := localInstance.SyncElasticcacheSecgroups(ctx, userCred, secgroupIds)
syncResults.Add(ElasticcachesecgroupManager, result)
msg := result.Result()
log.Infof("SyncElasticcacheSecgroups for dbinstance %s result: %s", localInstance.Name, msg)
if result.IsError() {
return
}
msg := fmt.Sprintf("SyncElasticcacheSecgroups for dbinstance %s result: %s", localInstance.Name, result.Result())
log.Infof("%s", msg)
}()
}

View File

@@ -349,7 +349,7 @@ func (m *SContainerManager) validateSpecProbe(ctx context.Context, userCred mccl
"failure_threshold": probe.FailureThreshold,
} {
if val < 0 {
return httperrors.NewInputParameterError(key + " is negative")
return httperrors.NewInputParameterError("%s is negative", key)
}
}

View File

@@ -687,9 +687,8 @@ func SyncRegionDBInstanceSkus(ctx context.Context, userCred mcclient.TokenCreden
db.Metadata.SetValue(ctx, skuMeta, db.SKU_METADAT_KEY, newMd5, userCred)
result := DBInstanceSkuManager.SyncDBInstanceSkus(ctx, userCred, &region, xor)
msg := result.Result()
notes := fmt.Sprintf("sync rds sku for region %s result: %s", region.Name, msg)
log.Debugf(notes)
notes := fmt.Sprintf("sync rds sku for region %s result: %s", region.Name, result.Result())
log.Debugf("%s", notes)
}
}

View File

@@ -846,7 +846,7 @@ func SyncElasticCacheSkus(ctx context.Context, userCred mcclient.TokenCredential
result := ElasticcacheSkuManager.SyncElasticcacheSkus(ctx, userCred, region, false)
notes := fmt.Sprintf("SyncElasticCacheSkusByRegion %s result: %s", region.Name, result.Result())
log.Debugf(notes)
log.Debugf("%s", notes)
}
}
@@ -854,12 +854,12 @@ func SyncElasticCacheSkus(ctx context.Context, userCred mcclient.TokenCredential
func SyncElasticCacheSkusByRegion(ctx context.Context, userCred mcclient.TokenCredential, region *SCloudregion, xor bool) error {
if !region.GetDriver().IsSupportedElasticcache() {
notes := fmt.Sprintf("SyncElasticCacheSkusByRegion %s not support elasticcache", region.Name)
log.Infof(notes)
log.Infof("%s", notes)
return nil
}
result := ElasticcacheSkuManager.SyncElasticcacheSkus(ctx, userCred, region, xor)
notes := fmt.Sprintf("SyncElasticCacheSkusByRegion %s result: %s", region.Name, result.Result())
log.Infof(notes)
log.Infof("%s", notes)
return nil
}

View File

@@ -532,7 +532,8 @@ func (region *SCloudregion) getZoneIdBySuffix(zoneId string) (string, error) {
return zone.Id, nil
}
}
return "", errors.Wrapf(cloudprovider.ErrNotFound, zoneId)
msg := zoneId
return "", errors.Wrapf(cloudprovider.ErrNotFound, "%s", msg)
}
func (region *SCloudregion) newFromCloudFileSystem(ctx context.Context, userCred mcclient.TokenCredential, provider *SCloudprovider, fs cloudprovider.ICloudFileSystem) (*SFileSystem, error) {

View File

@@ -78,7 +78,7 @@ func (self *SGuest) GetDetailsVnc(ctx context.Context, userCred mcclient.TokenCr
utils.IsInStringArray(self.Status, []string{api.VM_RUNNING, api.VM_BLOCK_STREAM, api.VM_MIGRATING}) {
host, err := self.GetHost()
if err != nil {
return nil, httperrors.NewInternalServerError(errors.Wrapf(err, "GetHost").Error())
return nil, httperrors.NewInternalServerError("get host %v", err)
}
if options.Options.ForceUseOriginVnc {
input.Origin = true
@@ -2165,12 +2165,12 @@ func (self *SGuest) DetachIsolatedDevices(ctx context.Context, userCred mcclient
if devModel, err := IsolatedDeviceModelManager.GetByDevType(dev.DevType); err != nil {
msg := fmt.Sprintf("Can't separately detach dev type %s", dev.DevType)
logclient.AddActionLogWithContext(ctx, self, logclient.ACT_GUEST_DETACH_ISOLATED_DEVICE, msg, userCred, false)
return httperrors.NewBadRequestError(msg)
return httperrors.NewBadRequestError("%s", msg)
} else {
if !devModel.HotPluggable.Bool() && self.GetStatus() == api.VM_RUNNING {
msg := fmt.Sprintf("dev type %s model %s unhotpluggable", dev.DevType, devModel.Model)
logclient.AddActionLogWithContext(ctx, self, logclient.ACT_GUEST_DETACH_ISOLATED_DEVICE, msg, userCred, false)
return httperrors.NewBadRequestError(msg)
return httperrors.NewBadRequestError("%s", msg)
}
}
}
@@ -2193,7 +2193,7 @@ func (self *SGuest) PerformDetachIsolatedDevice(ctx context.Context, userCred mc
(self.Hypervisor == api.HYPERVISOR_POD && self.GetStatus() != api.VM_READY) {
msg := fmt.Sprintf("Can't detach isolated device when guest is %s", self.GetStatus())
logclient.AddActionLogWithContext(ctx, self, logclient.ACT_GUEST_DETACH_ISOLATED_DEVICE, msg, userCred, false)
return nil, httperrors.NewInvalidStatusError(msg)
return nil, httperrors.NewInvalidStatusError("%s", msg)
}
var detachAllDevice = jsonutils.QueryBoolean(data, "detach_all", false)
devs := make([]SIsolatedDevice, 0)
@@ -2202,7 +2202,7 @@ func (self *SGuest) PerformDetachIsolatedDevice(ctx context.Context, userCred mc
if err != nil {
msg := "Missing isolated device"
logclient.AddActionLogWithContext(ctx, self, logclient.ACT_GUEST_DETACH_ISOLATED_DEVICE, msg, userCred, false)
return nil, httperrors.NewBadRequestError(msg)
return nil, httperrors.NewBadRequestError("%s", msg)
}
iDev, err := IsolatedDeviceManager.FetchByIdOrName(ctx, userCred, device)
if err != nil {
@@ -2237,7 +2237,7 @@ func (self *SGuest) detachIsolateDevice(ctx context.Context, userCred mcclient.T
if dev.GuestId != self.Id {
msg := "Isolated device is not attached to this guest"
logclient.AddActionLogWithContext(ctx, self, logclient.ACT_GUEST_DETACH_ISOLATED_DEVICE, msg, userCred, false)
return httperrors.NewBadRequestError(msg)
return httperrors.NewBadRequestError("%s", msg)
}
drv, _ := self.GetDriver()
if err := drv.BeforeDetachIsolatedDevice(ctx, userCred, self, dev); err != nil {
@@ -2263,9 +2263,9 @@ func (self *SGuest) PerformAttachIsolatedDevice(ctx context.Context, userCred mc
}
if !utils.IsInStringArray(self.GetStatus(), []string{api.VM_READY, api.VM_RUNNING}) ||
(self.Hypervisor == api.HYPERVISOR_POD && self.GetStatus() != api.VM_READY) {
msg := fmt.Sprintf("Can't attach isolated device when guest is %s", self.GetStatus())
msg := fmt.Sprintf("Can't attach isolated device when guest is %v", self.GetStatus())
logclient.AddActionLogWithContext(ctx, self, logclient.ACT_GUEST_ATTACH_ISOLATED_DEVICE, msg, userCred, false)
return nil, httperrors.NewInvalidStatusError(msg)
return nil, httperrors.NewInvalidStatusError("%s", msg)
}
var err error
autoStart := jsonutils.QueryBoolean(data, "auto_start", false)

View File

@@ -261,7 +261,7 @@ func (self *SGuest) createConvertedServer(ctx context.Context, userCred mcclient
return nil, nil, errors.Wrap(err, "Do schedule migrate forecast")
}
if !succ {
return nil, nil, httperrors.NewInsufficientResourceError(res.String())
return nil, nil, httperrors.NewInsufficientResourceError("%s", res.String())
}
lockman.LockClass(ctx, GuestManager, userCred.GetProjectId())

View File

@@ -352,7 +352,8 @@ func (guest *SGuest) sshableTry(
return true
}
ctx, _ = context.WithTimeout(ctx, 7*time.Second)
ctx, cancel := context.WithTimeout(ctx, 7*time.Second)
defer cancel()
conf := ssh_util.ClientConfig{
Username: tryData.User,
Host: methodData.Host,

View File

@@ -153,9 +153,9 @@ func (self *SGuest) doPrepaidRecycleNoLock(ctx context.Context, userCred mcclien
guestnics, err := self.GetNetworks("")
if err != nil || len(guestnics) == 0 {
msg := fmt.Sprintf("no network info on guest???? %s", err)
log.Errorf(msg)
return fmt.Errorf(msg)
msg := fmt.Sprintf("no network info on guest???? %v", err)
log.Errorf("%s", msg)
return fmt.Errorf("%s", msg)
}
fakeHost.AccessIp = guestnics[0].IpAddr
fakeHost.AccessMac = guestnics[0].MacAddr
@@ -229,7 +229,7 @@ func (self *SGuest) doPrepaidRecycleNoLock(ctx context.Context, userCred mcclien
} else {
if externalId != storage.ExternalId {
msg := "inconsistent storage !!!!"
log.Errorf(msg)
log.Errorf("%s", msg)
fakeHost.RealDelete(ctx, userCred)
return errors.Wrap(httperrors.ErrConflict, msg)
}
@@ -406,7 +406,7 @@ func doUndoPrepaidRecycleLockHost(ctx context.Context, userCred mcclient.TokenCr
func doUndoPrepaidRecycleNoLock(ctx context.Context, userCred mcclient.TokenCredential, host *SHost, server *SGuest) error {
if host.RealExternalId != server.ExternalId {
msg := "host and server external id not match!!!!"
log.Errorf(msg)
log.Errorf("%v", msg)
return errors.Wrap(httperrors.ErrConflict, msg)
}
@@ -426,12 +426,12 @@ func doUndoPrepaidRecycleNoLock(ctx context.Context, userCred mcclient.TokenCred
if oHostCnt == 0 {
msg := "orthordox host not found???"
log.Errorf(msg)
log.Errorf("%s", msg)
return errors.Wrap(httperrors.ErrConflict, msg)
}
if oHostCnt > 1 {
msg := fmt.Sprintf("more than 1 (%d) orthordox host found???", oHostCnt)
log.Errorf(msg)
log.Errorf("%s", msg)
return errors.Wrap(httperrors.ErrConflict, msg)
}
@@ -440,8 +440,8 @@ func doUndoPrepaidRecycleNoLock(ctx context.Context, userCred mcclient.TokenCred
err = q.First(&oHost)
if err != nil {
msg := fmt.Sprintf("fail to query orthordox host %s", err)
log.Errorf(msg)
msg := fmt.Sprintf("fail to query orthordox host %v", err)
log.Errorf("%s", msg)
return errors.Wrap(err, msg)
}
@@ -455,7 +455,7 @@ func doUndoPrepaidRecycleNoLock(ctx context.Context, userCred mcclient.TokenCred
oHostStorage := oHost.GetHoststorageByExternalId(storage.ExternalId)
if oHostStorage == nil {
msg := fmt.Sprintf("oHost.GetHoststorageByExternalId not found %s", storage.ExternalId)
log.Errorf(msg)
log.Errorf("%s", msg)
return errors.Wrap(httperrors.ErrConflict, msg)
}
}
@@ -484,7 +484,7 @@ func doUndoPrepaidRecycleNoLock(ctx context.Context, userCred mcclient.TokenCred
oHostStorage := oHost.GetHoststorageByExternalId(storage.ExternalId)
if oHostStorage == nil {
msg := fmt.Sprintf("oHost.GetHoststorageByExternalId not found %s", storage.ExternalId)
log.Errorf(msg)
log.Errorf("%s", msg)
return errors.Wrap(httperrors.ErrConflict, msg)
}
oStorage := oHostStorage.GetStorage()
@@ -546,8 +546,8 @@ func (self *SHost) BorrowIpAddrsFromGuest(ctx context.Context, userCred mcclient
netif := self.GetNetInterface(guestnics[i].MacAddr, 1)
if netif == nil {
msg := fmt.Sprintf("fail to find netinterface for mac %s", guestnics[i].MacAddr)
log.Errorf(msg)
return fmt.Errorf(msg)
log.Errorf("%s", msg)
return fmt.Errorf("%s", msg)
}
err = self.EnableNetif(ctx, userCred, netif, "", guestnics[i].IpAddr, guestnics[i].Ip6Addr, "", "", false, false, false, false)

View File

@@ -2543,7 +2543,7 @@ func (manager *SHostManager) NewFromCloudHost(ctx context.Context, userCred mccl
accessIp := extHost.GetAccessIp()
if len(accessIp) == 0 {
msg := fmt.Sprintf("fail to find wire for host %s: empty host access ip", extHost.GetName())
return nil, fmt.Errorf(msg)
return nil, fmt.Errorf("%s", msg)
}
wire, err := WireManager.GetOnPremiseWireOfIp(accessIp)
if err != nil {
@@ -4848,8 +4848,8 @@ func fetchIpmiInfo(data api.HostIpmiAttributes, hostId string) (types.SIPMIInfo,
}
}
if len(data.IpmiIpAddr) > 0 && !regutils.MatchIP4Addr(data.IpmiIpAddr) {
msg := fmt.Sprintf("ipmi_ip_addr: %s not valid ipv4 address", data.IpmiIpAddr)
log.Errorf(msg)
msg := fmt.Sprintf("ipmi_ip_addr: %v not valid ipv4 address", data.IpmiIpAddr)
log.Errorf("%s", msg)
return info, errors.Wrap(httperrors.ErrInvalidFormat, msg)
}
info.IpAddr = data.IpmiIpAddr

View File

@@ -148,7 +148,7 @@ func (self *SKubeNodePool) GetIKubeNodePool(ctx context.Context) (cloudprovider.
return pools[i], nil
}
}
return nil, errors.Wrapf(cloudprovider.ErrNotFound, self.ExternalId)
return nil, errors.Wrapf(cloudprovider.ErrNotFound, "%s", self.ExternalId)
}
func (manager *SKubeNodePoolManager) FetchOwnerId(ctx context.Context, data jsonutils.JSONObject) (mcclient.IIdentityProvider, error) {

View File

@@ -322,9 +322,9 @@ func (self *SKubeCluster) GetNodePoolIdByExternalId(id string) (*SKubeNodePool,
return &pools[0], nil
}
if len(pools) == 0 {
return nil, errors.Wrapf(cloudprovider.ErrNotFound, id)
return nil, errors.Wrapf(cloudprovider.ErrNotFound, "%v", id)
}
return nil, errors.Wrapf(cloudprovider.ErrDuplicateId, id)
return nil, errors.Wrapf(cloudprovider.ErrDuplicateId, "%v", id)
}
func (self *SKubeCluster) newFromCloudKubeNode(ctx context.Context, userCred mcclient.TokenCredential, ext cloudprovider.ICloudKubeNode) (*SKubeNode, error) {

View File

@@ -382,9 +382,8 @@ func SyncRegionNasSkus(ctx context.Context, userCred mcclient.TokenCredential, r
db.Metadata.SetValue(ctx, skuMeta, db.SKU_METADAT_KEY, newMd5, userCred)
result := regions[i].SyncNasSkus(ctx, userCred, xor)
msg := result.Result()
notes := fmt.Sprintf("SyncNasSkus for region %s result: %s", regions[i].Name, msg)
log.Debugf(notes)
notes := fmt.Sprintf("SyncNasSkus for region %s result: %v", regions[i].Name, result.Result())
log.Debugf("%s", notes)
}
return nil
}

View File

@@ -385,9 +385,8 @@ func SyncRegionNatSkus(ctx context.Context, userCred mcclient.TokenCredential, r
db.Metadata.SetValue(ctx, skuMeta, db.SKU_METADAT_KEY, newMd5, userCred)
result := regions[i].SyncNatSkus(ctx, userCred, xor)
msg := result.Result()
notes := fmt.Sprintf("SyncNatSkus for region %s result: %s", regions[i].Name, msg)
log.Infof(notes)
notes := fmt.Sprintf("SyncNatSkus for region %s result: %v", regions[i].Name, result.Result())
log.Infof("%s", notes)
}
return nil
}

View File

@@ -382,7 +382,7 @@ func (self *SNatDEntry) GetEip() (*SElasticip, error) {
return &eips[0], nil
}
if len(eips) == 0 {
return nil, errors.Wrapf(cloudprovider.ErrNotFound, self.ExternalIP)
return nil, errors.Wrapf(cloudprovider.ErrNotFound, "%v", self.ExternalIP)
}
return nil, errors.Wrapf(cloudprovider.ErrDuplicateId, self.ExternalIP)
return nil, errors.Wrapf(cloudprovider.ErrDuplicateId, "%v", self.ExternalIP)
}

View File

@@ -771,7 +771,7 @@ func (self *SNatGateway) GetINatGateway(ctx context.Context) (cloudprovider.IClo
return iNats[i], nil
}
}
return nil, errors.Wrapf(cloudprovider.ErrNotFound, self.ExternalId)
return nil, errors.Wrapf(cloudprovider.ErrNotFound, "%v", self.ExternalId)
}
func (self *SNatGateway) Delete(ctx context.Context, userCred mcclient.TokenCredential) error {

View File

@@ -472,7 +472,7 @@ func (self *SNatSEntry) GetEip() (*SElasticip, error) {
return &eips[0], nil
}
if len(eips) == 0 {
return nil, errors.Wrapf(cloudprovider.ErrNotFound, self.IP)
return nil, errors.Wrapf(cloudprovider.ErrNotFound, "%v", self.IP)
}
return nil, errors.Wrapf(cloudprovider.ErrDuplicateId, self.IP)
return nil, errors.Wrapf(cloudprovider.ErrDuplicateId, "%v", self.IP)
}

View File

@@ -3611,7 +3611,7 @@ func (network *SNetwork) GetUsedAddressDetails(ctx context.Context, addr string)
return &address[i], nil
}
}
return nil, errors.Wrapf(errors.ErrNotFound, addr)
return nil, errors.Wrapf(errors.ErrNotFound, "%s", addr)
}
func (network *SNetwork) GetAddressDetails(ctx context.Context, userCred mcclient.TokenCredential, owner mcclient.IIdentityProvider, scope rbacscope.TRbacScope) ([]api.SNetworkUsedAddress, error) {

View File

@@ -947,7 +947,7 @@ func (self *SSecurityGroup) GetISecurityGroup(ctx context.Context) (cloudprovide
return securityGroups[i], nil
}
}
return nil, errors.Wrapf(cloudprovider.ErrNotFound, self.ExternalId)
return nil, errors.Wrapf(cloudprovider.ErrNotFound, "%v", self.ExternalId)
}
iRegion, err := self.GetIRegion(ctx)
if err != nil {

View File

@@ -1202,7 +1202,7 @@ func (region *SCloudregion) newPublicCloudSku(ctx context.Context, userCred mccl
zoneId := sku.ZoneId
sku.ZoneId = yunionmeta.GetZoneIdBySuffix(zoneMaps, zoneId)
if len(sku.ZoneId) == 0 {
return errors.Wrapf(cloudprovider.ErrNotFound, zoneId)
return errors.Wrapf(cloudprovider.ErrNotFound, "%v", zoneId)
}
}
@@ -1489,7 +1489,7 @@ func (self *SServerSku) GetICloudSku(ctx context.Context) (cloudprovider.ICloudS
}
}
}
return nil, errors.Wrapf(cloudprovider.ErrNotFound, self.ExternalId)
return nil, errors.Wrapf(cloudprovider.ErrNotFound, "%v", self.ExternalId)
}
func fetchSkuSyncCloudregions() []SCloudregion {
@@ -1555,8 +1555,8 @@ func SyncServerSkus(ctx context.Context, userCred mcclient.TokenCredential, isSt
db.Metadata.SetValue(ctx, skuMeta, db.SKU_METADAT_KEY, newMd5, userCred)
result := ServerSkuManager.SyncServerSkus(ctx, userCred, region, false)
notes := fmt.Sprintf("SyncServerSkusByRegion %s result: %s", region.Name, result.Result())
log.Debugf(notes)
notes := fmt.Sprintf("SyncServerSkusByRegion %s result: %v", region.Name, result.Result())
log.Debugf("%s", notes)
}
}
@@ -1565,7 +1565,7 @@ func SyncServerSkus(ctx context.Context, userCred mcclient.TokenCredential, isSt
func SyncServerSkusByRegion(ctx context.Context, userCred mcclient.TokenCredential, region *SCloudregion, xor bool) compare.SyncResult {
result := compare.SyncResult{}
result = ServerSkuManager.SyncServerSkus(ctx, userCred, region, xor)
notes := fmt.Sprintf("SyncServerSkusByRegion %s result: %s", region.Name, result.Result())
log.Infof(notes)
notes := fmt.Sprintf("SyncServerSkusByRegion %s result: %v", region.Name, result.Result())
log.Infof("%s", notes)
return result
}

View File

@@ -449,8 +449,8 @@ func (sc *SStoragecache) GetIStorageCache(ctx context.Context) (cloudprovider.IC
storages := sc.getValidStorages()
if len(storages) == 0 {
msg := fmt.Sprintf("no storages for this storagecache %s(%s)???", sc.Name, sc.Id)
log.Errorf(msg)
return nil, fmt.Errorf(msg)
log.Errorf("%v", msg)
return nil, fmt.Errorf("%v", msg)
}
istorage, err := storages[0].GetIStorage(ctx)
if err != nil {

View File

@@ -1611,8 +1611,8 @@ func (self *SStorage) GetIStorage(ctx context.Context) (cloudprovider.ICloudStor
region, _ := self.GetRegion()
if region == nil {
msg := "cannot find region for storage???"
log.Errorf(msg)
return nil, fmt.Errorf(msg)
log.Errorf("%s", msg)
return nil, fmt.Errorf("%s", msg)
}
iRegion, err = provider.GetIRegionById(region.ExternalId)
}
@@ -1913,8 +1913,8 @@ func (self *SStorage) ClearSchedDescCache() error {
hosts := self.GetAllAttachingHosts()
if hosts == nil {
msg := "get attaching host error"
log.Errorf(msg)
return fmt.Errorf(msg)
log.Errorf("%s", msg)
return fmt.Errorf("%s", msg)
}
for i := 0; i < len(hosts); i += 1 {
err := hosts[i].ClearSchedDescCache()

View File

@@ -352,5 +352,5 @@ func (self *SWafIPSet) GetICloudWafIPSet(ctx context.Context) (cloudprovider.ICl
return caches[i], nil
}
}
return nil, errors.Wrapf(cloudprovider.ErrNotFound, self.ExternalId)
return nil, errors.Wrapf(cloudprovider.ErrNotFound, "%v", self.ExternalId)
}

View File

@@ -249,7 +249,7 @@ func (self *SWafRegexSet) GetICloudWafRegexSet(ctx context.Context) (cloudprovid
return caches[i], nil
}
}
return nil, errors.Wrapf(cloudprovider.ErrNotFound, self.ExternalId)
return nil, errors.Wrapf(cloudprovider.ErrNotFound, "%v", self.ExternalId)
}
func (self *SWafRegexSet) syncWithCloudRegexSet(ctx context.Context, userCred mcclient.TokenCredential, ext cloudprovider.ICloudWafRegexSet) error {

View File

@@ -243,7 +243,7 @@ func (self *SWafRuleGroup) GetICloudWafRuleGroup(ctx context.Context) (cloudprov
return caches[i], nil
}
}
return nil, errors.Wrapf(cloudprovider.ErrNotFound, self.ExternalId)
return nil, errors.Wrapf(cloudprovider.ErrNotFound, "%v", self.ExternalId)
}
func (self *SWafRuleGroup) syncWithCloudRuleGroup(ctx context.Context, userCred mcclient.TokenCredential, ext cloudprovider.ICloudWafRuleGroup) error {

View File

@@ -592,7 +592,7 @@ func (self *SWafRule) GetICloudWafRule(ctx context.Context) (cloudprovider.IClou
return rules[i], nil
}
}
return nil, errors.Wrapf(cloudprovider.ErrNotFound, self.ExternalId)
return nil, errors.Wrapf(cloudprovider.ErrNotFound, "%s", self.ExternalId)
}
return nil, errors.Wrapf(cloudprovider.ErrNotFound, "")
}

View File

@@ -116,7 +116,7 @@ func validateUniqueById(ctx context.Context, userCred mcclient.TokenCredential,
}
if count > 1 {
return httperrors.NewDuplicateResourceError(id)
return httperrors.NewDuplicateResourceError("%s", id)
}
return nil
@@ -1405,7 +1405,7 @@ func (self *SManagedVirtualizationRegionDriver) RequestCreateDBInstance(ctx cont
return iRds, nil
}
if len(errMsgs) > 0 {
return nil, fmt.Errorf(strings.Join(errMsgs, "\n"))
return nil, fmt.Errorf("%s", strings.Join(errMsgs, "\n"))
}
return nil, fmt.Errorf("no avaiable skus %s(%dC%d) for create", dbinstance.InstanceType, desc.VcpuCount, desc.VmemSizeMb)
}
@@ -1577,7 +1577,7 @@ func (self *SManagedVirtualizationRegionDriver) RequestCreateDBInstanceFromBacku
return iRds, nil
}
if len(errMsgs) > 0 {
return nil, fmt.Errorf(strings.Join(errMsgs, "\n"))
return nil, fmt.Errorf("%s", strings.Join(errMsgs, "\n"))
}
return nil, fmt.Errorf("no avaiable skus %s(%dC%d) for create", rds.InstanceType, desc.VcpuCount, desc.VmemSizeMb)
}

View File

@@ -128,7 +128,7 @@ func (self *InstanceBackupRecoveryTask) OnCreateGuest(ctx context.Context, ib *m
sysDisk := &disks[0]
backups, err := ib.GetBackups()
if err != nil {
self.taskFailed(ctx, ib, jsonutils.NewString(fmt.Sprintf(err.Error())))
self.taskFailed(ctx, ib, jsonutils.NewString(fmt.Sprintf("%v", err)))
return
}
db.Update(sysDisk, func() error {

View File

@@ -68,7 +68,7 @@ func (self *BaremetalCreateTask) OnIpmiProbeComplete(ctx context.Context, obj db
}
if baremetal.AccessMac == "" && baremetal.Uuid == "" && !ipmiInfo.CdromBoot {
msg := "Fail to find access_mac or uuid, host-prepare aborted. Please supply either access_mac or uuid and try host-prepare"
log.Errorf(msg)
log.Errorf("%s", msg)
self.taskFailed(ctx, baremetal, msg)
baremetal.SetStatus(ctx, self.UserCred, api.BAREMETAL_PREPARE_FAIL, msg)
return

View File

@@ -63,7 +63,7 @@ func (self *BaremetalSyncStatusTask) OnSyncstatusComplete(ctx context.Context, b
}
func (self *BaremetalSyncStatusTask) OnSyncstatusCompleteFailed(ctx context.Context, baremetal *models.SHost, body jsonutils.JSONObject) {
self.taskFailed(ctx, baremetal, errors.Errorf(body.String()))
self.taskFailed(ctx, baremetal, errors.Errorf("%s", body.String()))
}
func init() {

View File

@@ -65,5 +65,5 @@ func (self *BucketSyncstatusTask) OnBucketSyncStatusComplete(ctx context.Context
}
func (self *BucketSyncstatusTask) OnBucketSyncStatusCompleteFailed(ctx context.Context, bucket *models.SBucket, data jsonutils.JSONObject) {
self.taskFailed(ctx, bucket, fmt.Errorf(data.String()))
self.taskFailed(ctx, bucket, fmt.Errorf("%s", data.String()))
}

View File

@@ -65,5 +65,5 @@ func (self *DBInstanceBackupSyncstatusTask) OnDBInstanceBackupSyncStatusComplete
}
func (self *DBInstanceBackupSyncstatusTask) OnDBInstanceBackupSyncStatusCompleteFailed(ctx context.Context, backup *models.SDBInstanceBackup, data jsonutils.JSONObject) {
self.taskFailed(ctx, backup, fmt.Errorf(data.String()))
self.taskFailed(ctx, backup, fmt.Errorf("%s", data.String()))
}

View File

@@ -62,7 +62,7 @@ func (self *DBInstanceRemoteUpdateTask) OnRemoteUpdateComplete(ctx context.Conte
}
func (self *DBInstanceRemoteUpdateTask) OnRemoteUpdateCompleteFailed(ctx context.Context, rds *models.SDBInstance, data jsonutils.JSONObject) {
self.taskFail(ctx, rds, errors.Errorf(data.String()))
self.taskFail(ctx, rds, errors.Errorf("%s", data.String()))
}
func (self *DBInstanceRemoteUpdateTask) OnSyncStatusComplete(ctx context.Context, rds *models.SDBInstance, data jsonutils.JSONObject) {

View File

@@ -87,7 +87,7 @@ func (self *DiskRemoteUpdateTask) OnRemoteUpdateComplete(ctx context.Context, di
}
func (self *DiskRemoteUpdateTask) OnRemoteUpdateCompleteFailed(ctx context.Context, disk *models.SDisk, data jsonutils.JSONObject) {
self.taskFail(ctx, disk, errors.Errorf(data.String()))
self.taskFail(ctx, disk, errors.Errorf("%s", data.String()))
}
func (self *DiskRemoteUpdateTask) OnSyncStatusComplete(ctx context.Context, disk *models.SDisk, data jsonutils.JSONObject) {

View File

@@ -149,7 +149,7 @@ func (self *DiskResetTask) RequestResetDisk(ctx context.Context, disk *models.SD
}
func (self *DiskResetTask) OnRequestResetDiskFailed(ctx context.Context, disk *models.SDisk, data jsonutils.JSONObject) {
self.TaskFailed(ctx, disk, fmt.Errorf(data.String()))
self.TaskFailed(ctx, disk, fmt.Errorf("%s", data.String()))
}
func (self *DiskResetTask) OnRequestResetDisk(ctx context.Context, disk *models.SDisk, data jsonutils.JSONObject) {

View File

@@ -142,5 +142,5 @@ func (self *DiskSaveTask) OnUploadDiskComplete(ctx context.Context, disk *models
}
func (self *DiskSaveTask) OnUploadDiskCompleteFailed(ctx context.Context, disk *models.SDisk, data jsonutils.JSONObject) {
self.taskFailed(ctx, disk, fmt.Errorf(data.String()))
self.taskFailed(ctx, disk, fmt.Errorf("%s", data.String()))
}

View File

@@ -71,5 +71,5 @@ func (self *DiskSyncstatusTask) OnDiskSyncStatusComplete(ctx context.Context, ob
}
func (self *DiskSyncstatusTask) OnDiskSyncStatusCompleteFailed(ctx context.Context, disk *models.SDisk, data jsonutils.JSONObject) {
self.taskFailed(ctx, disk, fmt.Errorf(data.String()))
self.taskFailed(ctx, disk, fmt.Errorf("%s", data.String()))
}

View File

@@ -156,5 +156,5 @@ func (self *EipAssociateTask) OnAssociateEipComplete(ctx context.Context, obj db
func (self *EipAssociateTask) OnAssociateEipCompleteFailed(ctx context.Context, obj db.IStandaloneModel, data jsonutils.JSONObject) {
eip := obj.(*models.SElasticip)
ins, _, _ := self.GetAssociateObj(ctx)
self.taskFail(ctx, eip, ins, errors.Errorf(data.String()))
self.taskFail(ctx, eip, ins, errors.Errorf("%s", data.String()))
}

View File

@@ -67,5 +67,5 @@ func (self *ElasticcacheAllocatePublicConnectionTask) OnElasticcacheAllocatePubl
}
func (self *ElasticcacheAllocatePublicConnectionTask) OnElasticcacheAllocatePublicConnectionCompleteFailed(ctx context.Context, elasticcache *models.SElasticcache, reason jsonutils.JSONObject) {
self.taskFail(ctx, elasticcache, fmt.Errorf(reason.String()))
self.taskFail(ctx, elasticcache, fmt.Errorf("%s", reason.String()))
}

View File

@@ -93,7 +93,7 @@ func (self *ElasticcacheCreateTask) OnSyncSecurityGroupComplete(ctx context.Cont
}
func (self *ElasticcacheCreateTask) OnSyncSecurityGroupCompleteFailed(ctx context.Context, elasticcache *models.SElasticcache, reason jsonutils.JSONObject) {
self.taskFail(ctx, elasticcache, fmt.Errorf(reason.String()))
self.taskFail(ctx, elasticcache, fmt.Errorf("%s", reason.String()))
}
func (self *ElasticcacheCreateTask) OnElasticcacheCreateComplete(ctx context.Context, elasticcache *models.SElasticcache, data jsonutils.JSONObject) {
@@ -107,5 +107,5 @@ func (self *ElasticcacheCreateTask) OnElasticcacheCreateComplete(ctx context.Con
}
func (self *ElasticcacheCreateTask) OnElasticcacheCreateCompleteFailed(ctx context.Context, elasticcache *models.SElasticcache, reason jsonutils.JSONObject) {
self.taskFail(ctx, elasticcache, fmt.Errorf(reason.String()))
self.taskFail(ctx, elasticcache, fmt.Errorf("%s", reason.String()))
}

View File

@@ -67,5 +67,5 @@ func (self *ElasticcacheReleasePublicConnectionTask) OnElasticcacheReleasePublic
}
func (self *ElasticcacheReleasePublicConnectionTask) OnElasticcacheReleasePublicConnectionCompleteFailed(ctx context.Context, elasticcache *models.SElasticcache, reason jsonutils.JSONObject) {
self.taskFail(ctx, elasticcache, fmt.Errorf(reason.String()))
self.taskFail(ctx, elasticcache, fmt.Errorf("%s", reason.String()))
}

View File

@@ -93,5 +93,5 @@ func (self *ElasticcacheSyncsecgroupsTask) OnElasticcacheSyncSecgroupsComplete(c
}
func (self *ElasticcacheSyncsecgroupsTask) OnElasticcacheSyncSecgroupsCompleteFailed(ctx context.Context, cache *models.SElasticcache, data jsonutils.JSONObject) {
self.taskFailed(ctx, cache, fmt.Errorf(data.String()))
self.taskFailed(ctx, cache, fmt.Errorf("%s", data.String()))
}

View File

@@ -84,7 +84,7 @@ func (self *FileSystemRemoteUpdateTask) OnRemoteUpdateComplete(ctx context.Conte
}
func (self *FileSystemRemoteUpdateTask) OnRemoteUpdateCompleteFailed(ctx context.Context, fs *models.SFileSystem, data jsonutils.JSONObject) {
self.taskFail(ctx, fs, errors.Errorf(data.String()))
self.taskFail(ctx, fs, errors.Errorf("%s", data.String()))
}
func (self *FileSystemRemoteUpdateTask) OnSyncStatusComplete(ctx context.Context, fs *models.SFileSystem, data jsonutils.JSONObject) {

View File

@@ -69,5 +69,5 @@ func (self *MountTargetSyncstatusTask) OnInit(ctx context.Context, obj db.IStand
}
}
self.taskFail(ctx, mt, errors.Wrapf(cloudprovider.ErrNotFound, mt.ExternalId))
self.taskFail(ctx, mt, errors.Wrapf(cloudprovider.ErrNotFound, "%s", mt.ExternalId))
}

Some files were not shown because too many files have changed in this diff Show More