fix(host): qemu extra params format (#22608)

This commit is contained in:
wanyaoqi
2025-05-27 13:34:04 +08:00
committed by GitHub
parent 66b052741b
commit 13197c19a4
2 changed files with 9 additions and 7 deletions

View File

@@ -331,10 +331,12 @@ func (s *SKVMGuestInstance) extraOptions() string {
case *jsonutils.JSONArray:
for i := 0; i < jsonV.Size(); i++ {
vAtI, _ := jsonV.GetAt(i)
cmd += fmt.Sprintf(" -%s %s", k, vAtI.String())
vStr, _ := vAtI.GetString()
cmd += fmt.Sprintf(" -%s %s", k, vStr)
}
default:
cmd += fmt.Sprintf(" -%s %s", k, v.String())
vstr, _ := v.GetString()
cmd += fmt.Sprintf(" -%s %s", k, vstr)
}
}
return cmd

View File

@@ -862,11 +862,6 @@ func GenerateStartOptions(
// pidfile
opts = append(opts, drvOpt.Pidfile(input.PidFilePath))
// extra options
if len(input.ExtraOptions) != 0 {
opts = append(opts, input.ExtraOptions...)
}
// qga
// opts = append(opts, drvOpt.QGA(input.HomeDir)...)
if input.GuestDesc.Qga != nil {
@@ -891,5 +886,10 @@ func GenerateStartOptions(
opts = append(opts, generatePvpanicDeviceOption(input.GuestDesc.Pvpanic))
}
// move extra options to end of cmdline
if len(input.ExtraOptions) != 0 {
opts = append(opts, input.ExtraOptions...)
}
return strings.Join(opts, " "), nil
}