mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-09-14 13:29:31 +00:00
runtime: add enable_debug_console configuration item for agent
Set enable_debug_console=true in Kata's congiguration file, runtime will pass `agent.debug_console` and `agent.debug_console_vport=1026` to agent. Fixes: #245 Signed-off-by: bin liu <bin@hyper.sh>
This commit is contained in:
@@ -52,6 +52,11 @@ const (
|
||||
|
||||
// path to vfio devices
|
||||
vfioPath = "/dev/vfio/"
|
||||
|
||||
// enable debug console
|
||||
kernelParamDebugConsole = "agent.debug_console"
|
||||
kernelParamDebugConsoleVPort = "agent.debug_console_vport"
|
||||
kernelParamDebugConsoleVPortValue = "1026"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -195,13 +200,14 @@ func ephemeralPath() string {
|
||||
// KataAgentConfig is a structure storing information needed
|
||||
// to reach the Kata Containers agent.
|
||||
type KataAgentConfig struct {
|
||||
LongLiveConn bool
|
||||
Debug bool
|
||||
Trace bool
|
||||
ContainerPipeSize uint32
|
||||
TraceMode string
|
||||
TraceType string
|
||||
KernelModules []string
|
||||
LongLiveConn bool
|
||||
Debug bool
|
||||
Trace bool
|
||||
EnableDebugConsole bool
|
||||
ContainerPipeSize uint32
|
||||
TraceMode string
|
||||
TraceType string
|
||||
KernelModules []string
|
||||
}
|
||||
|
||||
// KataAgentState is the structure describing the data stored from this
|
||||
@@ -294,6 +300,11 @@ func KataAgentKernelParams(config KataAgentConfig) []Param {
|
||||
params = append(params, Param{Key: vcAnnotations.ContainerPipeSizeKernelParam, Value: containerPipeSize})
|
||||
}
|
||||
|
||||
if config.EnableDebugConsole {
|
||||
params = append(params, Param{Key: kernelParamDebugConsole, Value: ""})
|
||||
params = append(params, Param{Key: kernelParamDebugConsoleVPort, Value: kernelParamDebugConsoleVPortValue})
|
||||
}
|
||||
|
||||
return params
|
||||
}
|
||||
|
||||
@@ -1208,16 +1219,6 @@ func (k *kataAgent) buildContainerRootfs(sandbox *Sandbox, c *Container, rootPat
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (k *kataAgent) hasAgentDebugConsole(sandbox *Sandbox) bool {
|
||||
for _, p := range sandbox.config.HypervisorConfig.KernelParams {
|
||||
if p.Key == "agent.debug_console" {
|
||||
k.Logger().Info("agent has debug console")
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (k *kataAgent) createContainer(sandbox *Sandbox, c *Container) (p *Process, err error) {
|
||||
span, _ := k.trace("createContainer")
|
||||
defer span.Finish()
|
||||
|
@@ -101,7 +101,15 @@ func TestVMConfigGrpc(t *testing.T) {
|
||||
config := VMConfig{
|
||||
HypervisorType: QemuHypervisor,
|
||||
HypervisorConfig: newQemuConfig(),
|
||||
AgentConfig: KataAgentConfig{true, false, false, 0, "", "", []string{}},
|
||||
AgentConfig: KataAgentConfig{
|
||||
LongLiveConn: true,
|
||||
Debug: false,
|
||||
Trace: false,
|
||||
EnableDebugConsole: false,
|
||||
ContainerPipeSize: 0,
|
||||
TraceMode: "",
|
||||
TraceType: "",
|
||||
KernelModules: []string{}},
|
||||
}
|
||||
|
||||
p, err := config.ToGrpc()
|
||||
|
Reference in New Issue
Block a user