mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-28 16:27:50 +00:00
virtcontainers: set agent's logs vsock port
In firecracker, there is no socket connected to /dev/console, so let's use a vsock port to get agent's logs Depends-on: github.com/kata-containers/shim#210 fixes #2103 Signed-off-by: Julio Montes <julio.montes@intel.com>
This commit is contained in:
parent
93197ddcc3
commit
aa43e2a9ac
@ -21,6 +21,7 @@ import (
|
|||||||
|
|
||||||
httptransport "github.com/go-openapi/runtime/client"
|
httptransport "github.com/go-openapi/runtime/client"
|
||||||
"github.com/go-openapi/strfmt"
|
"github.com/go-openapi/strfmt"
|
||||||
|
kataclient "github.com/kata-containers/agent/protocols/client"
|
||||||
persistapi "github.com/kata-containers/runtime/virtcontainers/persist/api"
|
persistapi "github.com/kata-containers/runtime/virtcontainers/persist/api"
|
||||||
"github.com/kata-containers/runtime/virtcontainers/pkg/firecracker/client"
|
"github.com/kata-containers/runtime/virtcontainers/pkg/firecracker/client"
|
||||||
models "github.com/kata-containers/runtime/virtcontainers/pkg/firecracker/client/models"
|
models "github.com/kata-containers/runtime/virtcontainers/pkg/firecracker/client/models"
|
||||||
@ -83,6 +84,9 @@ var fcKernelParams = append(commonVirtioblkKernelRootParams, []Param{
|
|||||||
// Firecracker doesn't support ACPI
|
// Firecracker doesn't support ACPI
|
||||||
// Fix kernel error "ACPI BIOS Error (bug)"
|
// Fix kernel error "ACPI BIOS Error (bug)"
|
||||||
{"acpi", "off"},
|
{"acpi", "off"},
|
||||||
|
|
||||||
|
// Tell agent where to send the logs
|
||||||
|
{"agent.log_vport", fmt.Sprintf("%d", vSockLogsPort)},
|
||||||
}...)
|
}...)
|
||||||
|
|
||||||
func (s vmmState) String() string {
|
func (s vmmState) String() string {
|
||||||
@ -977,11 +981,8 @@ func (fc *firecracker) hotplugRemoveDevice(devInfo interface{}, devType deviceTy
|
|||||||
|
|
||||||
// getSandboxConsole builds the path of the console where we can read
|
// getSandboxConsole builds the path of the console where we can read
|
||||||
// logs coming from the sandbox.
|
// logs coming from the sandbox.
|
||||||
//
|
|
||||||
// we can get logs from firecracker itself; WIP on enabling. Who needs
|
|
||||||
// logs when you're just hacking?
|
|
||||||
func (fc *firecracker) getSandboxConsole(id string) (string, error) {
|
func (fc *firecracker) getSandboxConsole(id string) (string, error) {
|
||||||
return "", nil
|
return fmt.Sprintf("%s://%s:%d", kataclient.HybridVSockScheme, filepath.Join(fc.jailerRoot, defaultHybridVSocketName), vSockLogsPort), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (fc *firecracker) disconnect() {
|
func (fc *firecracker) disconnect() {
|
||||||
|
@ -69,6 +69,10 @@ const (
|
|||||||
// CAP_NET_BIND_SERVICE capability may bind to these port numbers.
|
// CAP_NET_BIND_SERVICE capability may bind to these port numbers.
|
||||||
vSockPort = 1024
|
vSockPort = 1024
|
||||||
|
|
||||||
|
// Port where the agent will send the logs. Logs are sent through the vsock in cases
|
||||||
|
// where the hypervisor has no console.sock, i.e firecracker
|
||||||
|
vSockLogsPort = 1025
|
||||||
|
|
||||||
// MinHypervisorMemory is the minimum memory required for a VM.
|
// MinHypervisorMemory is the minimum memory required for a VM.
|
||||||
MinHypervisorMemory = 256
|
MinHypervisorMemory = 256
|
||||||
)
|
)
|
||||||
|
@ -11,7 +11,9 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
"net"
|
"net"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
kataclient "github.com/kata-containers/agent/protocols/client"
|
||||||
"github.com/kata-containers/runtime/virtcontainers/store"
|
"github.com/kata-containers/runtime/virtcontainers/store"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
@ -241,7 +243,8 @@ func (p *proxyBuiltin) start(params proxyParams) (int, string, error) {
|
|||||||
|
|
||||||
// For firecracker, it hasn't support the console watching and it's consoleURL
|
// For firecracker, it hasn't support the console watching and it's consoleURL
|
||||||
// will be set empty.
|
// will be set empty.
|
||||||
if params.debug && params.consoleURL != "" {
|
// TODO: add support for hybrid vsocks, see https://github.com/kata-containers/runtime/issues/2098
|
||||||
|
if params.debug && params.consoleURL != "" && !strings.HasPrefix(params.consoleURL, kataclient.HybridVSockScheme) {
|
||||||
err := p.watchConsole(buildinProxyConsoleProto, params.consoleURL, params.logger)
|
err := p.watchConsole(buildinProxyConsoleProto, params.consoleURL, params.logger)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
p.sandboxID = ""
|
p.sandboxID = ""
|
||||||
|
Loading…
Reference in New Issue
Block a user