Last active
October 22, 2021 12:49
-
-
Save johananl/6ff2dba00dc4dc1d7810de4feecb8646 to your computer and use it in GitHub Desktop.
KVM nested virtualization
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
L0 = bare metal machine | |
L1 = VM on bare metal | |
L2 = VM on VM | |
First, ensure virtualization is enabled on L0 as described here: https://docs.fedoraproject.org/en-US/quick-docs/using-nested-virtualization-in-kvm/#proc_enabling-nested-virtualization-in-kvm | |
Next, launch L1 with the following Vagrant config (or an equivalent directly on the hypervisor): | |
Vagrant.configure("2") do |config| | |
config.vm.box = "generic/ubuntu1604" | |
config.vm.provider :libvirt do |libvirt| | |
libvirt.cpus = 4 | |
libvirt.memory = 16000 | |
libvirt.nested = true | |
libvirt.cpu_mode = "host-passthrough" | |
libvirt.driver = "kvm" | |
end | |
end | |
Finally, launch L2 from within L1 using the following Vagrant config: | |
Vagrant.configure("2") do |config| | |
config.vm.box = "fedora/28-cloud-base" | |
config.vm.provider :libvirt do |libvirt| | |
libvirt.cpus = 1 | |
libvirt.memory = 1000 | |
libvirt.driver = "kvm" | |
libvirt.management_network_name = 'vagrant-libvirt-new' | |
libvirt.management_network_address = '192.168.124.0/24' | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Installing vagrant and libvirt on the L1