diff --git a/pkg/compute/models/scaling_group.go b/pkg/compute/models/scaling_group.go index 009cd4e835..eb0306ea0c 100644 --- a/pkg/compute/models/scaling_group.go +++ b/pkg/compute/models/scaling_group.go @@ -430,7 +430,7 @@ func (sg *SScalingGroup) Scale(ctx context.Context, triggerDesc IScalingTriggerD // query again to fetch the latest desire instance number of sg model, err := ScalingGroupManager.FetchById(sg.Id) if err != nil { - scalingActivity.SetFailed("", fmt.Sprintf("fail to get ScalingGroup: ", err.Error())) + scalingActivity.SetFailed("", fmt.Sprintf("fail to get ScalingGroup: %s", err.Error())) return nil } sg = model.(*SScalingGroup) diff --git a/pkg/compute/models/scaling_trigger.go b/pkg/compute/models/scaling_trigger.go index bc9a783cfe..bde170038c 100644 --- a/pkg/compute/models/scaling_trigger.go +++ b/pkg/compute/models/scaling_trigger.go @@ -531,7 +531,7 @@ func (sa *SScalingAlarm) TriggerDescription() string { name = sp.Name } return fmt.Sprintf( - `Alarm task(the %s %s of the instance is %s than %d%s) execute scaling policy "%s"`, + `Alarm task(the %s %s of the instance is %s than %f%s) execute scaling policy "%s"`, descs[sa.Wrapper], descs[sa.Indicator], descs[sa.Operator], sa.Value, units[sa.Indicator], name, ) diff --git a/pkg/compute/tasks/guest_detach_scalinggroup.go b/pkg/compute/tasks/guest_detach_scalinggroup.go index 6cd998a444..b4ad3321d4 100644 --- a/pkg/compute/tasks/guest_detach_scalinggroup.go +++ b/pkg/compute/tasks/guest_detach_scalinggroup.go @@ -78,7 +78,7 @@ func (self *GuestDetachScalingGroupTask) OnInit(ctx context.Context, obj db.ISta } else { lbBackend.SetStatus(self.UserCred, api.LB_STATUS_DELETING, "") if err = lbBackend.StartLoadBalancerBackendDeleteTask(ctx, self.UserCred, jsonutils.NewDict(), self.Id); err != nil { - self.taskFailed(ctx, sgg, nil, fmt.Sprintf("Detach guest with loadbalancer group failed: ", err)) + self.taskFailed(ctx, sgg, nil, fmt.Sprintf("Detach guest with loadbalancer group failed: %s", err)) } } } diff --git a/pkg/controller/autoscaling/controller.go b/pkg/controller/autoscaling/controller.go index c83c988316..50fe654818 100644 --- a/pkg/controller/autoscaling/controller.go +++ b/pkg/controller/autoscaling/controller.go @@ -473,7 +473,7 @@ func (asc *SASController) CreateInstances( // bind ld and db go func() { succeed := asc.actionAfterCreate(ctx, userCred, session, sg, ret, failRecord) - log.Debugf("action after create instance '%s', succeed: %b", ret.Id, succeed) + log.Debugf("action after create instance '%s', succeed: %t", ret.Id, succeed) if succeed { succeedInstances = append(succeedInstances, ret.Id) } @@ -484,7 +484,7 @@ func (asc *SASController) CreateInstances( // wait for all worker finish log.Debugf("workerlimit cap: %d", cap(workerLimit)) for i := 0; i < cap(workerLimit); i++ { - log.Debugf("no.%d insert worker limit") + log.Debugf("no.%d insert worker limit", i) workerLimit <- struct{}{} } @@ -603,7 +603,7 @@ func (asc *SASController) actionAfterCreate( } if ret.Status != compute.VM_RUNNING { if ret.Status == "timeout" { - rollback(fmt.Sprintf("the creation process for instance '%s' has timed out")) + rollback(fmt.Sprintf("the creation process for instance '%s' has timed out", ret.Id)) } else { // fetch the reason var reason string @@ -647,7 +647,7 @@ func (asc *SASController) actionAfterCreate( // fifth stage: join scaling group finished sggs, err := models.ScalingGroupGuestManager.Fetch(sg.GetId(), ret.Id) if err != nil || sggs == nil || len(sggs) == 0 { - log.Errorf("ScalingGroupGuestManager.Fetch failed; ScalingGroup '%s', Guest '%s'") + log.Errorf("ScalingGroupGuestManager.Fetch failed; ScalingGroup '%s', Guest '%s'", sg.Id, ret.Id) return } sggs[0].SetGuestStatus(compute.SG_GUEST_STATUS_READY) diff --git a/pkg/controller/autoscaling/timer.go b/pkg/controller/autoscaling/timer.go index 5632465fe0..0b4014c352 100644 --- a/pkg/controller/autoscaling/timer.go +++ b/pkg/controller/autoscaling/timer.go @@ -57,7 +57,7 @@ func (asc *SASController) Timer(ctx context.Context, userCred mcclient.TokenCred log.Errorf("db.FetchModelObjects error: %s", err.Error()) return } - log.Debugf("total %d need to exec, %s", len(scalingTimers), scalingTimers) + log.Debugf("total %d need to exec, %v", len(scalingTimers), scalingTimers) for _, scalingTimer := range scalingTimers { asc.timerQueue <- struct{}{} go func(ctx context.Context) {