Merge pull request #1563 from Jakob-Naucke/s390x-missing-contexts

virtcontainers: Fix missing contexts in s390x
This commit is contained in:
Chelsea Mafrica
2021-03-30 09:38:28 -07:00
committed by GitHub
9 changed files with 70 additions and 67 deletions

View File

@@ -346,14 +346,14 @@ func (q *qemu) getQemuMachine() (govmmQemu.Machine, error) {
return machine, nil
}
func (q *qemu) appendImage(devices []govmmQemu.Device) ([]govmmQemu.Device, error) {
func (q *qemu) appendImage(ctx context.Context, devices []govmmQemu.Device) ([]govmmQemu.Device, error) {
imagePath, err := q.config.ImageAssetPath()
if err != nil {
return nil, err
}
if imagePath != "" {
devices, err = q.arch.appendImage(devices, imagePath)
devices, err = q.arch.appendImage(ctx, devices, imagePath)
if err != nil {
return nil, err
}
@@ -395,13 +395,13 @@ func (q *qemu) buildDevices(ctx context.Context, initrdPath string) ([]govmmQemu
// bridge gets the first available PCI address i.e bridgePCIStartAddr
devices = q.arch.appendBridges(devices)
devices, err = q.arch.appendConsole(devices, console)
devices, err = q.arch.appendConsole(ctx, devices, console)
if err != nil {
return nil, nil, err
}
if initrdPath == "" {
devices, err = q.appendImage(devices)
devices, err = q.appendImage(ctx, devices)
if err != nil {
return nil, nil, err
}
@@ -421,7 +421,7 @@ func (q *qemu) buildDevices(ctx context.Context, initrdPath string) ([]govmmQemu
var ioThread *govmmQemu.IOThread
if q.config.BlockDeviceDriver == config.VirtioSCSI {
return q.arch.appendSCSIController(devices, q.config.EnableIOThreads)
return q.arch.appendSCSIController(ctx, devices, q.config.EnableIOThreads)
}
return devices, ioThread, nil
@@ -611,7 +611,7 @@ func (q *qemu) createSandbox(ctx context.Context, id string, networkNS NetworkNa
ID: rngID,
Filename: q.config.EntropySource,
}
qemuConfig.Devices, err = q.arch.appendRNGDevice(qemuConfig.Devices, rngDev)
qemuConfig.Devices, err = q.arch.appendRNGDevice(ctx, qemuConfig.Devices, rngDev)
if err != nil {
return err
}
@@ -1882,17 +1882,17 @@ func (q *qemu) addDevice(ctx context.Context, devInfo interface{}, devType devic
q.qemuConfig.Devices, err = 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(q.qemuConfig.Devices, v)
q.qemuConfig.Devices, err = q.arch.append9PVolume(ctx, q.qemuConfig.Devices, v)
}
case types.Socket:
q.qemuConfig.Devices = q.arch.appendSocket(q.qemuConfig.Devices, v)
case types.VSock:
q.fds = append(q.fds, v.VhostFd)
q.qemuConfig.Devices, err = q.arch.appendVSock(q.qemuConfig.Devices, v)
q.qemuConfig.Devices, err = q.arch.appendVSock(ctx, q.qemuConfig.Devices, v)
case Endpoint:
q.qemuConfig.Devices, err = q.arch.appendNetwork(q.qemuConfig.Devices, v)
q.qemuConfig.Devices, err = q.arch.appendNetwork(ctx, q.qemuConfig.Devices, v)
case config.BlockDrive:
q.qemuConfig.Devices, err = q.arch.appendBlockDevice(q.qemuConfig.Devices, v)
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)
case config.VFIODev:

View File

@@ -6,6 +6,7 @@
package virtcontainers
import (
"context"
"fmt"
"time"
@@ -179,11 +180,11 @@ func (q *qemuAmd64) supportGuestMemoryHotplug() bool {
return q.qemuMachine.Type != govmmQemu.MachineTypeMicrovm
}
func (q *qemuAmd64) appendImage(devices []govmmQemu.Device, path string) ([]govmmQemu.Device, error) {
func (q *qemuAmd64) appendImage(ctx context.Context, devices []govmmQemu.Device, path string) ([]govmmQemu.Device, error) {
if !q.disableNvdimm {
return q.appendNvdimmImage(devices, path)
}
return q.appendBlockImage(devices, path)
return q.appendBlockImage(ctx, devices, path)
}
// appendBridges appends to devices the given bridges

View File

@@ -6,6 +6,7 @@
package virtcontainers
import (
"context"
"fmt"
"io/ioutil"
"os"
@@ -155,7 +156,7 @@ func TestQemuAmd64AppendImage(t *testing.T) {
},
}
devices, err := amd64.appendImage(nil, f.Name())
devices, err := amd64.appendImage(context.Background(), nil, f.Name())
assert.NoError(err)
assert.Equal(expectedOut, devices)
@@ -168,7 +169,7 @@ func TestQemuAmd64AppendImage(t *testing.T) {
assert.NotContains(amd64.machine().Options, qemuNvdimmOption)
found := false
devices, err = amd64.appendImage(nil, f.Name())
devices, err = amd64.appendImage(context.Background(), nil, f.Name())
assert.NoError(err)
for _, d := range devices {
if b, ok := d.(govmmQemu.BlockDevice); ok {

View File

@@ -63,37 +63,37 @@ type qemuArch interface {
memoryTopology(memoryMb, hostMemoryMb uint64, slots uint8) govmmQemu.Memory
// appendConsole appends a console to devices
appendConsole(devices []govmmQemu.Device, path string) ([]govmmQemu.Device, error)
appendConsole(ctx context.Context, devices []govmmQemu.Device, path string) ([]govmmQemu.Device, error)
// appendImage appends an image to devices
appendImage(devices []govmmQemu.Device, path string) ([]govmmQemu.Device, error)
appendImage(ctx context.Context, devices []govmmQemu.Device, path string) ([]govmmQemu.Device, error)
// appendBlockImage appends an image as block device
appendBlockImage(devices []govmmQemu.Device, path string) ([]govmmQemu.Device, error)
appendBlockImage(ctx context.Context, devices []govmmQemu.Device, path string) ([]govmmQemu.Device, error)
// appendNvdimmImage appends an image as nvdimm device
appendNvdimmImage(devices []govmmQemu.Device, path string) ([]govmmQemu.Device, error)
// appendSCSIController appens a SCSI controller to devices
appendSCSIController(devices []govmmQemu.Device, enableIOThreads bool) ([]govmmQemu.Device, *govmmQemu.IOThread, error)
appendSCSIController(context context.Context, devices []govmmQemu.Device, enableIOThreads bool) ([]govmmQemu.Device, *govmmQemu.IOThread, error)
// appendBridges appends bridges to devices
appendBridges(devices []govmmQemu.Device) []govmmQemu.Device
// append9PVolume appends a 9P volume to devices
append9PVolume(devices []govmmQemu.Device, volume types.Volume) ([]govmmQemu.Device, error)
append9PVolume(ctx context.Context, devices []govmmQemu.Device, volume types.Volume) ([]govmmQemu.Device, error)
// appendSocket appends a socket to devices
appendSocket(devices []govmmQemu.Device, socket types.Socket) []govmmQemu.Device
// appendVSock appends a vsock PCI to devices
appendVSock(devices []govmmQemu.Device, vsock types.VSock) ([]govmmQemu.Device, error)
appendVSock(ctx context.Context, devices []govmmQemu.Device, vsock types.VSock) ([]govmmQemu.Device, error)
// appendNetwork appends a endpoint device to devices
appendNetwork(devices []govmmQemu.Device, endpoint Endpoint) ([]govmmQemu.Device, error)
appendNetwork(ctx context.Context, devices []govmmQemu.Device, endpoint Endpoint) ([]govmmQemu.Device, error)
// appendBlockDevice appends a block drive to devices
appendBlockDevice(devices []govmmQemu.Device, drive config.BlockDrive) ([]govmmQemu.Device, error)
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)
@@ -102,7 +102,7 @@ type qemuArch interface {
appendVFIODevice(devices []govmmQemu.Device, vfioDevice config.VFIODev) []govmmQemu.Device
// appendRNGDevice appends a RNG device to devices
appendRNGDevice(devices []govmmQemu.Device, rngDevice config.RNGDev) ([]govmmQemu.Device, error)
appendRNGDevice(ctx context.Context, devices []govmmQemu.Device, rngDevice config.RNGDev) ([]govmmQemu.Device, error)
// addDeviceToBridge adds devices to the bus
addDeviceToBridge(ctx context.Context, ID string, t types.Type) (string, types.Bridge, error)
@@ -313,7 +313,7 @@ func (q *qemuArchBase) memoryTopology(memoryMb, hostMemoryMb uint64, slots uint8
return memory
}
func (q *qemuArchBase) appendConsole(devices []govmmQemu.Device, path string) ([]govmmQemu.Device, error) {
func (q *qemuArchBase) appendConsole(_ context.Context, devices []govmmQemu.Device, path string) ([]govmmQemu.Device, error) {
serial := govmmQemu.SerialDevice{
Driver: govmmQemu.VirtioSerial,
ID: "serial0",
@@ -385,16 +385,16 @@ func (q *qemuArchBase) appendNvdimmImage(devices []govmmQemu.Device, path string
return devices, nil
}
func (q *qemuArchBase) appendImage(devices []govmmQemu.Device, path string) ([]govmmQemu.Device, error) {
return q.appendBlockImage(devices, path)
func (q *qemuArchBase) appendImage(ctx context.Context, devices []govmmQemu.Device, path string) ([]govmmQemu.Device, error) {
return q.appendBlockImage(ctx, devices, path)
}
func (q *qemuArchBase) appendBlockImage(devices []govmmQemu.Device, path string) ([]govmmQemu.Device, error) {
func (q *qemuArchBase) appendBlockImage(ctx context.Context, devices []govmmQemu.Device, path string) ([]govmmQemu.Device, error) {
drive, err := genericImage(path)
if err != nil {
return nil, err
}
devices, err = q.appendBlockDevice(devices, drive)
devices, err = q.appendBlockDevice(ctx, devices, drive)
if err != nil {
return nil, err
}
@@ -422,7 +422,7 @@ func genericSCSIController(enableIOThreads, nestedRun bool) (govmmQemu.SCSIContr
return scsiController, t
}
func (q *qemuArchBase) appendSCSIController(devices []govmmQemu.Device, enableIOThreads bool) ([]govmmQemu.Device, *govmmQemu.IOThread, error) {
func (q *qemuArchBase) appendSCSIController(_ context.Context, devices []govmmQemu.Device, enableIOThreads bool) ([]govmmQemu.Device, *govmmQemu.IOThread, error) {
d, t := genericSCSIController(enableIOThreads, q.nestedRun)
devices = append(devices, d)
return devices, t, nil
@@ -480,7 +480,7 @@ func genericAppend9PVolume(devices []govmmQemu.Device, volume types.Volume, nest
return d, nil
}
func (q *qemuArchBase) append9PVolume(devices []govmmQemu.Device, volume types.Volume) ([]govmmQemu.Device, error) {
func (q *qemuArchBase) append9PVolume(_ context.Context, devices []govmmQemu.Device, volume types.Volume) ([]govmmQemu.Device, error) {
if volume.MountTag == "" || volume.HostPath == "" {
return devices, nil
}
@@ -514,7 +514,7 @@ func (q *qemuArchBase) appendSocket(devices []govmmQemu.Device, socket types.Soc
return devices
}
func (q *qemuArchBase) appendVSock(devices []govmmQemu.Device, vsock types.VSock) ([]govmmQemu.Device, error) {
func (q *qemuArchBase) appendVSock(_ context.Context, devices []govmmQemu.Device, vsock types.VSock) ([]govmmQemu.Device, error) {
devices = append(devices,
govmmQemu.VSOCKDevice{
ID: fmt.Sprintf("vsock-%d", vsock.ContextID),
@@ -592,7 +592,7 @@ func genericNetwork(endpoint Endpoint, vhost, nestedRun bool, index int) (govmmQ
return d, nil
}
func (q *qemuArchBase) appendNetwork(devices []govmmQemu.Device, endpoint Endpoint) ([]govmmQemu.Device, error) {
func (q *qemuArchBase) appendNetwork(_ context.Context, devices []govmmQemu.Device, endpoint Endpoint) ([]govmmQemu.Device, error) {
d, err := genericNetwork(endpoint, q.vhost, q.nestedRun, q.networkIndex)
if err != nil {
return devices, fmt.Errorf("Failed to append network %v", err)
@@ -624,7 +624,7 @@ func genericBlockDevice(drive config.BlockDrive, nestedRun bool) (govmmQemu.Bloc
}, nil
}
func (q *qemuArchBase) appendBlockDevice(devices []govmmQemu.Device, drive config.BlockDrive) ([]govmmQemu.Device, error) {
func (q *qemuArchBase) appendBlockDevice(_ context.Context, devices []govmmQemu.Device, drive config.BlockDrive) ([]govmmQemu.Device, error) {
d, err := genericBlockDevice(drive, q.nestedRun)
if err != nil {
return devices, fmt.Errorf("Failed to append block device %v", err)
@@ -678,7 +678,7 @@ func (q *qemuArchBase) appendVFIODevice(devices []govmmQemu.Device, vfioDev conf
return devices
}
func (q *qemuArchBase) appendRNGDevice(devices []govmmQemu.Device, rngDev config.RNGDev) ([]govmmQemu.Device, error) {
func (q *qemuArchBase) appendRNGDevice(_ context.Context, devices []govmmQemu.Device, rngDev config.RNGDev) ([]govmmQemu.Device, error) {
devices = append(devices,
govmmQemu.RngDevice{
ID: rngDev.ID,

View File

@@ -216,11 +216,11 @@ func testQemuArchBaseAppend(t *testing.T, structure interface{}, expected []govm
switch s := structure.(type) {
case types.Volume:
devices, err = qemuArchBase.append9PVolume(devices, s)
devices, err = qemuArchBase.append9PVolume(context.Background(), devices, s)
case types.Socket:
devices = qemuArchBase.appendSocket(devices, s)
case config.BlockDrive:
devices, err = qemuArchBase.appendBlockDevice(devices, s)
devices, err = qemuArchBase.appendBlockDevice(context.Background(), devices, s)
case config.VFIODev:
devices = qemuArchBase.appendVFIODevice(devices, s)
case config.VhostUserDeviceAttrs:
@@ -254,7 +254,7 @@ func TestQemuArchBaseAppendConsoles(t *testing.T) {
},
}
devices, err = qemuArchBase.appendConsole(devices, path)
devices, err = qemuArchBase.appendConsole(context.Background(), devices, path)
assert.NoError(err)
assert.Equal(expectedOut, devices)
}
@@ -270,7 +270,7 @@ func TestQemuArchBaseAppendImage(t *testing.T) {
err = image.Close()
assert.NoError(err)
devices, err = qemuArchBase.appendImage(devices, image.Name())
devices, err = qemuArchBase.appendImage(context.Background(), devices, image.Name())
assert.NoError(err)
assert.Len(devices, 1)
@@ -469,12 +469,12 @@ func TestQemuArchBaseAppendSCSIController(t *testing.T) {
},
}
devices, ioThread, err := qemuArchBase.appendSCSIController(devices, false)
devices, ioThread, err := qemuArchBase.appendSCSIController(context.Background(), devices, false)
assert.Equal(expectedOut, devices)
assert.Nil(ioThread)
assert.NoError(err)
_, ioThread, err = qemuArchBase.appendSCSIController(devices, true)
_, ioThread, err = qemuArchBase.appendSCSIController(context.Background(), devices, true)
assert.NotNil(ioThread)
assert.NoError(err)
}
@@ -539,9 +539,9 @@ func TestQemuArchBaseAppendNetwork(t *testing.T) {
},
}
devices, err = qemuArchBase.appendNetwork(devices, macvlanEp)
devices, err = qemuArchBase.appendNetwork(context.Background(), devices, macvlanEp)
assert.NoError(err)
devices, err = qemuArchBase.appendNetwork(devices, macvtapEp)
devices, err = qemuArchBase.appendNetwork(context.Background(), devices, macvtapEp)
assert.NoError(err)
assert.Equal(expectedOut, devices)
}

View File

@@ -93,11 +93,11 @@ func (q *qemuArm64) appendBridges(devices []govmmQemu.Device) []govmmQemu.Device
return genericAppendBridges(devices, q.Bridges, q.qemuMachine.Type)
}
func (q *qemuArm64) appendImage(devices []govmmQemu.Device, path string) ([]govmmQemu.Device, error) {
func (q *qemuArm64) appendImage(ctx context.Context, devices []govmmQemu.Device, path string) ([]govmmQemu.Device, error) {
if !q.disableNvdimm {
return q.appendNvdimmImage(devices, path)
}
return q.appendBlockImage(devices, path)
return q.appendBlockImage(ctx, devices, path)
}
func (q *qemuArm64) setIgnoreSharedMemoryMigrationCaps(_ context.Context, _ *govmmQemu.QMP) error {
@@ -109,7 +109,7 @@ func (q *qemuArm64) appendIOMMU(devices []govmmQemu.Device) ([]govmmQemu.Device,
return devices, fmt.Errorf("Arm64 architecture does not support vIOMMU")
}
func (q *qemuArm64) append9PVolume(devices []govmmQemu.Device, volume types.Volume) ([]govmmQemu.Device, error) {
func (q *qemuArm64) append9PVolume(_ context.Context, devices []govmmQemu.Device, volume types.Volume) ([]govmmQemu.Device, error) {
d, err := genericAppend9PVolume(devices, volume, q.nestedRun)
if err != nil {
return nil, err

View File

@@ -6,6 +6,7 @@
package virtcontainers
import (
"context"
"fmt"
"io/ioutil"
"os"
@@ -121,7 +122,7 @@ func TestQemuArm64AppendImage(t *testing.T) {
},
}
devices, err = arm64.appendImage(devices, f.Name())
devices, err = arm64.appendImage(context.Background(), devices, f.Name())
assert.NoError(err)
assert.Equal(expectedOut, devices)

View File

@@ -6,6 +6,7 @@
package virtcontainers
import (
"context"
"fmt"
"time"
@@ -87,9 +88,9 @@ func (q *qemuS390x) bridges(number uint32) {
// appendConsole appends a console to devices.
// The function has been overwriten to correctly set the driver to the CCW device
func (q *qemuS390x) appendConsole(devices []govmmQemu.Device, path string) ([]govmmQemu.Device, error) {
func (q *qemuS390x) appendConsole(ctx context.Context, devices []govmmQemu.Device, path string) ([]govmmQemu.Device, error) {
id := "serial0"
addr, b, err := q.addDeviceToBridge(id, types.CCW)
addr, b, err := q.addDeviceToBridge(ctx, id, types.CCW)
if err != nil {
return devices, fmt.Errorf("Failed to append console %v", err)
}
@@ -122,24 +123,24 @@ func (q *qemuS390x) appendConsole(devices []govmmQemu.Device, path string) ([]go
return devices, nil
}
func (q *qemuS390x) appendImage(devices []govmmQemu.Device, path string) ([]govmmQemu.Device, error) {
func (q *qemuS390x) appendImage(ctx context.Context, devices []govmmQemu.Device, path string) ([]govmmQemu.Device, error) {
drive, err := genericImage(path)
if err != nil {
return nil, err
}
return q.appendCCWBlockDevice(devices, drive)
return q.appendCCWBlockDevice(ctx, devices, drive)
}
func (q *qemuS390x) appendBlockDevice(devices []govmmQemu.Device, drive config.BlockDrive) ([]govmmQemu.Device, error) {
return q.appendCCWBlockDevice(devices, drive)
func (q *qemuS390x) appendBlockDevice(ctx context.Context, devices []govmmQemu.Device, drive config.BlockDrive) ([]govmmQemu.Device, error) {
return q.appendCCWBlockDevice(ctx, devices, drive)
}
func (q *qemuS390x) appendCCWBlockDevice(devices []govmmQemu.Device, drive config.BlockDrive) ([]govmmQemu.Device, error) {
func (q *qemuS390x) appendCCWBlockDevice(ctx context.Context, devices []govmmQemu.Device, drive config.BlockDrive) ([]govmmQemu.Device, error) {
d, err := genericBlockDevice(drive, false)
if err != nil {
return devices, fmt.Errorf("Failed to append blk-dev %v", err)
}
addr, b, err := q.addDeviceToBridge(drive.ID, types.CCW)
addr, b, err := q.addDeviceToBridge(ctx, drive.ID, types.CCW)
if err != nil {
return devices, fmt.Errorf("Failed to append blk-dev %v", err)
}
@@ -163,13 +164,13 @@ func (q *qemuS390x) supportGuestMemoryHotplug() bool {
return false
}
func (q *qemuS390x) appendNetwork(devices []govmmQemu.Device, endpoint Endpoint) ([]govmmQemu.Device, error) {
func (q *qemuS390x) appendNetwork(ctx context.Context, devices []govmmQemu.Device, endpoint Endpoint) ([]govmmQemu.Device, error) {
d, err := genericNetwork(endpoint, false, false, q.networkIndex)
if err != nil {
return devices, fmt.Errorf("Failed to append network %v", err)
}
q.networkIndex++
addr, b, err := q.addDeviceToBridge(d.ID, types.CCW)
addr, b, err := q.addDeviceToBridge(ctx, d.ID, types.CCW)
if err != nil {
return devices, fmt.Errorf("Failed to append network %v", err)
}
@@ -182,8 +183,8 @@ func (q *qemuS390x) appendNetwork(devices []govmmQemu.Device, endpoint Endpoint)
return devices, nil
}
func (q *qemuS390x) appendRNGDevice(devices []govmmQemu.Device, rngDev config.RNGDev) ([]govmmQemu.Device, error) {
addr, b, err := q.addDeviceToBridge(rngDev.ID, types.CCW)
func (q *qemuS390x) appendRNGDevice(ctx context.Context, devices []govmmQemu.Device, rngDev config.RNGDev) ([]govmmQemu.Device, error) {
addr, b, err := q.addDeviceToBridge(ctx, rngDev.ID, types.CCW)
if err != nil {
return devices, fmt.Errorf("Failed to append RNG-Device %v", err)
}
@@ -204,12 +205,12 @@ func (q *qemuS390x) appendRNGDevice(devices []govmmQemu.Device, rngDev config.RN
return devices, nil
}
func (q *qemuS390x) append9PVolume(devices []govmmQemu.Device, volume types.Volume) ([]govmmQemu.Device, error) {
func (q *qemuS390x) append9PVolume(ctx context.Context, devices []govmmQemu.Device, volume types.Volume) ([]govmmQemu.Device, error) {
if volume.MountTag == "" || volume.HostPath == "" {
return devices, nil
}
d := generic9PVolume(volume, false)
addr, b, err := q.addDeviceToBridge(d.ID, types.CCW)
addr, b, err := q.addDeviceToBridge(ctx, d.ID, types.CCW)
if err != nil {
return devices, fmt.Errorf("Failed to append 9p-Volume %v", err)
}
@@ -226,9 +227,9 @@ func (q *qemuS390x) appendBridges(devices []govmmQemu.Device) []govmmQemu.Device
return genericAppendBridges(devices, q.Bridges, q.qemuMachine.Type)
}
func (q *qemuS390x) appendSCSIController(devices []govmmQemu.Device, enableIOThreads bool) ([]govmmQemu.Device, *govmmQemu.IOThread, error) {
func (q *qemuS390x) appendSCSIController(ctx context.Context, devices []govmmQemu.Device, enableIOThreads bool) ([]govmmQemu.Device, *govmmQemu.IOThread, error) {
d, t := genericSCSIController(enableIOThreads, q.nestedRun)
addr, b, err := q.addDeviceToBridge(d.ID, types.CCW)
addr, b, err := q.addDeviceToBridge(ctx, d.ID, types.CCW)
if err != nil {
return devices, nil, fmt.Errorf("Failed to append scsi-controller %v", err)
}
@@ -241,10 +242,10 @@ func (q *qemuS390x) appendSCSIController(devices []govmmQemu.Device, enableIOThr
return devices, t, nil
}
func (q *qemuS390x) appendVSock(devices []govmmQemu.Device, vsock types.VSock) ([]govmmQemu.Device, error) {
func (q *qemuS390x) appendVSock(ctx context.Context, devices []govmmQemu.Device, vsock types.VSock) ([]govmmQemu.Device, error) {
var devno string
id := fmt.Sprintf("vsock-%d", vsock.ContextID)
addr, b, err := q.addDeviceToBridge(id, types.CCW)
addr, b, err := q.addDeviceToBridge(ctx, id, types.CCW)
if err != nil {
return devices, fmt.Errorf("Failed to append VSock: %v", err)
}
@@ -270,8 +271,8 @@ func (q *qemuS390x) appendIOMMU(devices []govmmQemu.Device) ([]govmmQemu.Device,
return devices, fmt.Errorf("S390x does not support appending a vIOMMU")
}
func (q *qemuS390x) addDeviceToBridge(ID string, t types.Type) (string, types.Bridge, error) {
addr, b, err := genericAddDeviceToBridge(q.Bridges, ID, types.CCW)
func (q *qemuS390x) addDeviceToBridge(ctx context.Context, ID string, t types.Type) (string, types.Bridge, error) {
addr, b, err := genericAddDeviceToBridge(ctx, q.Bridges, ID, types.CCW)
if err != nil {
return "", b, err
}

View File

@@ -10,7 +10,6 @@ import (
"testing"
govmmQemu "github.com/kata-containers/govmm/qemu"
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/device/config"
"github.com/stretchr/testify/assert"
)