mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-04-29 12:14:48 +00:00
virtcontainers: Allow s390x appendVhostUserDevice
Remove the prohibition of vhost-user devices on s390x, which are by now supported (e.g. vhost-user-fs-ccw). As a consequence, appendVhostUserDevice no longer needs an error in its signature. This enables virtio-fs support on s390x. Fixes: #1469 Signed-off-by: Jakob Naucke <jakob.naucke@ibm.com>
This commit is contained in:
parent
67ac4f4585
commit
7f60911333
@ -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:
|
||||
|
@ -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 {
|
||||
|
@ -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)
|
||||
|
@ -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 {
|
||||
|
@ -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)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user