qemu: show the thread name when enable the hypervisor.debug option

Add debug-threads=on in the name argument if debug enabled.

Fixes: #9400
Signed-off-by: Guoqiang Ding <dgq8211@gmail.com>
This commit is contained in:
Guoqiang Ding 2024-04-03 10:30:24 +08:00
parent 7795f9c016
commit cd0c31e185
2 changed files with 11 additions and 1 deletions

View File

@ -2782,6 +2782,8 @@ type Config struct {
PidFile string
qemuParams []string
Debug bool
}
// appendFDs appends a list of arbitrary file descriptors to the qemu configuration and
@ -2818,8 +2820,15 @@ func (config *Config) appendSeccompSandbox() {
func (config *Config) appendName() {
if config.Name != "" {
var nameParams []string
nameParams = append(nameParams, config.Name)
if config.Debug {
nameParams = append(nameParams, "debug-threads=on")
}
config.qemuParams = append(config.qemuParams, "-name")
config.qemuParams = append(config.qemuParams, config.Name)
config.qemuParams = append(config.qemuParams, strings.Join(nameParams, ","))
}
}

View File

@ -700,6 +700,7 @@ func (q *qemu) CreateVM(ctx context.Context, id string, network Network, hypervi
Bios: firmwarePath,
PFlash: pflash,
PidFile: filepath.Join(q.config.VMStorePath, q.id, "pid"),
Debug: hypervisorConfig.Debug,
}
qemuConfig.Devices, qemuConfig.Bios, err = q.arch.appendProtectionDevice(qemuConfig.Devices, firmwarePath, firmwareVolumePath)