Nested KVM

Some random notes (to be sorted at some point) on running KVM inside KVM, e.g. to test-run Cloudmin/Proxmox/CoreOS without affecting your machine.

Notice nesting is not enabled by default, it can be checked on /sys and enabled by passing nested=1 as an option to the module:

  $ cat /sys/module/kvm_intel/parameters/nested
  N
  rmmod kvm-intel                                # or kvm-amd
  modprobe kvm-intel nested=1
  $ cat /sys/module/kvm_intel/parameters/nested
  Y
  

Command-line example:

  # kvm -hda /dev/vg/lvkvm -cdrom osinstall.iso -boot d -m 1G \
    -vnc :2 -netdev tap,id=net0,ifname=tap0 -device virtio-net,netdev=net0,mac=52:54:00:12:34:56 -cpu host

Explanation:

Sources