mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-19 02:37:24 +08:00
Merge pull request #18634 from testwill/fmt
chore: unnecessary use of fmt.Sprintf d
This commit is contained in:
@@ -373,7 +373,7 @@ Loop:
|
||||
if err != nil {
|
||||
log.Errorf("unable to kill process '%d'", vd.Proc.Process.Pid)
|
||||
}
|
||||
return errors.Error(fmt.Sprintf("VDDKDisk read timeout, program blocked"))
|
||||
return errors.Error("VDDKDisk read timeout, program blocked")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -200,7 +200,7 @@ func (s *SGuestSuspendTask) onSaveMemStateWait(results string) {
|
||||
|
||||
func (s *SGuestSuspendTask) onSaveMemStateCheck(status string) {
|
||||
if status == "failed" {
|
||||
hostutils.TaskFailed(s.ctx, fmt.Sprintf("Save memory state failed"))
|
||||
hostutils.TaskFailed(s.ctx, "Save memory state failed")
|
||||
// TODO: send cont command
|
||||
return
|
||||
} else if status != "completed" {
|
||||
|
||||
@@ -683,12 +683,12 @@ func (s *SKVMGuestInstance) generateStopScript(data *jsonutils.JSONDict) string
|
||||
cmd += "fi\n"
|
||||
|
||||
cmd += fmt.Sprintf("for d in $(ls -d /dev/hugepages/%s*)\n", uuid)
|
||||
cmd += fmt.Sprintf("do\n")
|
||||
cmd += fmt.Sprintf(" if [ -d $d ]; then\n")
|
||||
cmd += fmt.Sprintf(" umount $d\n")
|
||||
cmd += fmt.Sprintf(" rm -rf $d\n")
|
||||
cmd += fmt.Sprintf(" fi\n")
|
||||
cmd += fmt.Sprintf("done\n")
|
||||
cmd += "do\n"
|
||||
cmd += " if [ -d $d ]; then\n"
|
||||
cmd += " umount $d\n"
|
||||
cmd += " rm -rf $d\n"
|
||||
cmd += " fi\n"
|
||||
cmd += "done\n"
|
||||
|
||||
for _, nic := range nics {
|
||||
if nic.Driver == api.NETWORK_DRIVER_VFIO {
|
||||
|
||||
@@ -511,7 +511,7 @@ func getNicDeviceOption(
|
||||
|
||||
if nic.Driver == "virtio" {
|
||||
if nic.NumQueues > 1 {
|
||||
cmd += fmt.Sprintf(",mq=on")
|
||||
cmd += ",mq=on"
|
||||
}
|
||||
if nic.Vectors != nil {
|
||||
cmd += fmt.Sprintf(",vectors=%d", *nic.Vectors)
|
||||
@@ -614,7 +614,7 @@ func getMigrateOptions(drvOpt QemuOptions, input *GenerateStartOptionsInput) []s
|
||||
opts := make([]string, 0)
|
||||
if input.NeedMigrate {
|
||||
if input.LiveMigrateUseTLS {
|
||||
opts = append(opts, fmt.Sprintf("-incoming defer"))
|
||||
opts = append(opts, "-incoming defer")
|
||||
} else {
|
||||
opts = append(opts, fmt.Sprintf("-incoming tcp:0:%d", input.LiveMigratePort))
|
||||
}
|
||||
|
||||
@@ -1309,7 +1309,7 @@ func (h *SHostInfo) ensureHostRecord(zoneId string) (*api.HostDetails, error) {
|
||||
|
||||
// 上次未能正常offline, 补充一次健康日志
|
||||
if hosts[0].HostStatus == api.HOST_ONLINE {
|
||||
reason := fmt.Sprintf("The host status is online when it staring. Maybe the control center was down earlier")
|
||||
reason := "The host status is online when it staring. Maybe the control center was down earlier"
|
||||
logclient.AddSimpleActionLog(h, logclient.ACT_HEALTH_CHECK, map[string]string{"reason": reason}, hostutils.GetComputeSession(context.Background()).GetToken(), false)
|
||||
data := jsonutils.NewDict()
|
||||
data.Add(jsonutils.NewString(h.GetName()), "name")
|
||||
|
||||
@@ -440,7 +440,7 @@ func (m *HmpMonitor) BlockStream(drive string, callback StringCallback) {
|
||||
}
|
||||
|
||||
func (m *HmpMonitor) BlockJobComplete(drive string, callback StringCallback) {
|
||||
m.Query(fmt.Sprintf("block_job_complete"), callback)
|
||||
m.Query("block_job_complete", callback)
|
||||
}
|
||||
|
||||
func (m *HmpMonitor) BlockReopenImage(drive, newImagePath, format string, cb StringCallback) {
|
||||
|
||||
@@ -200,12 +200,12 @@ func DmRemove(dmPath string) error {
|
||||
}
|
||||
|
||||
func DmCreate(lv1, lv2, dmName string) error {
|
||||
var dmCreateScript = fmt.Sprintf(`
|
||||
var dmCreateScript = `
|
||||
size1=$(blockdev --getsz $1)
|
||||
size2=$(blockdev --getsz $2)
|
||||
echo "0 $size1 linear $1 0
|
||||
$size1 $size2 linear $2 0" | dmsetup create $3
|
||||
`)
|
||||
`
|
||||
out, err := procutils.NewRemoteCommandAsFarAsPossible("bash", "-c", dmCreateScript, "--", lv1, lv2, dmName).Output()
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "create device mapper failed %s", out)
|
||||
|
||||
Reference in New Issue
Block a user