diff --git a/src/runtime/virtcontainers/qemu.go b/src/runtime/virtcontainers/qemu.go index a910c580ff..070ace1e71 100644 --- a/src/runtime/virtcontainers/qemu.go +++ b/src/runtime/virtcontainers/qemu.go @@ -552,13 +552,6 @@ func (q *qemu) CreateVM(ctx context.Context, id string, network Network, hypervi return err } - // Breaks hypervisor abstration Has Kata Specific logic - kernel := govmmQemu.Kernel{ - Path: kernelPath, - InitrdPath: initrdPath, - Params: q.kernelParameters(), - } - incoming := q.setupTemplate(&knobs, &memory) // 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 } + // 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{ Name: fmt.Sprintf("sandbox-%s", q.id), UUID: q.state.UUID, diff --git a/src/runtime/virtcontainers/qemu_amd64.go b/src/runtime/virtcontainers/qemu_amd64.go index 3f52ab756d..773af95e8a 100644 --- a/src/runtime/virtcontainers/qemu_amd64.go +++ b/src/runtime/virtcontainers/qemu_amd64.go @@ -56,8 +56,6 @@ var kernelParams = []Param{ {"i8042.noaux", "1"}, {"noreplace-smp", ""}, {"reboot", "k"}, - {"console", "hvc0"}, - {"console", "hvc1"}, {"cryptomgr.notests", ""}, {"net.ifnames", "0"}, {"pci", "lastbus=0"}, diff --git a/src/runtime/virtcontainers/qemu_arch_base.go b/src/runtime/virtcontainers/qemu_arch_base.go index 62fec60a7d..0b5d505203 100644 --- a/src/runtime/virtcontainers/qemu_arch_base.go +++ b/src/runtime/virtcontainers/qemu_arch_base.go @@ -337,6 +337,12 @@ func (q *qemuArchBase) appendConsole(_ context.Context, devices []govmmQemu.Devi devices = append(devices, console) + consoleKernelParams := []Param{ + {"console", "hvc0"}, + {"console", "hvc1"}, + } + q.kernelParams = append(q.kernelParams, consoleKernelParams...) + return devices, nil } diff --git a/src/runtime/virtcontainers/qemu_arch_base_test.go b/src/runtime/virtcontainers/qemu_arch_base_test.go index ff20ba4479..2625a8a99d 100644 --- a/src/runtime/virtcontainers/qemu_arch_base_test.go +++ b/src/runtime/virtcontainers/qemu_arch_base_test.go @@ -259,6 +259,8 @@ func TestQemuArchBaseAppendConsoles(t *testing.T) { devices, err = qemuArchBase.appendConsole(context.Background(), devices, path) assert.NoError(err) assert.Equal(expectedOut, devices) + assert.Contains(qemuArchBase.kernelParams, Param{"console", "hvc0"}) + assert.Contains(qemuArchBase.kernelParams, Param{"console", "hvc1"}) } func TestQemuArchBaseAppendImage(t *testing.T) { diff --git a/src/runtime/virtcontainers/qemu_arm64.go b/src/runtime/virtcontainers/qemu_arm64.go index f5af19e219..f3a5576606 100644 --- a/src/runtime/virtcontainers/qemu_arm64.go +++ b/src/runtime/virtcontainers/qemu_arm64.go @@ -33,8 +33,6 @@ const qmpMigrationWaitTimeout = 10 * time.Second const defaultQemuMachineOptions = "usb=off,accel=kvm,gic-version=host" var kernelParams = []Param{ - {"console", "hvc0"}, - {"console", "hvc1"}, {"iommu.passthrough", "0"}, } diff --git a/src/runtime/virtcontainers/qemu_ppc64le.go b/src/runtime/virtcontainers/qemu_ppc64le.go index e18f2264b5..cfff5329c1 100644 --- a/src/runtime/virtcontainers/qemu_ppc64le.go +++ b/src/runtime/virtcontainers/qemu_ppc64le.go @@ -41,8 +41,6 @@ const tpmHostPath = "/dev/tpmrm0" var kernelParams = []Param{ {"rcupdate.rcu_expedited", "1"}, {"reboot", "k"}, - {"console", "hvc0"}, - {"console", "hvc1"}, {"cryptomgr.notests", ""}, {"net.ifnames", "0"}, } diff --git a/src/runtime/virtcontainers/qemu_s390x.go b/src/runtime/virtcontainers/qemu_s390x.go index 32716e7767..210a341766 100644 --- a/src/runtime/virtcontainers/qemu_s390x.go +++ b/src/runtime/virtcontainers/qemu_s390x.go @@ -39,9 +39,7 @@ const ( ) // Verify needed parameters -var kernelParams = []Param{ - {"console", "ttysclp0"}, -} +var kernelParams = []Param{} 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) } + q.kernelParams = append(q.kernelParams, Param{"console", "ttysclp0"}) + serial := govmmQemu.SerialDevice{ Driver: virtioSerialCCW, ID: id,