-
Notifications
You must be signed in to change notification settings - Fork 101
hvf: Add API to verify Nested Virt is supported #320
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
Conversation
Related to comments in containers/podman#25922 |
On the krunkit side, my thought was we could allow the user to still do |
0c582d5
to
cc35fce
Compare
If it's not supported, couldn't we just have |
That was the original behavior. At this moment, if the user wants to enable nested virt, they either have to already know the requirements for the feature and do some system queries, or they have to try and call For consumers of krunkit, like Podman, having the command fail is not a graceful way to handle the issue. It's also not ideal UX to have each consumer do the same manual checks when we can provide it for them. |
Your stated use-case in krunkit (the main consumer of this API):
What is the difference between |
We can define this failure as its own error code and have krunkit wrap/handle it accordingly for podman. |
cc35fce
to
aa00caf
Compare
In this scenario, you're right and the outcome would be the same. In the grand scheme of things, in my opinion, checking if nested virt is supported and enabling nested virt should be two separate operations. I don't want this to be a controversial change, so if it's best to go about this a different way so everyone's happy I can do that. |
I think the check itself is fine. I'm just not convinced it warrants its own krun API, when I try to avoid adding new krun APIs unless absolutely necessary though. Perhaps @slp has different thoughts? |
But every time you check for nested virt and it is supported, you would then enable, correct? This suggests to me it can be one operation. |
I don't have a strong opinion either way, but for me having this API seems fine (and doesn't seem hard to maintain). But yes, you can get by without having this API. This would perhaps be useful if you are creating a VM configuration to save to a file using some sort of CLI, but not starting it the VM yet - you can tell the user nested virt is not supported on their system. |
In this scenario, that VM configuration would only apply to the system you're running on. You wouldn't be able to pick up a config file built on a M3 (that would indicate nested virt is supported) and use it on a M2 system (it would wrongly indicate that nested virt is supported). Maybe I'm thinking too much into it, however. I just think that this check is best served when actually wanting to enable nested virt. |
I will just remove the UAPI and put the nested check at the start of I'd like to get this moving forward and get nested support in Podman |
Sorry for chiming it late. Both options are reasonable, the problem is that In addition to this, most of the configuration calls we have right now doesn't check if the parameters are viable (they only they're valid in the most basic sense). This is something that we might consider changing in v2, when we revamp the API. |
This is something I didn't think about, but that's a really good point and I agree.
|
aa00caf
to
63cabfa
Compare
src/hvf/src/lib.rs
Outdated
let mut el2_supported: bool = false; | ||
let ret = unsafe { (get_el2_supported.unwrap())(&mut el2_supported) }; | ||
if ret != HV_SUCCESS { | ||
error!("processor does not support the nested virtualization functionality"); |
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.
If hv_vm_config_get_el2_supported
we don't really know if it's supported or not, just that the function call failed. I think we should change this message to reflect that.
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.
Should be fixed now.
Sounds good to me. Perhaps we'll re-examine this in v2. |
Add an API to check if the current system supports Nested Virt on macOS. Signed-off-by: Jake Correnti <jakecorrenti+github@proton.me>
63cabfa
to
bee7cf0
Compare
Confirmed to work as expected in M1 (detects that nested virt is not available) and M3 (detects that nested virt is available). |
Add an API to check if the current system supports Nested Virt on macOS.