Skip to content
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

Nested virtualization with Linux VM #933

Closed
wants to merge 4 commits into from

Conversation

Fred78290
Copy link
Contributor

The object of this pull request is to support nested virtualization on Linux VM machines created with tart.

The nested virtualization is permitted only if:

  • MacOS 15.0 and greater
  • Apple Silicon M3 and greater.

Asking nested virtualization on unsupported will throw an error.

In the pull request it's also changed cpuCountMin=1 and memorySizeMin=512Mb for reasonable size for Linux VM.

@CLAassistant
Copy link

CLAassistant commented Nov 1, 2024

CLA assistant check
All committers have signed the CLA.

Copy link
Contributor

@fkorotkov fkorotkov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any objections to just enable it by default if it's supported? Can't think of any drawback.

@Fred78290
Copy link
Contributor Author

Any objections to just enable it by default if it's supported? Can't think of any drawback.

Any objection 👍🏻 I'll do it.

@fkorotkov
Copy link
Contributor

Thank you! You contribution is much appreciated as we still on M1/M2 and just getting to order M4 Minis. :-)

@Fred78290
Copy link
Contributor Author

Thank you! You contribution is much appreciated as we still on M1/M2 and just getting to order M4 Minis. :-)

My M4 pro incoming the 8th november hopping it is more veloce than my MacBook M3 pro compared against MacMini M2 pro.

Comment on lines +18 to +27
func platform(nvramURL: URL, enableNestedVirtualization: Bool) throws -> VZPlatformConfiguration {
let result: VZGenericPlatformConfiguration = VZGenericPlatformConfiguration()

if #available(macOS 15.0, *) {
if VZGenericPlatformConfiguration.isNestedVirtualizationSupported {
result.isNestedVirtualizationEnabled = enableNestedVirtualization
}
}

return result
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems enableNestedVirtualization is not used here and I think we can revert the rest of the changes in other files and just enable virtualization if possible.

Suggested change
func platform(nvramURL: URL, enableNestedVirtualization: Bool) throws -> VZPlatformConfiguration {
let result: VZGenericPlatformConfiguration = VZGenericPlatformConfiguration()
if #available(macOS 15.0, *) {
if VZGenericPlatformConfiguration.isNestedVirtualizationSupported {
result.isNestedVirtualizationEnabled = enableNestedVirtualization
}
}
return result
func platform(nvramURL: URL) throws -> VZPlatformConfiguration {
let result: VZGenericPlatformConfiguration = VZGenericPlatformConfiguration()
if #available(macOS 15.0, *) {
if VZGenericPlatformConfiguration.isNestedVirtualizationSupported {
result.isNestedVirtualizationEnabled = enableNestedVirtualization
}
}
return result

What do you think? Can do it in this PR or if it's more convenient in a separate one.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My point of view is: nested virtualization must be an user option.

lima tool do it as user option. Probably some users don't want allow the ability to create VM inside a VM in their work.

Also when nested virtualization is active extras kernel modules are load using extras memory and bandwith in IO.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My point of view is: nested virtualization must be an user option.

What do you think about a --nested option to tart run then?

Copy link
Contributor Author

@Fred78290 Fred78290 Nov 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about a --nested option to tart run then?

I agree it was my initial pull request 👍🏻

fkorotkov added a commit that referenced this pull request Nov 6, 2024
Only works for Linux VMs under Sequoia hosts.

Fixes #933
Fixes #701
fkorotkov added a commit that referenced this pull request Nov 6, 2024
)

Only works for Linux VMs under Sequoia hosts.

Fixes #933
Fixes #701
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants