-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
kvm: Passthrough host CPU in order to allow nesting #2555
Conversation
Can one of the admins verify this patch? |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: fabiand Assign the PR to them by writing The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Before this patch the virtual CPU was the stock qemu CPU, in the sense that the virtual CPU features were set according to the default qemu CPU. With this change the CPU features of the host will be copied at start to the domain definition. This includes features like svm and vmx, which in turn allow to run nested virtualization if the host is configured accordingly i.e. `kvm_intel nested=y` in `/etc/modprobe.d/kvm.conf`. To turn on nesting, a user has to specify `--kvm-cpu-model host-model` when creating the VM. Resolves kubernetes#2553 Signed-off-by: Fabian Deutsch <[email protected]>
This patch enables KVM support inside the ISO to support nesting. Signed-off-by: Fabian Deutsch <[email protected]>
Should be in a reviewable state now. |
/assign @luxas |
I cna confirm that nesting works:
Achieved with this patchset as is. |
@minikube-bot ok to test |
Not sure why the tests fail. |
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.
@zakame :) I chose Even if I favor to have |
/cc @r2d4 any thoughts on this PR? |
@@ -71,6 +72,7 @@ func createKVM2Host(config MachineConfig) *kvmDriver { | |||
}, | |||
Memory: config.Memory, | |||
CPU: config.CPUs, | |||
CPUModel: config.KvmCPUModel, |
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.
Is there any reason to actually pass this through as a config option? Could we hardcode it in the driver XML?
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.
We could hard code it if we are willing to make this change.
@michalskrivanek @berrange do you actually see a risk of defaulting to host-model
? (Could you also confirm that host-model will enable nesting [assuming the host is configured accordingly])
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.
Since you dont care about migration you should use host-passthrough in preference to host-model.
This reverts commit 7a4babe. For now we just hard-code passthrough. Signed-off-by: Fabian Deutsch <[email protected]>
With passthrough mode we can enable KVM nesting for guests. Fixes kubernetes#2553 Signed-off-by: Fabian Deutsch <[email protected]>
Any opinion on this PR? I'd be fine in going with teh hard coded solution, there should be no drawback. |
Awesome! |
Before this patch the virtual CPU was the stock qemu CPU, in the sense that
the virtual CPU features were set according to the default qemu CPU.
With this change the CPU features of the host will be copied at start to the
domain definition. This includes features like svm and vmx, which in turn allow
to run nested virtualization if the host is configured accordingly i.e.
kvm_intel nested=y
in/etc/modprobe.d/kvm.conf
.To turn on nesting, a user has to specify
--kvm-cpu-model host-model
whencreating the VM.
Resolves #2553
Signed-off-by: Fabian Deutsch [email protected]