virtcontainer: watch the qemu's console when proxy's debug enabled

kata builtin proxy has always watched the qemu's console
whether proxy's debug is set or not, this is not aligned
with kata cli. This patch will change it and watch the
qemu's console only when proxy's debug is set in kata config.

Fixes: #1318

Signed-off-by: fupan <lifupan@gmail.com>
This commit is contained in:
fupan 2019-03-05 11:40:55 +08:00
parent 886d859fbe
commit c4957ddd8d
2 changed files with 8 additions and 5 deletions

View File

@ -55,11 +55,14 @@ func (p *kataBuiltInProxy) start(params proxyParams) (int, string, error) {
params.logger.Debug("Starting builtin kata proxy")
p.sandboxID = params.id
if params.debug {
err := p.watchConsole(buildinProxyConsoleProto, params.consoleURL, params.logger)
if err != nil {
p.sandboxID = ""
return -1, "", err
}
}
return -1, params.agentURL, nil
}

View File

@ -17,7 +17,7 @@ func TestKataBuiltinProxy(t *testing.T) {
p := kataBuiltInProxy{}
params := proxyParams{}
params := proxyParams{debug: true}
err := p.validateParams(params)
assert.NotNil(err)