mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-09-25 10:43:15 +00:00
runtime: Add hmp for qemu
Fixes: #6092 Signed-off-by: zhaojizhuang <571130360@qq.com>
This commit is contained in:
@@ -505,7 +505,7 @@ type HypervisorConfig struct {
|
||||
EnableIOThreads bool
|
||||
|
||||
// Debug changes the default hypervisor and kernel parameters to
|
||||
// enable debug output where available.
|
||||
// enable debug output where available. And Debug also enable the hmp socket.
|
||||
Debug bool
|
||||
|
||||
// MemPrealloc specifies if the memory should be pre-allocated
|
||||
|
@@ -121,6 +121,7 @@ type qemu struct {
|
||||
const (
|
||||
consoleSocket = "console.sock"
|
||||
qmpSocket = "qmp.sock"
|
||||
hmpSocket = "hmp.sock"
|
||||
vhostFSSocket = "vhost-fs.sock"
|
||||
nydusdAPISock = "nydusd-api.sock"
|
||||
|
||||
@@ -328,6 +329,10 @@ func (q *qemu) qmpSocketPath(id string) (string, error) {
|
||||
return utils.BuildSocketPath(q.config.VMStorePath, id, qmpSocket)
|
||||
}
|
||||
|
||||
func (q *qemu) hmpSocketPath(id string) (string, error) {
|
||||
return utils.BuildSocketPath(q.config.VMStorePath, id, hmpSocket)
|
||||
}
|
||||
|
||||
func (q *qemu) getQemuMachine() (govmmQemu.Machine, error) {
|
||||
machine := q.arch.machine()
|
||||
|
||||
@@ -369,13 +374,30 @@ func (q *qemu) createQmpSocket() ([]govmmQemu.QMPSocket, error) {
|
||||
path: monitorSockPath,
|
||||
}
|
||||
|
||||
return []govmmQemu.QMPSocket{
|
||||
{
|
||||
var sockets []govmmQemu.QMPSocket
|
||||
|
||||
sockets = append(sockets, govmmQemu.QMPSocket{
|
||||
Type: "unix",
|
||||
Server: true,
|
||||
NoWait: true,
|
||||
})
|
||||
|
||||
if q.HypervisorConfig().Debug {
|
||||
humanMonitorSockPath, err := q.hmpSocketPath(q.id)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
sockets = append(sockets, govmmQemu.QMPSocket{
|
||||
Type: "unix",
|
||||
IsHmp: true,
|
||||
Name: humanMonitorSockPath,
|
||||
Server: true,
|
||||
NoWait: true,
|
||||
},
|
||||
}, nil
|
||||
})
|
||||
}
|
||||
|
||||
return sockets, nil
|
||||
}
|
||||
|
||||
func (q *qemu) buildDevices(ctx context.Context, initrdPath string) ([]govmmQemu.Device, *govmmQemu.IOThread, error) {
|
||||
|
Reference in New Issue
Block a user