mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-23 14:08:31 +00:00
qemu: treat console kernel params within appendConsole
as it is tightly coupled with the appended console device additionally have it tested Signed-off-by: Snir Sheriber <ssheribe@redhat.com>
This commit is contained in:
parent
51fa4ab671
commit
44814dce19
@ -552,13 +552,6 @@ func (q *qemu) CreateVM(ctx context.Context, id string, network Network, hypervi
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Breaks hypervisor abstration Has Kata Specific logic
|
|
||||||
kernel := govmmQemu.Kernel{
|
|
||||||
Path: kernelPath,
|
|
||||||
InitrdPath: initrdPath,
|
|
||||||
Params: q.kernelParameters(),
|
|
||||||
}
|
|
||||||
|
|
||||||
incoming := q.setupTemplate(&knobs, &memory)
|
incoming := q.setupTemplate(&knobs, &memory)
|
||||||
|
|
||||||
// With the current implementations, VM templating will not work with file
|
// With the current implementations, VM templating will not work with file
|
||||||
@ -630,6 +623,14 @@ func (q *qemu) CreateVM(ctx context.Context, id string, network Network, hypervi
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Breaks hypervisor abstraction has Kata Specific logic
|
||||||
|
kernel := govmmQemu.Kernel{
|
||||||
|
Path: kernelPath,
|
||||||
|
InitrdPath: initrdPath,
|
||||||
|
// some devices configuration may also change kernel params, make sure this is called afterwards
|
||||||
|
Params: q.kernelParameters(),
|
||||||
|
}
|
||||||
|
|
||||||
qemuConfig := govmmQemu.Config{
|
qemuConfig := govmmQemu.Config{
|
||||||
Name: fmt.Sprintf("sandbox-%s", q.id),
|
Name: fmt.Sprintf("sandbox-%s", q.id),
|
||||||
UUID: q.state.UUID,
|
UUID: q.state.UUID,
|
||||||
|
@ -56,8 +56,6 @@ var kernelParams = []Param{
|
|||||||
{"i8042.noaux", "1"},
|
{"i8042.noaux", "1"},
|
||||||
{"noreplace-smp", ""},
|
{"noreplace-smp", ""},
|
||||||
{"reboot", "k"},
|
{"reboot", "k"},
|
||||||
{"console", "hvc0"},
|
|
||||||
{"console", "hvc1"},
|
|
||||||
{"cryptomgr.notests", ""},
|
{"cryptomgr.notests", ""},
|
||||||
{"net.ifnames", "0"},
|
{"net.ifnames", "0"},
|
||||||
{"pci", "lastbus=0"},
|
{"pci", "lastbus=0"},
|
||||||
|
@ -337,6 +337,12 @@ func (q *qemuArchBase) appendConsole(_ context.Context, devices []govmmQemu.Devi
|
|||||||
|
|
||||||
devices = append(devices, console)
|
devices = append(devices, console)
|
||||||
|
|
||||||
|
consoleKernelParams := []Param{
|
||||||
|
{"console", "hvc0"},
|
||||||
|
{"console", "hvc1"},
|
||||||
|
}
|
||||||
|
q.kernelParams = append(q.kernelParams, consoleKernelParams...)
|
||||||
|
|
||||||
return devices, nil
|
return devices, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -259,6 +259,8 @@ func TestQemuArchBaseAppendConsoles(t *testing.T) {
|
|||||||
devices, err = qemuArchBase.appendConsole(context.Background(), devices, path)
|
devices, err = qemuArchBase.appendConsole(context.Background(), devices, path)
|
||||||
assert.NoError(err)
|
assert.NoError(err)
|
||||||
assert.Equal(expectedOut, devices)
|
assert.Equal(expectedOut, devices)
|
||||||
|
assert.Contains(qemuArchBase.kernelParams, Param{"console", "hvc0"})
|
||||||
|
assert.Contains(qemuArchBase.kernelParams, Param{"console", "hvc1"})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestQemuArchBaseAppendImage(t *testing.T) {
|
func TestQemuArchBaseAppendImage(t *testing.T) {
|
||||||
|
@ -33,8 +33,6 @@ const qmpMigrationWaitTimeout = 10 * time.Second
|
|||||||
const defaultQemuMachineOptions = "usb=off,accel=kvm,gic-version=host"
|
const defaultQemuMachineOptions = "usb=off,accel=kvm,gic-version=host"
|
||||||
|
|
||||||
var kernelParams = []Param{
|
var kernelParams = []Param{
|
||||||
{"console", "hvc0"},
|
|
||||||
{"console", "hvc1"},
|
|
||||||
{"iommu.passthrough", "0"},
|
{"iommu.passthrough", "0"},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,8 +41,6 @@ const tpmHostPath = "/dev/tpmrm0"
|
|||||||
var kernelParams = []Param{
|
var kernelParams = []Param{
|
||||||
{"rcupdate.rcu_expedited", "1"},
|
{"rcupdate.rcu_expedited", "1"},
|
||||||
{"reboot", "k"},
|
{"reboot", "k"},
|
||||||
{"console", "hvc0"},
|
|
||||||
{"console", "hvc1"},
|
|
||||||
{"cryptomgr.notests", ""},
|
{"cryptomgr.notests", ""},
|
||||||
{"net.ifnames", "0"},
|
{"net.ifnames", "0"},
|
||||||
}
|
}
|
||||||
|
@ -39,9 +39,7 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// Verify needed parameters
|
// Verify needed parameters
|
||||||
var kernelParams = []Param{
|
var kernelParams = []Param{}
|
||||||
{"console", "ttysclp0"},
|
|
||||||
}
|
|
||||||
|
|
||||||
var ccwbridge = types.NewBridge(types.CCW, "", make(map[uint32]string, types.CCWBridgeMaxCapacity), 0)
|
var ccwbridge = types.NewBridge(types.CCW, "", make(map[uint32]string, types.CCWBridgeMaxCapacity), 0)
|
||||||
|
|
||||||
@ -112,6 +110,8 @@ func (q *qemuS390x) appendConsole(ctx context.Context, devices []govmmQemu.Devic
|
|||||||
return devices, fmt.Errorf("Failed to append console %v", err)
|
return devices, fmt.Errorf("Failed to append console %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
q.kernelParams = append(q.kernelParams, Param{"console", "ttysclp0"})
|
||||||
|
|
||||||
serial := govmmQemu.SerialDevice{
|
serial := govmmQemu.SerialDevice{
|
||||||
Driver: virtioSerialCCW,
|
Driver: virtioSerialCCW,
|
||||||
ID: id,
|
ID: id,
|
||||||
|
Loading…
Reference in New Issue
Block a user