mirror of
https://github.com/aljazceru/kata-containers.git
synced 2025-12-19 15:24:26 +01:00
qemu: allow using legacy serial device for the console
This allows to get guest early boot logs which are usually missed when virtconsole is used. - It utilizes previous work on the govmm side: https://github.com/kata-containers/govmm/pull/203 - unit test added Fixes: #4237 Signed-off-by: Snir Sheriber <ssheribe@redhat.com>
This commit is contained in:
@@ -263,6 +263,34 @@ func TestQemuArchBaseAppendConsoles(t *testing.T) {
|
||||
assert.Contains(qemuArchBase.kernelParams, Param{"console", "hvc1"})
|
||||
}
|
||||
|
||||
func TestQemuArchBaseAppendConsolesLegacy(t *testing.T) {
|
||||
var devices []govmmQemu.Device
|
||||
var err error
|
||||
assert := assert.New(t)
|
||||
qemuArchBase := newQemuArchBase()
|
||||
qemuArchBase.legacySerial = true
|
||||
|
||||
path := filepath.Join(filepath.Join(fs.MockRunStoragePath(), "test"), consoleSocket)
|
||||
|
||||
expectedOut := []govmmQemu.Device{
|
||||
govmmQemu.LegacySerialDevice{
|
||||
Chardev: "charconsole0",
|
||||
},
|
||||
govmmQemu.CharDevice{
|
||||
Driver: govmmQemu.LegacySerial,
|
||||
Backend: govmmQemu.Socket,
|
||||
DeviceID: "console0",
|
||||
ID: "charconsole0",
|
||||
Path: path,
|
||||
},
|
||||
}
|
||||
|
||||
devices, err = qemuArchBase.appendConsole(context.Background(), devices, path)
|
||||
assert.NoError(err)
|
||||
assert.Equal(expectedOut, devices)
|
||||
assert.Contains(qemuArchBase.kernelParams, Param{"console", "ttyS0"})
|
||||
}
|
||||
|
||||
func TestQemuArchBaseAppendImage(t *testing.T) {
|
||||
var devices []govmmQemu.Device
|
||||
assert := assert.New(t)
|
||||
|
||||
Reference in New Issue
Block a user