-
Notifications
You must be signed in to change notification settings - Fork 239
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: Move UEFI detection to utils_misc #3849
base: master
Are you sure you want to change the base?
refactor: Move UEFI detection to utils_misc #3849
Conversation
Previously, the UEFI guest detection functions were part of the specific VMCheck classes (`LinuxVMCheck` and `WindowsVMCheck`) in the `virttest/utils_v2v.py` file. This commit refactors and relocates these functions to the more generic `virttest/utils_misc.py` file. Motivation: - The `is_uefi_guest` function, previously defined in the `VMCheck` classes, had dependencies that were not universally available across different architectures (e.g., ovrit on s390x). - To enhance code reusability the UEFI guest detection functions are moved to the utils_misc module. Updated Functions: - `is_linux_uefi_guest(runner)`: Check if a Linux guest is a UEFI guest. - `is_windows_uefi_guest(runner)`: Check if a Windows guest is a UEFI guest. These changes improve the code reusability in the codebase and make the UEFI guest detection functionality more accessible for various scenarios.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a small nitpick about an unused variable. Rest LGTM, thank you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for this. Your commits are missing the "Signed-off-by" line, you can add this with git commit --amend -s
after configuring user name and email e.g. via git config --edit --global
.
There are two lines too much in the windows function, IMO, please check the comment.
virttest/utils_misc.py
Outdated
cmd = 'findstr /c:"%s" %s' % (search_str, target_file) | ||
status, output = runner(cmd) | ||
if 'BIOS' in output: | ||
return False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These lines are not necessary, you already return 'EFI' in output
. Please, remove them. Also, you don't use status
, so please change to _, output = runner(cmd)
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Requested changes pushed.
…efi guest for clarity Signed-off-by: Walter Herold Veedla <walterheroldv@gmail.com>
40566f9
to
37a91ac
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you.
Previously, the UEFI guest detection functions were part of the specific VMCheck classes (
LinuxVMCheck
andWindowsVMCheck
) in thevirttest/utils_v2v.py
file. This commit refactors and relocates these functions to the more genericvirttest/utils_misc.py
file.Motivation:
is_uefi_guest
function, previously defined in theVMCheck
classes, had dependencies that were not universally available across different architectures (e.g., ovrit on s390x).Updated Functions:
is_linux_uefi_guest(runner)
: Check if a Linux guest is a UEFI guest.is_windows_uefi_guest(runner)
: Check if a Windows guest is a UEFI guest.These changes improve the code reusability in the codebase and make the UEFI guest detection functionality more accessible for various scenarios.