mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-05-02 05:34:46 +00:00
hypervisor: The SandboxConsole is the VM's console
update naming Signed-off-by: Manohar Castelino <mcastelino@apple.com>
This commit is contained in:
parent
4d47aeef2e
commit
8f78e1cc19
@ -248,7 +248,7 @@ func (a *Acrn) buildDevices(ctx context.Context, imagePath string) ([]Device, er
|
||||
return nil, fmt.Errorf("Image Path should not be empty: %s", imagePath)
|
||||
}
|
||||
|
||||
_, console, err := a.GetSandboxConsole(ctx, a.id)
|
||||
_, console, err := a.GetVMConsole(ctx, a.id)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -630,8 +630,8 @@ func (a *Acrn) AddDevice(ctx context.Context, devInfo interface{}, devType Devic
|
||||
|
||||
// getSandboxConsole builds the path of the console where we can read
|
||||
// logs coming from the sandbox.
|
||||
func (a *Acrn) GetSandboxConsole(ctx context.Context, id string) (string, string, error) {
|
||||
span, _ := katatrace.Trace(ctx, a.Logger(), "GetSandboxConsole", acrnTracingTags, map[string]string{"sandbox_id": a.id})
|
||||
func (a *Acrn) GetVMConsole(ctx context.Context, id string) (string, string, error) {
|
||||
span, _ := katatrace.Trace(ctx, a.Logger(), "GetVMConsole", acrnTracingTags, map[string]string{"sandbox_id": a.id})
|
||||
defer span.End()
|
||||
|
||||
consoleURL, err := utils.BuildSocketPath(a.store.RunVMStoragePath(), id, acrnConsoleSocket)
|
||||
|
@ -205,7 +205,7 @@ func TestAcrnGetSandboxConsole(t *testing.T) {
|
||||
sandboxID := "testSandboxID"
|
||||
expected := filepath.Join(a.store.RunVMStoragePath(), sandboxID, consoleSocket)
|
||||
|
||||
proto, result, err := a.GetSandboxConsole(a.ctx, sandboxID)
|
||||
proto, result, err := a.GetVMConsole(a.ctx, sandboxID)
|
||||
assert.NoError(err)
|
||||
assert.Equal(result, expected)
|
||||
assert.Equal(proto, consoleProtoUnix)
|
||||
|
@ -425,8 +425,8 @@ func (clh *cloudHypervisor) startSandbox(ctx context.Context, timeout int) error
|
||||
|
||||
// getSandboxConsole builds the path of the console where we can read
|
||||
// logs coming from the sandbox.
|
||||
func (clh *cloudHypervisor) GetSandboxConsole(ctx context.Context, id string) (string, string, error) {
|
||||
clh.Logger().WithField("function", "GetSandboxConsole").WithField("id", id).Info("Get Sandbox Console")
|
||||
func (clh *cloudHypervisor) GetVMConsole(ctx context.Context, id string) (string, string, error) {
|
||||
clh.Logger().WithField("function", "GetVMConsole").WithField("id", id).Info("Get Sandbox Console")
|
||||
master, slave, err := console.NewPty()
|
||||
if err != nil {
|
||||
clh.Logger().WithError(err).Error("Error create pseudo tty")
|
||||
|
@ -1126,7 +1126,7 @@ func (fc *firecracker) HotplugRemoveDevice(ctx context.Context, devInfo interfac
|
||||
|
||||
// getSandboxConsole builds the path of the console where we can read
|
||||
// logs coming from the sandbox.
|
||||
func (fc *firecracker) GetSandboxConsole(ctx context.Context, id string) (string, string, error) {
|
||||
func (fc *firecracker) GetVMConsole(ctx context.Context, id string) (string, string, error) {
|
||||
master, slave, err := console.NewPty()
|
||||
if err != nil {
|
||||
fc.Logger().Debugf("Error create pseudo tty: %v", err)
|
||||
|
@ -910,7 +910,7 @@ type hypervisor interface {
|
||||
HotplugRemoveDevice(ctx context.Context, devInfo interface{}, devType DeviceType) (interface{}, error)
|
||||
ResizeMemory(ctx context.Context, memMB uint32, memoryBlockSizeMB uint32, probe bool) (uint32, MemoryDevice, error)
|
||||
ResizeVCPUs(ctx context.Context, vcpus uint32) (uint32, uint32, error)
|
||||
GetSandboxConsole(ctx context.Context, sandboxID string) (string, string, error)
|
||||
GetVMConsole(ctx context.Context, sandboxID string) (string, string, error)
|
||||
Disconnect(ctx context.Context)
|
||||
Capabilities(ctx context.Context) types.Capabilities
|
||||
HypervisorConfig() HypervisorConfig
|
||||
|
@ -91,7 +91,7 @@ func (m *mockHypervisor) HotplugRemoveDevice(ctx context.Context, devInfo interf
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (m *mockHypervisor) GetSandboxConsole(ctx context.Context, sandboxID string) (string, string, error) {
|
||||
func (m *mockHypervisor) GetVMConsole(ctx context.Context, sandboxID string) (string, string, error) {
|
||||
return "", "", nil
|
||||
}
|
||||
|
||||
|
@ -67,7 +67,7 @@ func TestMockHypervisorGetSandboxConsole(t *testing.T) {
|
||||
|
||||
expected := ""
|
||||
expectedProto := ""
|
||||
proto, result, err := m.GetSandboxConsole(context.Background(), "testSandboxID")
|
||||
proto, result, err := m.GetVMConsole(context.Background(), "testSandboxID")
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, result, expected)
|
||||
assert.Equal(t, proto, expectedProto)
|
||||
|
@ -388,7 +388,7 @@ func (q *qemu) createQmpSocket() ([]govmmQemu.QMPSocket, error) {
|
||||
func (q *qemu) buildDevices(ctx context.Context, initrdPath string) ([]govmmQemu.Device, *govmmQemu.IOThread, error) {
|
||||
var devices []govmmQemu.Device
|
||||
|
||||
_, console, err := q.GetSandboxConsole(ctx, q.id)
|
||||
_, console, err := q.GetVMConsole(ctx, q.id)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
@ -484,6 +484,7 @@ func (q *qemu) createSandbox(ctx context.Context, id string, networkNS NetworkNa
|
||||
span, ctx := katatrace.Trace(ctx, q.Logger(), "createSandbox", qemuTracingTags, map[string]string{"sandbox_id": q.id})
|
||||
defer span.End()
|
||||
|
||||
// Has Kata Specific logic: See within
|
||||
if err := q.setup(ctx, id, hypervisorConfig); err != nil {
|
||||
return err
|
||||
}
|
||||
@ -513,6 +514,7 @@ func (q *qemu) createSandbox(ctx context.Context, id string, networkNS NetworkNa
|
||||
IOMMUPlatform: q.config.IOMMUPlatform,
|
||||
}
|
||||
|
||||
// MRC: Kata specific
|
||||
kernelPath, err := q.config.KernelAssetPath()
|
||||
if err != nil {
|
||||
return err
|
||||
@ -2024,8 +2026,8 @@ func (q *qemu) AddDevice(ctx context.Context, devInfo interface{}, devType Devic
|
||||
|
||||
// getSandboxConsole builds the path of the console where we can read
|
||||
// logs coming from the sandbox.
|
||||
func (q *qemu) GetSandboxConsole(ctx context.Context, id string) (string, string, error) {
|
||||
span, _ := katatrace.Trace(ctx, q.Logger(), "GetSandboxConsole", qemuTracingTags, map[string]string{"sandbox_id": q.id})
|
||||
func (q *qemu) GetVMConsole(ctx context.Context, id string) (string, string, error) {
|
||||
span, _ := katatrace.Trace(ctx, q.Logger(), "GetVMConsole", qemuTracingTags, map[string]string{"sandbox_id": q.id})
|
||||
defer span.End()
|
||||
|
||||
consoleURL, err := utils.BuildSocketPath(q.store.RunVMStoragePath(), id, consoleSocket)
|
||||
|
@ -332,7 +332,7 @@ func TestQemuGetSandboxConsole(t *testing.T) {
|
||||
sandboxID := "testSandboxID"
|
||||
expected := filepath.Join(q.store.RunVMStoragePath(), sandboxID, consoleSocket)
|
||||
|
||||
proto, result, err := q.GetSandboxConsole(q.ctx, sandboxID)
|
||||
proto, result, err := q.GetVMConsole(q.ctx, sandboxID)
|
||||
assert.NoError(err)
|
||||
assert.Equal(result, expected)
|
||||
assert.Equal(proto, consoleProtoUnix)
|
||||
|
@ -979,7 +979,7 @@ func newConsoleWatcher(ctx context.Context, s *Sandbox) (*consoleWatcher, error)
|
||||
cw consoleWatcher
|
||||
)
|
||||
|
||||
cw.proto, cw.consoleURL, err = s.hypervisor.GetSandboxConsole(ctx, s.id)
|
||||
cw.proto, cw.consoleURL, err = s.hypervisor.GetVMConsole(ctx, s.id)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user