Add KVM device access support to Podman
Fixes: #4327
Pull Request Checklist
- [x] implement the feature
- [ ] write the documentation
- [x] extend the test coverage
- [ ] update the specification
- [ ] adjust plugin docstring
- [ ] modify the json schema
- [ ] mention the version
- [ ] include a release note
I would recommend making this feature more generic.
if self.kvm_device_access:
additional_args.extend(['--device=/dev/kvm'])
Let's say I want to also expose /dev/ttyS3 and /dev/drm_dp_aux5, what would the tmt answer be in that case, --ttyS3-device-access, --drm_dp_aux5-device-access?
Use case: tests which use qemu, being able to use kvm speeds up things alot. Podman just needs --device=/dev/kvm to make that work.
Complete podman command line (use Ctrl-A x to stop qemu and quit container):
We have several options how to proceed:
- Add
--kvm-device-access, solve that single use case, letting podman use/dev/kvm, and nothing else. - We could treat the request more generic, can we maybe enable
/dev/kvmevery time when it's available? If it's safe and beneficial, maybe it could be new default, and we can always offer--no-kvmoption to disable the feature in case of trouble. - Podman's
--deviceis quite generic, should we offer something similar? E.g.devicekey that would propagate its values to podman's--device- now that would probably unblock all devices, including/dev/kvm.
From these options, 1. seems like the least pleasing one, as it leaves every other device unavailable, and treats /dev/kvm in an exceptional way.
I would recommend making this feature more generic.
if self.kvm_device_access: additional_args.extend(['--device=/dev/kvm'])Let's say I want to also expose
/dev/ttyS3and/dev/drm_dp_aux5, what would the tmt answer be in that case,--ttyS3-device-access,--drm_dp_aux5-device-access?Use case: tests which use qemu, being able to use kvm speeds up things alot. Podman just needs --device=/dev/kvm to make that work. Complete podman command line (use Ctrl-A x to stop qemu and quit container):
We have several options how to proceed:
- Add
--kvm-device-access, solve that single use case, letting podman use/dev/kvm, and nothing else.- We could treat the request more generic, can we maybe enable
/dev/kvmevery time when it's available? If it's safe and beneficial, maybe it could be new default, and we can always offer--no-kvmoption to disable the feature in case of trouble.- Podman's
--deviceis quite generic, should we offer something similar? E.g.devicekey that would propagate its values to podman's--device- now that would probably unblock all devices, including/dev/kvm.From these options, 1. seems like the least pleasing one, as it leaves every other device unavailable, and treats
/dev/kvmin an exceptional way.
go with 2: https://github.com/teemtee/tmt/pull/4333/commits/6d553318063df9ce1c6d3078e195d67f53ce4450 :saluting_face: