diff --git a/src/runtime/virtcontainers/qemu.go b/src/runtime/virtcontainers/qemu.go index 98f9a844ee..46a6bf9b48 100644 --- a/src/runtime/virtcontainers/qemu.go +++ b/src/runtime/virtcontainers/qemu.go @@ -1879,7 +1879,7 @@ func (q *qemu) addDevice(ctx context.Context, devInfo interface{}, devType devic vhostDev.SocketPath = sockPath vhostDev.DevID = id - q.qemuConfig.Devices, err = q.arch.appendVhostUserDevice(q.qemuConfig.Devices, vhostDev) + q.qemuConfig.Devices = q.arch.appendVhostUserDevice(q.qemuConfig.Devices, vhostDev) } else { q.Logger().WithField("volume-type", "virtio-9p").Info("adding volume") q.qemuConfig.Devices, err = q.arch.append9PVolume(ctx, q.qemuConfig.Devices, v) @@ -1894,7 +1894,7 @@ func (q *qemu) addDevice(ctx context.Context, devInfo interface{}, devType devic case config.BlockDrive: q.qemuConfig.Devices, err = q.arch.appendBlockDevice(ctx, q.qemuConfig.Devices, v) case config.VhostUserDeviceAttrs: - q.qemuConfig.Devices, err = q.arch.appendVhostUserDevice(q.qemuConfig.Devices, v) + q.qemuConfig.Devices = q.arch.appendVhostUserDevice(q.qemuConfig.Devices, v) case config.VFIODev: q.qemuConfig.Devices = q.arch.appendVFIODevice(q.qemuConfig.Devices, v) default: diff --git a/src/runtime/virtcontainers/qemu_arch_base.go b/src/runtime/virtcontainers/qemu_arch_base.go index ae0ce3a13e..aa8e4d59fd 100644 --- a/src/runtime/virtcontainers/qemu_arch_base.go +++ b/src/runtime/virtcontainers/qemu_arch_base.go @@ -96,7 +96,7 @@ type qemuArch interface { appendBlockDevice(ctx context.Context, devices []govmmQemu.Device, drive config.BlockDrive) ([]govmmQemu.Device, error) // appendVhostUserDevice appends a vhost user device to devices - appendVhostUserDevice(devices []govmmQemu.Device, drive config.VhostUserDeviceAttrs) ([]govmmQemu.Device, error) + appendVhostUserDevice(devices []govmmQemu.Device, drive config.VhostUserDeviceAttrs) []govmmQemu.Device // appendVFIODevice appends a VFIO device to devices appendVFIODevice(devices []govmmQemu.Device, vfioDevice config.VFIODev) []govmmQemu.Device @@ -633,7 +633,7 @@ func (q *qemuArchBase) appendBlockDevice(_ context.Context, devices []govmmQemu. return devices, nil } -func (q *qemuArchBase) appendVhostUserDevice(devices []govmmQemu.Device, attr config.VhostUserDeviceAttrs) ([]govmmQemu.Device, error) { +func (q *qemuArchBase) appendVhostUserDevice(devices []govmmQemu.Device, attr config.VhostUserDeviceAttrs) []govmmQemu.Device { qemuVhostUserDevice := govmmQemu.VhostUserDevice{} switch attr.Type { @@ -658,7 +658,7 @@ func (q *qemuArchBase) appendVhostUserDevice(devices []govmmQemu.Device, attr co devices = append(devices, qemuVhostUserDevice) - return devices, nil + return devices } func (q *qemuArchBase) appendVFIODevice(devices []govmmQemu.Device, vfioDev config.VFIODev) []govmmQemu.Device { diff --git a/src/runtime/virtcontainers/qemu_arch_base_test.go b/src/runtime/virtcontainers/qemu_arch_base_test.go index d4aba54fac..f134a15ae3 100644 --- a/src/runtime/virtcontainers/qemu_arch_base_test.go +++ b/src/runtime/virtcontainers/qemu_arch_base_test.go @@ -224,7 +224,7 @@ func testQemuArchBaseAppend(t *testing.T, structure interface{}, expected []govm case config.VFIODev: devices = qemuArchBase.appendVFIODevice(devices, s) case config.VhostUserDeviceAttrs: - devices, err = qemuArchBase.appendVhostUserDevice(devices, s) + devices = qemuArchBase.appendVhostUserDevice(devices, s) } assert.NoError(err) diff --git a/src/runtime/virtcontainers/qemu_s390x.go b/src/runtime/virtcontainers/qemu_s390x.go index 01968b6b1f..6a4c78264f 100644 --- a/src/runtime/virtcontainers/qemu_s390x.go +++ b/src/runtime/virtcontainers/qemu_s390x.go @@ -152,12 +152,6 @@ func (q *qemuS390x) appendCCWBlockDevice(ctx context.Context, devices []govmmQem return devices, nil } -// appendVhostUserDevice throws an error if vhost devices are tried to be used. -// See issue https://github.com/kata-containers/runtime/issues/659 -func (q *qemuS390x) appendVhostUserDevice(devices []govmmQemu.Device, attr config.VhostUserDeviceAttrs) ([]govmmQemu.Device, error) { - return nil, fmt.Errorf("No vhost-user devices supported on s390x") -} - // supportGuestMemoryHotplug return false for s390x architecture. The pc-dimm backend device for s390x // is not support. PC-DIMM is not listed in the devices supported by qemu-system-s390x -device help func (q *qemuS390x) supportGuestMemoryHotplug() bool { diff --git a/src/runtime/virtcontainers/qemu_s390x_test.go b/src/runtime/virtcontainers/qemu_s390x_test.go index 70ddf3ff21..3355680bb1 100644 --- a/src/runtime/virtcontainers/qemu_s390x_test.go +++ b/src/runtime/virtcontainers/qemu_s390x_test.go @@ -52,17 +52,3 @@ func TestQemuS390xMemoryTopology(t *testing.T) { m := s390x.memoryTopology(mem, hostMem, slots) assert.Equal(expectedMemory, m) } - -func TestQemuS390xAppendVhostUserDevice(t *testing.T) { - macAddress := "00:11:22:33:44:55:66" - qemu := qemuS390x{} - assert := assert.New(t) - - vhostUserDevice := config.VhostUserDeviceAttrs{ - Type: config.VhostUserNet, - MacAddress: macAddress, - } - - _, err := qemu.appendVhostUserDevice(nil, vhostUserDevice) - assert.Error(err) -}