machine_os: Preemptively load vfio kernel module.#678
machine_os: Preemptively load vfio kernel module.#678fnordahl merged 2 commits intoopenstack-charmers:masterfrom
Conversation
zaza/utilities/machine_os.py
Outdated
| :raises: AssertionError, zaza.model.CommandRunFailed | ||
| """ | ||
| zaza.utilities.juju.remote_run( | ||
| unit.name, 'modprobe vfio', model_name=model_name, fatal=True) |
There was a problem hiding this comment.
Would an alternative be to use the already existing load_kernel_module() function for this?:
zaza/zaza/utilities/machine_os.py
Lines 38 to 54 in 51c90db
And does the call belong here or on the test code (have no strong opinions on this one, just raising the question).
There was a problem hiding this comment.
Oh, good point about the load_kernel_module, I missed that.
Regarding the placement, I think that this is the right place. Up until now the tests called enable_vfio_unsafe_noiommu_mode with the assumption that the VFIO module is loaded. Loading the kernel here ensures that the assumption is correct (+ there are no side effects to trying to load already loaded module).
|
I wonder what changed since the last time the CI passed. I don't see any changes, yet linting fails on parts of the code that wasn't changed in this PR. |
VFIO kernel module is not always loaded, which causes tests to fail when they try to set No-IOMMU mode. This change calls modprobe to ensure that VFIO is loaded before we try to use it. Signed-off-by: Martin Kalcok <martin.kalcok@canonical.com>
Flake8 started to complain about unused 'global' and 'nonlocal' annotations (F842). Their usage fell into three categories: * variable was not assigned to after declaring it with 'global'. * function declared variable as 'global' before returning it. However, this does not make returned value "globally writable" * declaring 'global' for sets and dicts before modifying them. This is not necessary. These structures are globally mutable even without the 'global' statement. Signed-off-by: Martin Kalcok <martin.kalcok@canonical.com>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #678 +/- ##
=======================================
Coverage 89.50% 89.50%
=======================================
Files 42 42
Lines 4717 4718 +1
=======================================
+ Hits 4222 4223 +1
Misses 495 495 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
fnordahl
left a comment
There was a problem hiding this comment.
LGTM, and thank you for the code gardening required by new flake8 unblocking the zaza gate!
VFIO kernel module is not always loaded, which causes tests to fail when they try to set No-IOMMU mode. This change calls modprobe to ensure that VFIO is loaded before we try to use it.