mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-19 20:24:35 +00:00
vfio: Fix tests
Now with more elaborate checking of cold|hot plug ports we needed to update some of the tests. Signed-off-by: Zvonko Kaiser <zkaiser@nvidia.com>
This commit is contained in:
parent
62aa6750ec
commit
545de5042a
@ -334,7 +334,7 @@ func createAllRuntimeConfigFiles(dir, hypervisor string) (runtimeConfig string,
|
|||||||
sharedFS := "virtio-9p"
|
sharedFS := "virtio-9p"
|
||||||
virtioFSdaemon := path.Join(dir, "virtiofsd")
|
virtioFSdaemon := path.Join(dir, "virtiofsd")
|
||||||
hotPlugVFIO = config.BridgePort
|
hotPlugVFIO = config.BridgePort
|
||||||
coldPlugVFIO = config.RootPort
|
coldPlugVFIO = config.NoPort
|
||||||
|
|
||||||
configFileOptions := ktu.RuntimeConfigOptions{
|
configFileOptions := ktu.RuntimeConfigOptions{
|
||||||
Hypervisor: "qemu",
|
Hypervisor: "qemu",
|
||||||
|
@ -376,7 +376,7 @@ func (q *qemuS390x) appendVFIODevice(devices []govmmQemu.Device, vfioDev config.
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Query QMP to find a device's PCI path given its QOM path or ID
|
// Query QMP to find a device's PCI path given its QOM path or ID
|
||||||
func (q *qemuArchBase) qomGetPciPath(qemuID string, qmpCh *qmpChannel) (types.PciPath, error) {
|
func (q *qemuS390x) qomGetPciPath(qemuID string, qmpCh *qmpChannel) (types.PciPath, error) {
|
||||||
hvLogger.Warnf("qomGetPciPath not implemented for s390x")
|
hvLogger.Warnf("qomGetPciPath not implemented for s390x")
|
||||||
return types.PciPath{}, nil
|
return types.PciPath{}, nil
|
||||||
}
|
}
|
||||||
|
@ -644,6 +644,8 @@ func newSandbox(ctx context.Context, sandboxConfig SandboxConfig, factory Factor
|
|||||||
}
|
}
|
||||||
|
|
||||||
if hotPlugVFIO && isVFIODevice {
|
if hotPlugVFIO && isVFIODevice {
|
||||||
|
device.ColdPlug = false
|
||||||
|
device.Port = sandboxConfig.HypervisorConfig.HotPlugVFIO
|
||||||
vfioDevices = append(vfioDevices, device)
|
vfioDevices = append(vfioDevices, device)
|
||||||
sandboxConfig.Containers[cnt].DeviceInfos[dev].Port = sandboxConfig.HypervisorConfig.HotPlugVFIO
|
sandboxConfig.Containers[cnt].DeviceInfos[dev].Port = sandboxConfig.HypervisorConfig.HotPlugVFIO
|
||||||
}
|
}
|
||||||
@ -686,6 +688,7 @@ func newSandbox(ctx context.Context, sandboxConfig SandboxConfig, factory Factor
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, dev := range vfioDevices {
|
for _, dev := range vfioDevices {
|
||||||
|
s.Logger().Info("cold-plug device: ", dev)
|
||||||
_, err := s.AddDevice(ctx, dev)
|
_, err := s.AddDevice(ctx, dev)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
s.Logger().WithError(err).Debug("Cannot cold-plug add device")
|
s.Logger().WithError(err).Debug("Cannot cold-plug add device")
|
||||||
|
@ -606,6 +606,7 @@ func TestSandboxAttachDevicesVFIO(t *testing.T) {
|
|||||||
HostPath: path,
|
HostPath: path,
|
||||||
ContainerPath: path,
|
ContainerPath: path,
|
||||||
DevType: "c",
|
DevType: "c",
|
||||||
|
Port: config.RootPort,
|
||||||
}
|
}
|
||||||
dev, err := dm.NewDevice(deviceInfo)
|
dev, err := dm.NewDevice(deviceInfo)
|
||||||
assert.Nil(t, err, "deviceManager.NewDevice return error: %v", err)
|
assert.Nil(t, err, "deviceManager.NewDevice return error: %v", err)
|
||||||
|
Loading…
Reference in New Issue
Block a user