Merge pull request #8237 from swordqiu/hotfix/qj-pass-make-test-20201011

fix: format errors that block make test
This commit is contained in:
yunion-ci-robot
2020-10-12 16:09:23 +08:00
committed by GitHub
8 changed files with 21 additions and 23 deletions
+1 -1
View File
@@ -44,7 +44,7 @@ func main() {
err = fs.Serve(c, *fetcherFs)
if err != nil {
log.Errorln("serve failed %s", err)
log.Errorf("serve failed %s", err)
}
}
+1 -1
View File
@@ -60,7 +60,7 @@ func (self *BaremetalDeleteTask) OnInit(ctx context.Context, obj db.IStandaloneM
func (self *BaremetalDeleteTask) OnDeleteBaremetalComplete(ctx context.Context, baremetal *models.SHost, body jsonutils.JSONObject) {
err := baremetal.RealDelete(ctx, self.UserCred)
if err != nil {
log.Errorln("RealDelete fail %s", err)
log.Errorf("RealDelete fail %s", err)
self.OnFailure(ctx, baremetal, jsonutils.Marshal(err))
return
}
+1 -1
View File
@@ -1035,7 +1035,7 @@ func (s *SGuestSnapshotDeleteTask) onReloadBlkdevSucc(err string) {
func (s *SGuestSnapshotDeleteTask) onSnapshotBlkdevFail(res string) {
snapshotPath := path.Join(s.disk.GetSnapshotDir(), s.convertSnapshot)
if output, err := procutils.NewCommand("mv", "-f", s.tmpPath, snapshotPath).Output(); err != nil {
log.Errorln("mv %s to %s failed: %s, %s", s.tmpPath, snapshotPath, err, output)
log.Errorf("mv %s to %s failed: %s, %s", s.tmpPath, snapshotPath, err, output)
}
s.taskFailed("Reload blkdev failed")
}
+8 -10
View File
@@ -144,7 +144,7 @@ func (d *SLocalDisk) Resize(ctx context.Context, params interface{}) (jsonutils.
sizeMb, _ := diskInfo.Int("size")
disk, err := qemuimg.NewQemuImage(d.GetPath())
if err != nil {
log.Errorln(err)
log.Errorf("qemuimg.NewQemuImage %s fail: %s", d.GetPath(), err)
return nil, err
}
if err := disk.Resize(int(sizeMb)); err != nil {
@@ -163,15 +163,13 @@ func (d *SLocalDisk) Resize(ctx context.Context, params interface{}) (jsonutils.
func (d *SLocalDisk) CreateFromImageFuse(ctx context.Context, url string, size int64) error {
log.Infof("Create from image fuse %s", url)
var (
localPath = d.Storage.GetFuseTmpPath()
mntPath = path.Join(d.Storage.GetFuseMountPath(), d.Id)
contentPath = path.Join(mntPath, "content")
newImg, err = qemuimg.NewQemuImage(d.getPath())
)
localPath := d.Storage.GetFuseTmpPath()
mntPath := path.Join(d.Storage.GetFuseMountPath(), d.Id)
contentPath := path.Join(mntPath, "content")
newImg, err := qemuimg.NewQemuImage(d.getPath())
if err != nil {
log.Errorln(err)
log.Errorf("qemuimg.NewQemuImage %s fail: %s", d.getPath(), err)
return err
}
@@ -344,14 +342,14 @@ func (d *SLocalDisk) CreateSnapshot(snapshotId string) error {
if !fileutils2.Exists(snapshotDir) {
output, err := procutils.NewCommand("mkdir", "-p", snapshotDir).Output()
if err != nil {
log.Errorln("mkdir %s failed: %s", snapshotDir, output)
log.Errorf("mkdir %s failed: %s", snapshotDir, output)
return errors.Wrapf(err, "mkdir %s failed: %s", snapshotDir, output)
}
}
snapshotPath := path.Join(snapshotDir, snapshotId)
output, err := procutils.NewCommand("mv", "-f", d.getPath(), snapshotPath).Output()
if err != nil {
log.Errorln("mv %s to %s failed %s", d.getPath(), snapshotPath, output)
log.Errorf("mv %s to %s failed %s", d.getPath(), snapshotPath, output)
return errors.Wrapf(err, "mv %s to %s failed %s", d.getPath(), snapshotPath, output)
}
img, err := qemuimg.NewQemuImage(d.getPath())
+1 -1
View File
@@ -181,7 +181,7 @@ func (self *SLDAPDriver) syncUsers(ctx context.Context, cli *ldaputils.SLDAPClie
if err != nil {
return nil, errors.Wrap(err, "searchLDAP")
}
log.Debugf("syncUsers: ldapSearch entries: %s", entries)
log.Debugf("syncUsers: ldapSearch entries: %#v", entries)
userIds := make([]string, 0)
userIdMap := make(map[string]string)
for i := range entries {
+4 -4
View File
@@ -101,12 +101,12 @@ func (man *SAlertDashBoardManager) ValidateCreateData(
for _, query := range data.CommonMetricInputQuery.MetricQuery {
if len(query.Comparator) != 0 {
if !utils.IsInStringArray(getQueryEvalType(query.Comparator), validators.EvaluatorDefaultTypes) {
return data, httperrors.NewInputParameterError("the Comparator is illegal:", query.Comparator)
return data, httperrors.NewInputParameterError("the Comparator is illegal: %s", query.Comparator)
}
}
if len(query.Reduce) != 0 {
if _, ok := monitor.AlertReduceFunc[query.Reduce]; !ok {
return data, httperrors.NewInputParameterError("the reduce is illegal", query.Reduce)
return data, httperrors.NewInputParameterError("the reduce is illegal %s", query.Reduce)
}
}
}
@@ -249,12 +249,12 @@ func (dash *SAlertDashBoard) ValidateUpdateData(
}
if len(query.Comparator) != 0 {
if !utils.IsInStringArray(getQueryEvalType(query.Comparator), validators.EvaluatorDefaultTypes) {
return data, httperrors.NewInputParameterError("the Comparator is illegal:", query.Comparator)
return data, httperrors.NewInputParameterError("the Comparator is illegal: %s", query.Comparator)
}
}
if len(query.Reduce) != 0 {
if _, ok := monitor.AlertReduceFunc[query.Reduce]; !ok {
return data, httperrors.NewInputParameterError("the reduce is illegal", query.Reduce)
return data, httperrors.NewInputParameterError("the reduce is illegal: %s", query.Reduce)
}
}
}
+4 -4
View File
@@ -104,10 +104,10 @@ func (man *SCommonAlertManager) ValidateCreateData(
} else {
for _, query := range data.CommonMetricInputQuery.MetricQuery {
if !utils.IsInStringArray(getQueryEvalType(query.Comparator), validators.EvaluatorDefaultTypes) {
return data, httperrors.NewInputParameterError("the Comparator is illegal:", query.Comparator)
return data, httperrors.NewInputParameterError("the Comparator is illegal: %s", query.Comparator)
}
if _, ok := monitor.AlertReduceFunc[query.Reduce]; !ok {
return data, httperrors.NewInputParameterError("the reduce is illegal", query.Reduce)
return data, httperrors.NewInputParameterError("the reduce is illegal: %s", query.Reduce)
}
if query.Threshold == 0 {
return data, httperrors.NewInputParameterError("threshold is meaningless")
@@ -669,10 +669,10 @@ func (alert *SCommonAlert) ValidateUpdateData(
return data, errors.Wrap(err, "metric_query Unmarshal error")
}
if !utils.IsInStringArray(getQueryEvalType(query.Comparator), validators.EvaluatorDefaultTypes) {
return data, httperrors.NewInputParameterError("the Comparator is illegal:", query.Comparator)
return data, httperrors.NewInputParameterError("the Comparator is illegal: %s", query.Comparator)
}
if _, ok := monitor.AlertReduceFunc[query.Reduce]; !ok {
return data, httperrors.NewInputParameterError("the reduce is illegal", query.Reduce)
return data, httperrors.NewInputParameterError("the reduce is illegal: %s", query.Reduce)
}
if query.Threshold == 0 {
return data, httperrors.NewInputParameterError("threshold is meaningless")
+1 -1
View File
@@ -167,7 +167,7 @@ func (man *SSuggestSysRuleManager) ValidateCreateData(
return data, err
}
} else if rule != nil {
return data, httperrors.NewDuplicateResourceError("type %s rule already exists")
return data, httperrors.NewDuplicateResourceError("type %s rule already exists", data.Type)
}
drvType := monitor.SuggestDriverType(data.Type)