Enable Nested virtualization openstack cloud

Nested virtualization is guest operating system is itself a hypervisor that virtualizes not just processors and memory but also storage, networking hardware assists, and other resources. The VM hypervisor represents the first implementation of practical nested virtualization with hardware assists for performance. There are a number of hypervisors support nested virtualization though not as efficiently as they could. The Linux KVM supports nesting on recent virtualization-enabled processors. How to enable Nested Virtualization OpenStack cloud ?

nested virtualization

 

You need to the vmx cpu flag to be enabled inside your instances.

How to enable Nested virtualization in OpenStack Cloud

I have installed OpenStack using PackStack in our physical server. After successfully installed, verified that the setup is working fine.

We need to enable nested virtualization OpenStack cloud at the kernel level:

[root@openstack]#echo "options kvm-intel nested=y" >> /etc/modprobe.d/dist.conf

Modify the following settings in nova.conf file.

virt_type=kvm
...
cpu_mode=host-passthrough

host-passthrough” – use the host CPU model exactly

this causes libvirt to tell KVM to passthrough the host CPU with no modifications. The difference to host-model, instead of just matching feature flags, every last detail of the host CPU is matched.

host-model” –  clone the host CPU feature flags

Reboot your compute Host

Validate that nested virtualization is enable at the kernel level:

[root@openstack]# cat /sys/module/kvm_intel/parameters/nested
Y

Launch new instance on this node, and validate that your instance at the vmx cpu flag enable:

[root@nested ~]# cat /proc/cpuinfo | grep vmx
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon rep_good nopl eagerfpu pni pclmulqdq vmx ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm tpr_shadow vnmi flexpriority ept fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid xsaveopt
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon rep_good nopl eagerfpu pni pclmulqdq vmx ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm tpr_shadow vnmi flexpriority ept fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid xsaveopt

That’s all. A new virtual machine will be running as a hypervisor.