Files
kata-containers/virtcontainers/cc_proxy.go
fupan 9155412b24 api: To watch the vm console in FetchSandbox api
When do sandbox release, the kataBuiltInProxy will
be closed, and it will stop the watch of vm's console;
Thus it needs to restart the proxy to monitor the vm
console once to restore the sandbox.

Fixes: #441

Signed-off-by: fupan <lifupan@gmail.com>
2018-06-26 08:04:33 +08:00

49 lines
1015 B
Go

// Copyright (c) 2017 Intel Corporation
//
// SPDX-License-Identifier: Apache-2.0
//
package virtcontainers
import (
"os/exec"
)
type ccProxy struct {
}
// start is the proxy start implementation for ccProxy.
func (p *ccProxy) start(sandbox *Sandbox, params proxyParams) (int, string, error) {
config, err := newProxyConfig(sandbox.config)
if err != nil {
return -1, "", err
}
// construct the socket path the proxy instance will use
proxyURL, err := defaultProxyURL(sandbox, SocketTypeUNIX)
if err != nil {
return -1, "", err
}
args := []string{config.Path, "-uri", proxyURL}
if config.Debug {
args = append(args, "-log", "debug")
}
cmd := exec.Command(args[0], args[1:]...)
if err := cmd.Start(); err != nil {
return -1, "", err
}
return cmd.Process.Pid, proxyURL, nil
}
func (p *ccProxy) stop(sandbox *Sandbox, pid int) error {
return nil
}
// The ccproxy doesn't need to watch the vm console, thus return false always.
func (p *ccProxy) consoleWatched() bool {
return false
}