Beruflich Dokumente
Kultur Dokumente
com
http://www.rdoxenham.com/?p=275
rdoxenham.com
Rhys Oxenhams' Cloud Technology Blog
1 of 5
11/07/16 06:53
http://www.rdoxenham.com/?p=275
To enable it, we need to make sure the KVM architecture specific module is loaded
with the nested option. There are a few options for enabling it, the first way to do this
is just update your boot loader to specify the nested option; that way it persists with a
reboot or kernel upgrade. Assuming youre using Fedora with GRUB2, (as root) you
need to update the /etc/default/grub file and append kvm-intel.nested=1 to the
GRUB_CMDLINE_LINUX line. For reference, mine is specified below, remember to
replace intel with amd if required.
# cat /etc/default/grub | grep CMDLINE
GRUB_CMDLINE_LINUX="rd.lvm.lv=vol0/swapVol rd.md=0 rd.dm=0 KEYTABLE=us quiet rd
Once this is specified, youll need to rebuild your GRUB configuration files so that
when you next reboot the command line arguments you just specified are loaded,
note the GRUB2 configuration location may be different on a non-Fedora machine
# grub2-mkconfig -o /boot/grub2/grub.cfg
Alternatively, (thanks to Dominic Cleal for the suggestion) this can be modified using
the modprobe configuration files, making things slightly easier$ echo options kvm-intel nested=1 | sudo tee /etc/modprobe.d/kvm-intel.conf
I would now recommend rebooting your machine to verify the changes have been
made. Once again, you can re-run the previous command to check this and you
should see that the changes to the module have been made.
$ cat /sys/module/kvm_intel/parameters/nested
Y
And thats it, youve successfully enabled nested-KVM. Next, when you create new
virtual machines, e.g. with virt-manager, you will need to require vmx or svm to be
presented to the virtual machine; that way the guests can make use of the underlying
nested-KVM features that have been enabled. This can also be done via direct
modification of the libvirt XML definition of a given virtual machine, an example of one
of my VMs is shown below<cpu match='exact'>
<model>Westmere</model>
<feature policy='require' name='vmx'/>
</cpu>
Any questions please feel free to get in touch, Id be happy to help out.
Further reading: https://github.com/torvalds/linux/blob/master/Documentation/virtual
/kvm/nested-vmx.txt
Like 12
Tweet
26
This entry was posted in KVM, Linux by admin. Bookmark the permalink
2 of 5
11/07/16 06:53
http://www.rdoxenham.com/?p=275
[http://www.rdoxenham.com/?p=275] .
9 THOUGHTS ON HOW TO ENABLE NESTED KVM
James Read
on June 26, 2012 at 01:14 said:
Really good article Rhys, Id never heard of a hypervisor with this feature until
now.
At first it strikes you as a really peculiar option you can see why it is
disabled by default. Clearly, in the example you gave, such as debugging a
hypervisor or similar, it would be really useful to run virtual.
Dominic Cleal
on June 26, 2012 at 11:34 said:
Thanks Rhys. Slightly easier than updating GRUB is just to use modprobe:
echo options kvm-intel nested=1 | sudo tee /etc/modprobe.d/kvm-intel.conf
Looking in virt-manager, I see I didnt have the CPU model set up to be the
same as the hosts (theres a simple button under Processor that sets it up). I
wonder how performance would have been affected with/without the extra
SSE3/4 type extensions that its now enabled?
Dale Macartney
on June 26, 2012 at 12:15 said:
3 of 5
11/07/16 06:53
http://www.rdoxenham.com/?p=275
admin
on June 26, 2012 at 13:19 said:
Tim Jackson
on June 27, 2012 at 09:38 said:
Thanks for the tip Rhys, looking forward to trying this one out for local test
deployments etc.!
Bhaskar Chowdhury
on September 6, 2012 at 12:06 said:
Rapha
on May 31, 2013 at 18:28 said:
4 of 5
11/07/16 06:53
http://www.rdoxenham.com/?p=275
admin
on June 5, 2013 at 19:21 said:
@Rapha, this guide was written for Fedora/Red Hat based distributions.
Ubuntu doesnt have a modprobe.d configuration directory. Youll need to
make the necessary changes to the correct file, see http://askubuntu.com
/questions/51226/how-to-add-kernel-module-parameters for details.
Alex
on October 10, 2013 at 16:16 said:
5 of 5
11/07/16 06:53