Fix: Allow string values for realtime_mlock overcommit option#7
Fix: Allow string values for realtime_mlock overcommit option#7
Conversation
The `realtime_mlock` parameter's `overcommit` option in `qemu_vm.py` was previously restricted to boolean values. This change updates the code to allow string values as well, such as "on-fault". This provides more flexibility in configuring memory locking options for QEMU virtual machines. Boolean values will continue to be supported.
WalkthroughThe update modifies the type annotation for the "mem-lock" attribute under the "overcommit" QEMU option from Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant VM
participant DevicesContainer
User->>VM: make_create_command(realtime_mlock)
VM->>DevicesContainer: supports("overcommit")
alt overcommit supported
VM->>VM: Add "mem-lock" attribute with type None under "overcommit"
else overcommit not supported
VM->>VM: Add "mlock" attribute with type bool under "realtime"
end
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
virttest/qemu_vm.py (1)
3159-3166: Allow string values forrealtime_mlockovercommit option
Changing the vtype toNonein theattr_infotuple correctly bypasses the boolean-only branch in_add_option, enabling arbitrary string values like"on-fault". Please add or update unit tests to cover both boolean and string inputs forrealtime_mlockwhendevices.has_option("overcommit")is true.
The
realtime_mlockparameter'sovercommitoption inqemu_vm.pywas previously restricted to boolean values. This change updates the code to allow string values as well, such as "on-fault".This provides more flexibility in configuring memory locking options for QEMU virtual machines. Boolean values will continue to be supported.